Page MenuHomeVyOS Platform

dhclient-script-vyos does not support VRFs
Closed, ResolvedPublicBUG

Description

When habing a DHCP interface placed in a VRF the default route received via DHCP is not added to the VRFs routing table.

Instead the main routing table is used.

Apr 12 13:21:29 vyos dhclient[3632]: DHCPOFFER of 172.16.33.125 from 172.16.33.254
Apr 12 13:21:29 vyos dhclient[3632]: DHCPREQUEST for 172.16.33.125 on wlan0 to 255.255.255.255 port 67
Apr 12 13:21:29 vyos dhclient[3632]: DHCPACK of 172.16.33.125 from 172.16.33.254
Apr 12 13:21:29 vyos dhclient-script-vyos[3690]: Current dhclient PID: 3632, Parent PID: 1, IP version: -4, All dhclients for interface wlan0: 3632
Apr 12 13:21:29 vyos dhclient-script-vyos[3690]: Passing command to /usr/sbin/ip: "-4 addr add 172.16.33.125/255.255.255.0 broadcast 172.16.33.255 valid_lft 86400 preferred_lft 86400 dev wlan0 label wlan0"
Apr 12 13:21:30 vyos dhclient-script-vyos[3690]: FRR status: running
Apr 12 13:21:30 vyos dhclient-script-vyos[3690]: Checking if the route presented in kernel: default via 172.16.33.254 dev wlan0
Apr 12 13:21:30 vyos dhclient-script-vyos[3690]: Converted vtysh command: "ip route 0.0.0.0/0 172.16.33.254 wlan0 tag 210 210"
Apr 12 13:21:30 vyos dhclient-script-vyos[3690]: Sending command to vtysh
Apr 12 13:21:30 vyos staticd[1008]: Static Route using wlan0 interface not installed because the interface does not exist in specified vrf
Apr 12 13:21:30 vyos dhclient-script-vyos[3690]: Adding search-domain "vyos.net" via vyos-hostsd-client
set interfaces wireless wlan0 address 'dhcp'
set interfaces wireless wlan0 channel '0'
set interfaces wireless wlan0 description 'foo bar baz 1234'
set interfaces wireless wlan0 hw-id 'XX:XX:XX:XX:XX:c3'
set interfaces wireless wlan0 mgmt-frame-protection 'disabled'
set interfaces wireless wlan0 mode 'g'
set interfaces wireless wlan0 physical-device 'phy0'
set interfaces wireless wlan0 security wpa passphrase 'VyOSVyOS123'
set interfaces wireless wlan0 ssid 'VYOS-NET'
set interfaces wireless wlan0 type 'station'
set interfaces wireless wlan0 vrf 'black'

A hint could be the implementation from https://github.com/vyos/vyos-1x/blob/current/data/templates/pppoe/ip-up.script.tmpl

Details

Difficulty level
Normal (likely a few hours)
Version
1.3-rolling-202004120117
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)

Related Objects

StatusSubtypeAssignedTask
ResolvedFEATURE REQUESTViacheslav
ResolvedBUGViacheslav

Event Timeline

c-po created this task.

PR https://github.com/vyos/vyos-1x/pull/525 add a default for dhclient via vrf.

Config

set vrf name mgmt table '100'
set interfaces ethernet eth0 vrf 'mgmt'
set interfaces ethernet eth0 address 'dhcp'
set vrf bind-to-all
vyos@r4-roll# set interfaces ethernet eth0 address dhcp
[edit]
vyos@r4-roll# commit
e[edit]
vyos@r4-roll# exit

Show ip route

vyos@r4-roll:~$ show ip route vrf mgmt 
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 route, r - rejected route

VRF mgmt:
S>* 0.0.0.0/0 [210/0] via 192.168.122.1, eth0, 00:00:08
K * 0.0.0.0/0 [255/8192] unreachable (ICMP unreachable), 05:26:00
C>* 192.168.122.0/24 is directly connected, eth0, 00:00:08

Ping

vyos@r4-roll# run ping 1.1.1.1 vrf mgmt
PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.
64 bytes from 1.1.1.1: icmp_seq=1 ttl=59 time=9.44 ms
64 bytes from 1.1.1.1: icmp_seq=2 ttl=59 time=9.64 ms
64 bytes from 1.1.1.1: icmp_seq=3 ttl=59 time=9.57 ms
^C
--- 1.1.1.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 5ms
rtt min/avg/max/mdev = 9.443/9.552/9.644/0.140 ms
[edit]

But the route is not deleted later.

vyos@r4-roll# delete interfaces ethernet eth0 address dhcp 
[edit]
vyos@r4-roll# commit
[edit]
vyos@r4-roll# run show ip route vrf mgmt
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 route, r - rejected route

VRF mgmt:
S>* 0.0.0.0/0 [210/0] via 192.168.122.1, eth0 onlink, 00:00:11
K * 0.0.0.0/0 [255/8192] unreachable (ICMP unreachable), 05:37:49
[edit]
vyos@r4-roll#
c-po reassigned this task from zsdc to Viacheslav.
c-po added a subscriber: zsdc.
erkin set Issue type to Bug (incorrect behavior).Aug 30 2021, 7:10 AM
erkin removed a subscriber: Active contributors.