How to prevent dhclient from requesting route information on interfaces outside Network Manager control?

Solution Unverified - Updated -

Issue

If we choose to set up dhcp on network interface and place it outside Network Manager's control then by default it will be sending the routes option in its dhcp requests. This can lead to manually set default router being overwritten in the routing table by information received from dhcp server.

Here we have default route set to 10.0.2.2 and network interface eth2 configured without Network Manager:

# ip r | grep default
default via 10.0.2.2 dev eth0  proto static
# grep NM ifcfg-eth2 
NM_CONTROLLED=no

When we restart network service, the default route changes:

# service network restart|grep eth2; ip r|grep default
Shutting down interface eth2:                              [  OK  ]
Bringing up interface eth2:  
Determining IP information for eth2... done.
default via 10.32.0.1 dev eth2 

And following can be seen appearing in /var/lib/dhclient/dhclient-eth2.leases file:

lease {
  interface "eth2";
  fixed-address 10.32.0.21;
  option subnet-mask 255.255.255.0;
  option time-offset -18000;
  option routers 10.32.0.1;
  option dhcp-lease-time 30;
  option dhcp-message-type 5;
  option domain-name-servers 192.168.1.1;
  option dhcp-server-identifier 10.32.0.1;
  option domain-search "example.com.";
  option domain-name "testdomain.local";
  renew 5 2017/01/20 12:13:44;
  rebind 5 2017/01/20 12:13:56;
  expire 5 2017/01/20 12:14:00;
}

Environment

RHEL 6.8

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content