Page MenuHomeVyOS Platform

[DHCP] static route dhcp-interface issues
In progress, NormalPublicBUG

Description

hi

I've been testing a behavior in our VyOS-CLI , it happens when you want to add an extra route static with the same prefix but different next-hop (interfaces) ,let me show :

# dhcp interfaces

vyos@vyos#  run show dhcp client lease
interface  : eth0
ip address : 192.168.122.60     [Active]
subnet mask: 255.255.255.0
router     : 192.168.122.1
name server: 192.168.122.1
dhcp server: 192.168.122.1
lease time : 3600
last update: Thu Jan 27 18:13:13 UTC 2022
expiry     : Thu Jan 27 19:13:08 UTC 2022
reason     : BOUND

interface  : eth1
ip address : 10.10.10.2 [Active]
subnet mask: 255.255.255.0
router     : 10.10.10.1
name server: 10.10.10.1
dhcp server: 10.10.10.1
lease time : 86400
last update: Thu Jan 27 18:14:29 UTC 2022
expiry     : Fri Jan 28 18:14:25 UTC 2022
reason     : BOUND

first we add our route static again eth0

vyos@vyos# set protocols static route 1.1.1.1/32 dhcp-interface eth0

vyos@vyos# run show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup

S>* 0.0.0.0/0 [210/0] via 10.10.10.1, eth1, weight 1, 00:07:23
  *                   via 192.168.122.1, eth0, weight 1, 00:07:23
S>* 1.1.1.1/32 [1/0] via 192.168.122.1, eth0, weight 1, 00:00:12

then we add an extra static with the same prefix but using a different interfaces (eth1)

set protocols static route 1.1.1.1/32 dhcp-interface eth1

after we should see these two static on our VyOS-cli but it doesn't happen .however if you check the RIB (route table) these routes are showing:

vyos@vyos# run show configuration commands | match static
set protocols static route 1.1.1.1/32 dhcp-interface 'eth1'
[edit]
vyos@vyos# run show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup

S>* 0.0.0.0/0 [210/0] via 10.10.10.1, eth1, weight 1, 00:30:04
  *                   via 192.168.122.1, eth0, weight 1, 00:30:04
S>* 1.1.1.1/32 [1/0] via 10.10.10.1, eth1, weight 1, 00:22:00
  *                  via 192.168.122.1, eth0, weight 1, 00:22:00
C>* 10.10.10.0/24 is directly connected, eth1, 00:30:05
C>* 192.168.122.0/24 is directly connected, eth0, 00:31:22

it brings some problems , when you want to remove the first static or you compare your current settings with the route table . On FRR shows the following :

vyos@vyos# sudo vtysh -c " show run "
Building configuration...

Current configuration:
!
frr version 7.5.1-20211211-00-g294410782
frr defaults traditional
hostname vyos
log syslog
log facility local7
service integrated-vtysh-config
!
ip route 0.0.0.0/0 10.10.10.1 eth1 tag 210 210
ip route 0.0.0.0/0 192.168.122.1 eth0 tag 210 210
ip route 1.1.1.1/32 192.168.122.1
ip route 1.1.1.1/32 10.10.10.1
!

I think correct behavior is to keep both route statics in our cli ( so it should allow removing any static)

Details

Version
VyOS 1.3.0
Is it a breaking change?
Perfectly compatible
Issue type
Feature (new functionality)

Event Timeline

Unknown Object (User) subscribed.EditedJan 28 2022, 1:46 AM

I have emulated the same scenario in to vyos VyOS 1.4-rolling-202201041316
And it works well.
{

vyos@vyos:~$ show dhcp client leases
interface  : eth0
ip address : 172.168.32.146     [Active]
subnet mask: 255.255.255.0
domain name: localdomain        [overridden by domain-name set using CLI]
router     : 172.168.32.2
name server: 172.168.32.2
dhcp server: 172.168.32.254
lease time : 1800
last update: Fri Jan 28 01:09:31 UTC 2022
expiry     : Fri Jan 28 01:39:30 UTC 2022
reason     : RENEW

interface  : eth1
ip address : 10.20.20.200       [Active]
subnet mask: 255.255.255.0
router     : 10.20.20.1
dhcp server: 10.20.20.1
lease time : 8000
last update: Fri Jan 28 01:01:37 UTC 2022
expiry     : Fri Jan 28 03:14:56 UTC 2022
reason     : BOUND

{

vyos@vyos# set protocols static route 8.8.8.8/32 dhcp-interface eth0
vyos@vyos# set protocols static route 8.8.8.8/32 dhcp-interface eth1
vyos@vyos# commit

vyos@vyos# run sh ip rou
Codes: K - kernel route, C - connected, S - static, R - RIP,
     O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
     T - Table, v - VNC, V - VNC-Direct, A - Babel, F - PBR,
     f - OpenFabric,
     > - selected route, * - FIB route, q - queued, r - rejected, b - backup
     t - trapped, o - offload failure

S>* 0.0.0.0/0 [210/0] via 172.168.32.2, eth0, weight 1, 00:00:08
  *                   via 10.20.20.1, eth1 inactive, weight 1, 00:00:08
S   8.8.8.8/32 [1/0] via 10.20.20.1, eth1 inactive, weight 1, 00:00:08
C>* 10.20.20.0/24 is directly connected, eth1, 00:40:42
C>* 172.168.32.0/24 is directly connected, eth0, 00:46:34

VyOS chose the last command.

It's good to know that it works as expected on 1.4-rolling. Is it possible to get a fix for 1.3?

To clarify, the issue is with changing the next-hop from eth0 to eth1.

In 1.3, if you have a static route with dhcp-interface eth0 and you change this to dhcp-interface eth1, then both routes will incorrectly appear in the routing table.

I'm not completely sure that behavior in 1.4 is the correct one.
If I add these two routes:

vyos@vyos# set protocols static route 8.8.8.8/32 dhcp-interface eth0
vyos@vyos# set protocols static route 8.8.8.8/32 dhcp-interface eth1

I would expect to see both in main routing table, as it is in 1.3 version. I would expect that latest command doesn't overwrite previous command, as user may want/need redundancy for that particular route.
So I think that adding routes to main routing table and not overwriting previous entry is the correct behavior.
IMO in 1.3:

  • Second route is added and not overwriten in main routing table -- OK
  • But in vyos cli, second route overwrites the first one, when both routes should remain present in config --- Not OK
Unknown Object (User) added a comment.Jan 29 2022, 10:04 PM

I've checked the same scenario on the cisco router.

Router(config)#ip route 8.8.8.8 255.255.255.255 FastEthernet0/0 dhcp
Router(config)#ip route 8.8.8.8 255.255.255.255 FastEthernet0/1 dhcp

What we have:

S       8.8.8.8 [1/0] via 172.168.32.2, FastEthernet0/0
                [1/0] via 10.20.20.1, FastEthernet0/1
 .
 .
S*   0.0.0.0/0 [254/0] via 172.168.32.2
               [254/0] via 10.20.20.1

Yes, I agree that it's unusual behavior in VYOS 1.4 when it chooses the last route between two routers.

@fernando What do you want to see it that case?
In the our CLI DHCP-route can be as a single value now:

set protocols static route 192.0.2.192/32 dhcp-interface 'eth0'
set protocols static route 192.0.2.192/32 dhcp-interface 'eth2'

I.e. the first route will be replaced with the second route in CLI.
So if I understand correctly you expect that this route will be also replaced an in the FRR?

I think there is a bit of confusion here. nowadays 1.4 it's works as you mention , but 1.3 doesn't remove static (so we can see both static in the RIB) . however, In my personal opinion , it should show both static in our cli (same also on FRR) , because it's possible that you may need a different prefix ,it'll be installed with a different next-hop .

The problem in 1.3.0 is that if you delete the next-hop and then use a different next-hop, both next-hops are in the routing table. The next-hop that you deleted is still there:

support@vyos:~$ show config commands | match static
set protocols static route 1.1.1.1/32 dhcp-interface 'eth4'
configure
delete protocols static route 1.1.1.1/32 dhcp-interface eth4
set protocols static route 1.1.1.1/32 dhcp-interface eth5
commit

The eth4 route will not be removed from the routing table:

S>* 1.1.1.1/32 [1/0] via 123.1.1.1, eth4, weight 1, 00:00:35
  *                  via 137.25.32.1, eth5, weight 1, 00:00:35
support@vyos:~$ show config commands | match static
set protocols static route 1.1.1.1/32 dhcp-interface 'eth5'

@aohanian I got it, thanks, so it doesn't delete the previous route in one commit
it can be archived with 2 commits

configure
delete protocols static route 1.1.1.1/32 dhcp-interface eth4
commit
set protocols static route 1.1.1.1/32 dhcp-interface eth5
commit

I'll take a look at it.

@fernando @m.korobeinikov For CLI changes like a node with "multi" values, it should be a new feature request for CLI change, which will include several dhcp-routes to the same host. As it requires changes in the CLI logic.

This comment was removed by rchrist.
dmbaturin changed Is it a breaking change? from Unspecified (possibly destroys the router) to Perfectly compatible.
dmbaturin changed Issue type from Unspecified (please specify) to Bug (incorrect behavior).
natali-rs1985 changed the task status from Open to In progress.Thu, Nov 28, 12:42 PM
natali-rs1985 claimed this task.
natali-rs1985 changed Issue type from Bug (incorrect behavior) to Feature (new functionality).