According to this answer...
https://unix.stackexchange.com/a/457577/61742
... I can use the following configuration to use pushed routes from my DHCP server in my DHCP client by placing in the /etc/dhclient.conf
or /etc/dhcp3/dhclient.conf
file the following configuration...
option classless-static-routes code 121 = array of { ip-address, ip-address };
But in CentOS 7 this file does not exist, but the following files...
[root@localhost ~]# ps -eaf | grep dhcli
root 780 650 0 15:02 ? 00:00:00 /sbin/dhclient -d -q -sf /usr/libexec/nm-dhcp-helper -pf /var/run/dhclient-enp0s8.pid -lf /var/lib/NetworkManager/dhclient-00cb8299-feb9-55b6-a378-3fdc720e0bc6-enp0s8.lease -cf /var/lib/NetworkManager/dhclient-enp0s8.conf enp0s8
root 783 650 0 15:02 ? 00:00:00 /sbin/dhclient -d -q -sf /usr/libexec/nm-dhcp-helper -pf /var/run/dhclient-enp0s17.pid -lf /var/lib/NetworkManager/dhclient-8512e951-6012-c639-73b1-5b4d7b469f7f-enp0s17.lease -cf /var/lib/NetworkManager/dhclient-enp0s17.conf enp0s17
root 2218 1152 0 15:36 pts/0 00:00:00 grep --color=auto dhcli
NOTE: Note the value for the "-cf" parameter (files: /var/lib/NetworkManager/dhclient-enp0s8.conf
and /var/lib/NetworkManager/dhclient-enp0s17.conf
).
My question is: What is the correct way to use "classless-static-routes" (code 121) on a CentOS 7 DHCP client?
Thanks!
PLUS:
This is the configuration of my ISC KEA DHCP (DHCPv4)...
cat /usr/local/etc/kea/kea-dhcp4.conf
[...]
"option-def": [{
"name": "rfc3442-classless-static-routes",
"code": 121,
"space": "dhcp4",
"type": "record",
"record-types": "uint8,uint8,uint8,ipv4-address"
}
],
"option-data": [{
"name": "rfc3442-classless-static-routes",
"data": "10,1,4, 10.1.6.4"
}]
[...]
The goal is that requests to 10.1.4.0/24 be routed to ip 10.1.6.4/32 in my DHCP clients.
NOTE: Is the same thing I would get with the command ip route add 10.1.4.0/24 dev enp0s8 via 10.1.6.4
in each my DHCP clients.
/etc/dhcp/dhclient-exit-hooks.d/rfc3442-classless-routes
does that job by default. Nonetheless, I am not much found of passing around static routes via DHCP.also request rfc3442-classless-static-routes;
(and the ms option for Microsoft) in the dhcp client config file (whichever it might be)."data": "10,1,4, 10.1.6.4"
will hand a route to network 1.4.0.0/10 (it's already wrong this would be 1.0.0.0/10) via 10.1.6.4 . The answer is in rfc 3422 + kea's informations (previous link I provided twice). Both have to be understood