michaelrigart / ansible-role-interfaces

An ansible role for configuring different network interfaces
GNU General Public License v3.0
83 stars 61 forks source link

VLAN interfaces lose static routes after bouncing parent #86

Closed markgoddard closed 3 years ago

markgoddard commented 3 years ago

On CentOS/RHEL systems, if the parent device of a VLAN interface goes down, the VLAN interface will also go down. If the parent device is brought back up again, the VLAN interface will become active again, but any static routes previously assigned to the VLAN interface are not reinstated.

Steps to reproduce:

playbook.yml

---
- hosts: localhost
  tasks:
    - import_role:
        name: MichaelRigart.interfaces
      vars:
        interfaces_ether_interfaces:
          - device: fake1.2
            bootproto: static
            vlan: 2
            address: 10.10.1.0
            netmask: 255.255.255.0
            route:
              - network: 10.10.2.0
                netmask: 255.255.255.0
                gateway: 10.10.1.1
            onboot: yes
          - device: fake1
            bootproto: static
            address: 10.10.3.0
            netmask: 255.255.255.0
            onboot: yes

Create a fake interface:

sudo ip link add fake1 type dummy

Run the playbook:

ansible-playbook playbook.yml

The fake1.2 interface has a static route.

ip route

Trigger a restart of the parent:

sudo rm /etc/sysconfig/network-scripts/ifcfg-fake1

Run the playbook again:

ansible-playbook playbook.yml

It succeeds, but the fake1.2 interface has lost its static route.

ip route