linux-system-roles / network

An ansible role to configure networking
https://linux-system-roles.github.io/network/
BSD 3-Clause "New" or "Revised" License
234 stars 106 forks source link

Routing rules improvement #536

Open Isuaven opened 1 year ago

Isuaven commented 1 year ago

Please add some features:

thom311 commented 1 year ago

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.

Isuaven commented 1 year ago

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

tyll commented 1 year ago

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?

Isuaven commented 1 year ago

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

alessard-trackforce commented 6 months ago

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 commented 6 months ago

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