Hello!
In VyOS 1.2.1 and 1.2.0-rolling+201905130337 if you are configure address dhcp for some interface, configuration scripts create dedicated dhclient.conf for this interface, located in /var/lib/dhcp/. For example:
root@test-06:/home/vyos# cat /var/lib/dhcp/dhclient_eth0.conf # # autogenerated by vyatta-interfaces.pl on Tue May 14 14:32:15 UTC 2019 # interface "eth0" { send host-name "test-06"; request subnet-mask, broadcast-address, routers, domain-name-servers, domain-name, interface-mtu; }
Then, this configuration used by the dhclient to obtain an IP address.
But, with this autogenerated configuration system can't handle DHCP option 121, which can be processed with default /etc/dhcp/dhclient.conf. To make DHCP option 121 operable, we need to apply the next changes:
- Generate dhclient.conf with rfc3442-classless-static-routes option.
- Patch rfc3442-classless-static-routes hook to process routes with FRRouting, and not "ip" command.
This can be done with the following changes:
diff -Naur origin/etc/dhcp/dhclient-exit-hooks.d/rfc3442-classless-routes option-121/etc/dhcp/dhclient-exit-hooks.d/rfc3442-classless-routes --- origin/etc/dhcp/dhclient-exit-hooks.d/rfc3442-classless-routes 2019-05-14 19:37:38.003209345 +0300 +++ option-121/etc/dhcp/dhclient-exit-hooks.d/rfc3442-classless-routes 2019-05-14 19:50:40.574760057 +0300 @@ -55,8 +55,7 @@ fi # set route (ip detects host routes automatically) - ip -4 route add "${net_address}/${net_length}" \ - ${via_arg} dev "${interface}" >/dev/null 2>&1 + vtysh -c "configure terminal" -c "ip route ${net_address}/${net_length} ${via_arg} ${interface}" >/dev/null 2>&1 done fi fi diff -Naur origin/opt/vyatta/sbin/vyatta-interfaces.pl option-121/opt/vyatta/sbin/vyatta-interfaces.pl --- origin/opt/vyatta/sbin/vyatta-interfaces.pl 2019-05-14 19:36:17.968076176 +0300 +++ option-121/opt/vyatta/sbin/vyatta-interfaces.pl 2019-05-14 19:46:13.641637198 +0300 @@ -163,11 +163,12 @@ my $output = dhcp_conf_header(); my $hostname = get_hostname(); + $output .= "option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;\n"; $output .= "interface \"$intf\" {\n"; if (defined($hostname)) { $output .= "\tsend host-name \"$hostname\";\n"; } - $output .= "\trequest subnet-mask, broadcast-address, routers, domain-name-servers"; + $output .= "\trequest subnet-mask, broadcast-address, routers, domain-name-servers, rfc3442-classless-static-routes"; my $domainname = is_domain_name_set(); if (!defined($domainname)) { $output .= ", domain-name";
Affected files:
https://github.com/vyos/vyos-replace/blob/current/files/dhclient-script
https://github.com/vyos/vyatta-cfg-system/blob/current/scripts/vyatta-interfaces.pl
/etc/dhcp/dhclient-exit-hooks.d/rfc3442-classless-routes
We need to implement this to solve T1369.