network icon indicating copy to clipboard operation
network copied to clipboard

Routing rules improvement

Open Isuaven opened this issue 3 years ago • 6 comments

Please add some features:

  • Add installing NetworkManager-config-routing-rules package when NM selected as network_provider. As I googled this package is mandatory for routing-rules support in NM
  • Add support to create routing tables in in /etc/iproute2/rt_tables or /etc/iproute2/rt_tables.d/*.conf if they does not exist
  • Add support for network_provider initscripts

Isuaven avatar Oct 31 '22 11:10 Isuaven

Add installing NetworkManager-config-routing-rules package when NM selected as network_provider.

The package is renamed to NetworkManager-dispatcher-routing-rules.

As I googled this package is mandatory for routing-rules support in NM

this is not correct (at least not for a very long time)...

well, it depend on how you define "routing-rules support". NM won't use ifcfg rules files. If you want to use those and want NetworkManager to manage the ifcfg file, then you could use the dispatcher script. But that seems not a great solution. Either use network-scripts if you want to use network-scripts (and their rule files), or use NetworkManager's way to configure routing rules.

Add support to create routing tables in in /etc/iproute2/rt_tables or /etc/iproute2/rt_tables.d/*.conf if they does not exist

With what content exactly? NetworkManager itself does not honor those files. In NetworkManager API, tables are only numbers. This role supports readingthose files. They need to be generated by the user first (e.g. by an accompanying part of the playbook).

Add support for network_provider initscripts

Makes sense.

thom311 avatar Oct 31 '22 13:10 thom311

well, it depend on how you define "routing-rules support". They need to be generated by the user first (e.g. by an accompanying part of the playbook).

I want only use yours module as complex solution for confuguring all host network properties witch resolve all dependencies that needs for correct work. If you think thats all right it current implementation its ok, you have more much knowledge in network settings than me, I can be wrong

Makes sense.

Will wait for it

Isuaven avatar Nov 03 '22 12:11 Isuaven

Thank you for taking the time to report this.

Please add some features:

  • Add support to create routing tables in in /etc/iproute2/rt_tables or /etc/iproute2/rt_tables.d/*.conf if they does not exist

What is your use case, what would you like to achieve? Since the format is pretty simple, the ansible.builtin.lineinfile module seems to be sufficient to handle this. It seems an example for this would be an great addition here .

  • Add support for network_provider initscripts

The initscripts support is in bugfix mode. What is your use case for these instead of using NM?

tyll avatar Feb 10 '23 20:02 tyll

What is your use case, what would you like to achieve? Since the format is pretty simple, the ansible.builtin.lineinfile module seems to be sufficient to handle this. It seems an example for this would be an great addition here .

Im very new in Ansible and my example maybe not correct but Im using this code before yours Role. You can rework it:

- name: Create routing tables
  lineinfile:
    path: /etc/iproute2/rt_tables
    regexp: '^{{ item.table_id }}\s'
    line: "{{ item['table_id'] }}\t{{ item['name'] }}"
  with_items: "{{ routing_tables }}" 
  become: yes

With definition values in host/group vars as

routing_tables:
  - name: "mytable1"
    table_id: 100
  - name: "mytable2"
    table_id: 101

The initscripts support is in bugfix mode. What is your use case for these instead of using NM?

To use in systems where NM is disabled with some architector's reasons

Isuaven avatar Mar 03 '23 07:03 Isuaven

I just spent about 4 hours troubleshooting this same issue myself, and it appears I'm having the exact same issue. Is there anything that I could provide to help with the bug using route tables on initscripts mode?

alessard-trackforce avatar Apr 01 '24 20:04 alessard-trackforce

Or maybe we could at least state clearly in the README that route tables are not supported for initscripts mode?

alessard-trackforce avatar Apr 01 '24 21:04 alessard-trackforce