Created attachment 1187103 [details]
Proposed patch for dhcp-4.2.5-42
Description of problem:
(At the request of Jiri Popelka, I'm recreating bugs.centos.org ticket 0011075 here)
I run a dhcp-server and push the static routes to the clients, could see routes on the routing table but the problem is with the partial updation on the existing routes. For testing purpose, I had set the lease expiry to minimal time. so after the quick lease expiry,if at all there is a change in the gateway information on dhcp-server, it gets reflected appropriately on the client's leases file but not in the routing table
Below log confirms the renewal happens every defined interval,
Apr 29 13:27:00 dhclient: DHCPREQUEST on mgmt1 to 192.168.10.2 port 67 (xid=0x2b10e716)
Apr 29 13:27:00 dhclient: DHCPACK from 192.168.10.2 (xid=0x2b10e716)
Apr 29 13:27:01 dhclient: bound to 192.168.10.10 -- renewal in 31 seconds.
After the lease updation,
[root@host]# cat /var/lib/dhclient/dhclient-mgmt1.leases
option subnet-mask 255.255.255.0;
option routers 192.168.10.1;
option dhcp-lease-time 60;
option dhcp-message-type 5;
option dhcp-server-identifier 192.168.10.2;
option classless-static-routes 18.104.22.168.254 192.168.10.101;
renew 5 2016/04/29 13:40:11;
rebind 5 2016/04/29 13:40:32;
expire 5 2016/04/29 13:40:40;
Lease file updation happens properly after the defined expiry interval, but the problem is with classless-static-routes, if there is any change with the parameter ("classless-static-routes" new gateway) leases file holds the updated information but not the routing table, can confirm that from the below table:
[root@]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
169.254.169.254 192.168.10.100 255.255.255.255 UGH 0 0 0 mgmt1
Leases file hold the updated information but routing table is not aware of the change happened within the existing route.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. setup a dhcp server and enable the option "classless-static-routes"(121).
2. configure static routes.
3. set a minimal lease expiry interval to witness the issue as early as possible
4. after the lease expiry, can see the updated file "/var/lib/dhclient/dhclient-mgmt1.leases" , but the routing table does not have the updated information.
5. manually restarting the "network" service flushes out all existing information and updates routing table as expected.
Updated or deleted routes are not updated or removed on the client.
Updated or deleted routes should be updated or removed on the client.
Default DHCP client version :
[root@host ~]# dhclient --version
Issues seen on other DHCP client versions as well,
(4.3.4, 4.2.8, 4.1-ESV-R13, 4.1.2-P1)
Can get detailed information from the following link:
Raised this issue to ISC DHCP team as well their response as follows,
Thank you for your report
With the ISC DHCP client the work is split into
two parts. The protocol work is handled by
the dhclient program while updating the OS
is handled by a shell script called by dhclient.
The issues you are describing are in the
area handled by the shell script. The scripts
that we provide are rather generic and so far
as I can see don't include any that try to update
the routing table based on option 121.
The centos distribution may include a different
script that does update the routing tables based
on that option, I wasn't able to find a copy in a quick
search on line.
Given the above, while this may be a bug in the
Centos script it is probably not a bug in the script
supplied with the default client code. I am marking
this ticket as rejected - if you think this is an issue in the
default script you can re-open the ticket by replying to
this mail and include the client script you are using."
Thank you for the report and proposed patch.
I've checked the default behavior and seems like this bug is not reproducible with NetworkManager  which is run by default in RHEL 7. All changes are properly handled by nm_dispatcher without restarting of the service.
Can you please confirm you're using "legacy" networking services (aka /etc/init.d/network)?
Apr 10 11:42:21 client1.bz1354575.example.com NetworkManager: <info> [1491817341.2902] dhcp4 (eth0): classless static route 10.100.1.0/24 gw 192.168.77.2
Apr 10 11:46:08 client1.bz1354575.example.com NetworkManager: <info> [1491817568.1510] dhcp4 (eth0): classless static route 10.100.1.0/24 gw 192.168.77.3
You are correct; the routes are updated properly with NetworkManager. The only time this issue is occurs is when "NM_CONTROLLED=no" is used and dhclient is used to manage the network configuration.
While I was investigating the bug report that was filed against CentOS 6, I also checked the CentOS 7 behavior. Since 7 also had the same issue, I submitted dhcp patches for 6 and 7 at the same time in hopes that the issue could be resolved in both releases.
In case it is of any help, here is my BZ for CentOS 6 (my patch was included in dhcp-4.1.1-53.P1.el6 for CentOS 6.9): https://bugzilla.redhat.com/show_bug.cgi?id=1363790
Let me know if I can do anything else to help.
-Rich Alloway (RogueWave)
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.