A multi-homed box needs more than one uplink to be configured for DHCP. It needs to ignore default-route and DNS for all but one DHCP uplink.
There is a similar question here [ Debian interfaces file – ignore gateway and dns entries from dhcp ], but the answers there do not solve my problem:
- Editing the global DHCP client configuration (/etc/dhcp[3]/dhclient.conf) would result in default-route and DNS being ignored on all DHCP uplinks.
- The
ifmetric
suggestion only deals with the route, not with DNS.
Also, i hope that things have changed since 2009.
Note that i am talking headless embedded systems. NetworkManager is not an option.
Preferred solution would be /etc/network/interfaces{.d/} only. I am looking for something like this:
auto eth0
iface eth0 inet dhcp
auto eth1
iface eth1 inet dhcp
ignore-dhcp-option routers domain-name-servers domain-name
Addendum:
We have dozens of these boxes installed in various environments. The networks are not under our control. In some cases, the boxes need to do DHCP on more than one interface. Default route and DNS are usually not known to us beforehand, and even if they were they might change over time without notice. Hence we can't set them statically but must configure them via the 'main' DHCP client.
Best Answer
(I am still interested in solutions that only touch
/etc/network/interfaces{,.d/}
, but not/etc/dhcp/
. In the absence of such solutions, I use this one.)In
/etc/dhcp*/dhclient.conf
, remove the optionsrouters, domain-name-servers, domain-name, domain-search
from the globalrequest
statement. Then add this (assumingeth0
is the device where default route and DNS shall not get ignored):This solution works at least for isc-dhcp-client version 4.2.2.dfsg.1-5+deb70u8 as it is shipped with Debian 7. I assume it works for later versions too.
Edit:
eth0
must be quoted, and it should berequest
, notrequired
)