Linux – How to handle DHCP on two network interfaces, one clobbers the other’s /etc/resolv.conf

dhcplinuxmodemnetworking

I have an embedded Debian Linux system. It has two network interfaces, eth0 and ppp0 via a cell modem. The problem I have is that when the system boots up it gets an address via DHCP on eth0. If the modem connects that then also gets it's own IP address and clobbers the contents of /etc/resolv.conf. In my application I need eth0 to be the default route if eth0 is alive. If I make eth0 the default route, DNS no longer works as the nameservers from the modem DHCP request are not reachable.

Curiously if I then run "dhclient eth0" after all this is running, it does the right thing and adds it's nameservers to the existing file, rather than clobbering it.

Is there any good and standard way of handling this dual DHCP network situation?

Best Answer

man interface-order first.

There is a way as well to ignore some settings that DHCP provides. Check for prepend and request options at man dhclient.conf

Related Question