Page MenuHomeVyOS Platform

Static routes with dhcp-interface are flaky
Closed, ResolvedPublicBUG

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:

[email protected]:~$ 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'
[email protected]:~$ 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                                
[email protected]:~$ 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
[email protected]:~$ 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.