ifmetric package will help you and patch is not needed anymore sudo apt-get install ifmetric -y
-- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to isc-dhcp in Ubuntu. https://bugs.launchpad.net/bugs/1662814 Title: dhclient doesn't honor metric setting in network interfaces on ubuntu 16.04 Status in isc-dhcp package in Ubuntu: Confirmed Bug description: $ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=16.04 DISTRIB_CODENAME=xenial DISTRIB_DESCRIPTION="Ubuntu 16.04.1 LTS" $ dpkg-query -l isc-dhcp-client Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ 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/interfaces.d/ens4.cfg 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.ens3.pid -lf /var/lib/dhcp/dhclient.ens3.leases -I -df /var/lib/dhcp/dhclient6.ens3.leases ens3 root 28392 0.0 0.0 16120 868 ? Ss 08:59 0:00 /sbin/dhclient -1 -v -pf /run/dhclient.ens4.pid -lf /var/lib/dhcp/dhclient.ens4.leases -I -df /var/lib/dhcp/dhclient6.ens4.leases ens4 -e IF_METRIC=1000 $ 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/dhclient-exit-hooks.d/rfc3442-classless-routes 2017-02-08 08:59:16.407956495 +0000 +++ ./rfc3442-classless-routes 2017-02-08 08:58:58.328337696 +0000 @@ -71,7 +71,7 @@ # set route (ip detects host routes automatically) ip -4 route add "${net_address}/${net_length}" \ - ${via_arg} dev "${interface}" >/dev/null 2>&1 + ${via_arg} dev "${interface}" ${IF_METRIC:+metric $IF_METRIC} >/dev/null 2>&1 done fi fi To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/isc-dhcp/+bug/1662814/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp