dhclient doesn't honor metric setting in network interfaces on ubuntu 16.04
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
isc-dhcp (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_
DISTRIB_
DISTRIB_
$ dpkg-query -l isc-dhcp-client
Desired=
| Status=
|/ Err?=(none)
||/ Name Version Architecture Description
+++-===
ii isc-dhcp-client 4.3.3-5ubuntu12.6 amd64 DHCP client for automatically obtaining an IP address
# configure metric in network interface
$ cat /etc/network/
auto ens4
iface ens4 inet dhcp
metric 1000
# dhclient set IF_METRIC=1000 environment variable for ens4
$ ps xau|egrep -i 'dhclient'
root 27906 0.0 0.0 16120 864 ? Ss 08:35 0:00 /sbin/dhclient -1 -v -pf /run/dhclient.
root 28392 0.0 0.0 16120 868 ? Ss 08:59 0:00 /sbin/dhclient -1 -v -pf /run/dhclient.
$ route -nee
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface MSS Window irtt
0.0.0.0 xxx.xxx.xxx.xxx 0.0.0.0 UG 0 0 0 ens3 0 0 0
xxx.xxx.xxx.xxx 0.0.0.0 255.255.255.192 U 0 0 0 ens3 0 0 0
172.16.0.0 192.168.12.1 255.240.0.0 UG 0 0 0 ens4 0 0 0
192.168.0.0 192.168.12.1 255.255.0.0 UG 0 0 0 ens4 0 0 0
192.168.12.0 0.0.0.0 255.255.255.0 U 0 0 0 ens4 0 0 0
After ifdown ens4, ifup ens4, dhclient doens't configure metric for ens4 routes.
below patch fix this issue.
--- /etc/dhcp/
+++ ./rfc3442-
@@ -71,7 +71,7 @@
- ${via_arg} dev "${interface}" >/dev/null 2>&1
+ ${via_arg} dev "${interface}" ${IF_METRIC:+metric $IF_METRIC} >/dev/null 2>&1
fi
fi
Status changed to 'Confirmed' because the bug affects multiple users.