Page MenuHomeVyOS Platform

Static routes with dhcp-interface are flaky
Open, NormalPublicBUG

Description

I've observed the following issues with dhcp-interface static routes:

  1. Setting the interface to DHCP and adding a dhcp-interface static route in the same commit doesn't add the route to FRR.
  2. Renewing the DHCP lease after changing the default-router option or renumbering the network doesn't update the dhcp-interface next-hop in FRR.
  3. Rebooting after changing the default-router option or renumbering the network leaves the old dhcp-interface next-hop in FRR.

More info for #3:

vyos@vyos:~$ show configuration commands
set interfaces ethernet eth0 address 'dhcp'
set interfaces ethernet eth0 hw-id '0c:3f:c4:82:3f:00'
set interfaces loopback lo
set protocols static route 10.1.0.0/24 dhcp-interface 'eth0'
set system config-management commit-revisions '100'
set system console device ttyS0 speed '115200'
set system host-name 'vyos'
set system login user vyos authentication encrypted-password '$6$nl8G/LLSeS3igU'
set system login user vyos authentication plaintext-password ''
set system ntp server time1.vyos.net
set system ntp server time2.vyos.net
set system ntp server time3.vyos.net
set system syslog global facility all level 'info'
set system syslog global facility protocols level 'debug'
vyos@vyos:~$ show interfaces
Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down
Interface        IP Address                        S/L  Description
---------        ----------                        ---  -----------
eth0             10.0.2.10/24                      u/u  
lo               127.0.0.1/8                       u/u  
                 ::1/128                                
vyos@vyos:~$ vtysh -c 'show running-config'
Building configuration...

Current configuration:
!
frr version 7.5.1-20201222-185-gb3f4ff1d9
frr defaults traditional
hostname vyos
log syslog
log facility local7
service integrated-vtysh-config
!
ip route 10.1.0.0/24 10.0.1.1
!
line vty
!
end
vyos@vyos:~$ cat /var/lib/dhcp/dhclient_eth0.leases
lease {
  interface "eth0";
  fixed-address 10.0.1.10;
  option subnet-mask 255.255.255.0;
  option routers 10.0.1.1;
  option dhcp-lease-time 86400;
  option dhcp-message-type 5;
  option dhcp-server-identifier 10.0.1.1;
  renew 2 2021/07/13 18:16:10;
  rebind 2 2021/07/13 18:16:10;
  expire 2 2021/07/13 18:16:10;
}
lease {
  interface "eth0";
  fixed-address 10.0.2.10;
  option subnet-mask 255.255.255.0;
  option routers 10.0.2.1;
  option dhcp-lease-time 86400;
  option dhcp-message-type 5;
  option dhcp-server-identifier 10.0.2.1;
  renew 3 2021/07/14 05:25:46;
  rebind 3 2021/07/14 15:16:38;
  expire 3 2021/07/14 18:16:38;
}

Details

Difficulty level
Normal (likely a few hours)
Version
1.4-rolling-202107122017
Why the issue appeared?
Other
Is it a breaking change?
Perfectly compatible
Issue type
Unspecified (please specify)

Event Timeline

stepler changed the task status from Open to In progress.Jul 14 2021, 12:22 PM
stepler claimed this task.
stepler changed Difficulty level from Unknown (require assessment) to Normal (likely a few hours).Jul 14 2021, 5:56 PM
stepler changed Why the issue appeared? from Will be filled on close to Other.
stepler changed Is it a breaking change? from Unspecified (possibly destroys the router) to Perfectly compatible.
c-po set Issue type to Unspecified (please specify).

My thoughts on this for a proper implementation would be to change how static routes are installed in the system.

For this issue, it would be a good idea to determine which interface actually has DHCP enabled by traversing the configuration and for those that have a DHCP configuration, when we update the static routes, also those FRR statements must be rendered properly resolving the next-hop address.

As static_routes_macro.j2 already uses vyos.template.get_dhcp_router this should be fairly easy to implement.

c-po changed the task status from In progress to Needs testing.Nov 7 2021, 6:58 PM
c-po triaged this task as Normal priority.

All 3 original issues are still present on 1.4-rolling-202303170317.

Issue #3 looks slightly different:

vyos@vyos:~$ show configuration commands
set interfaces ethernet eth0 address 'dhcp'
set interfaces ethernet eth0 hw-id '0c:8c:f2:9f:00:00'
set interfaces loopback lo
set protocols static route 10.1.0.0/24 dhcp-interface 'eth0'
set service ntp allow-client address '0.0.0.0/0'
set service ntp allow-client address '::/0'
set service ntp server time1.vyos.net
set service ntp server time2.vyos.net
set service ntp server time3.vyos.net
set system config-management commit-revisions '100'
set system conntrack modules ftp
set system conntrack modules h323
set system conntrack modules nfs
set system conntrack modules pptp
set system conntrack modules sip
set system conntrack modules sqlnet
set system conntrack modules tftp
set system console device ttyS0 speed '115200'
set system host-name 'vyos'
set system login user vyos authentication encrypted-password '$6$.IBpa3JufbJr4o7i$Hbe.wAPP6S1rDYZIfUPJPFBzhAeAiMpMbfu80LCLBOp5/LlUjAEs6lh8VZAKvmuwjdC3ST6gUADqHi3GJN1Xo1'
set system login user vyos authentication plaintext-password ''
set system syslog global facility all level 'info'
set system syslog global facility protocols level 'debug'
vyos@vyos:~$ show interfaces
Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down
Interface        IP Address                        S/L  Description
---------        ----------                        ---  -----------
eth0             10.0.2.10/24                      u/u  
lo               127.0.0.1/8                       u/u  
                 ::1/128                                
vyos@vyos:~$ vtysh -c 'show running-config'
Building configuration...

Current configuration:
!
frr version 8.4.2
frr defaults traditional
hostname vyos
log syslog
log facility local7
service integrated-vtysh-config
!
ip route 0.0.0.0/0 10.0.1.1 eth0 tag 210 210
ip route 0.0.0.0/0 10.0.2.1 eth0 tag 210 210
ip route 10.1.0.0/24 10.0.1.1 eth0
!
rpki
exit
!
end
vyos@vyos:~$ cat /var/lib/dhcp/dhclient_eth0.leases
lease {
  interface "eth0";
  fixed-address 10.0.1.10;
  option subnet-mask 255.255.255.0;
  option routers 10.0.1.1;
  option dhcp-lease-time 86400;
  option dhcp-message-type 5;
  option dhcp-server-identifier 10.0.1.1;
  renew 2 2023/03/21 18:06:08;
  rebind 2 2023/03/21 18:06:08;
  expire 2 2023/03/21 18:06:08;
}
lease {
  interface "eth0";
  fixed-address 10.0.2.10;
  option subnet-mask 255.255.255.0;
  option routers 10.0.2.1;
  option dhcp-lease-time 86400;
  option dhcp-message-type 5;
  option dhcp-server-identifier 10.0.2.1;
  renew 3 2023/03/22 03:14:14;
  rebind 3 2023/03/22 15:06:29;
  expire 3 2023/03/22 18:06:29;
}

Note the duplicate default route.