If changing the DSL router within my network (e.g., because it is damaged or failover to an UMTS-modem happened) it also changes the DHCP server with it.

So all connected clients need to fetch a new IP address - usually this works fine, but one Linux machine always gets stuck, even for several hours. Because it is a headless server without display, the fastest way to get a new IP address is to reboot the machine - this is what I want to prevent (and I want to prevent command to be typed in manually).

  • The client is running Debian Squeeze
  • I have access to the DHCP client configuration in /etc/dhcp/dhclient.conf
  • I can submit a command on the machine as root as long it is connected, but not after the router was changed.
  • But I have no access to the DHCP server configuration within the router.

The dhclient.conf currently looks like this:

option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
request subnet-mask, broadcast-address, time-offset, routers,
    domain-name, domain-name-servers, domain-search, host-name,
    netbios-name-servers, netbios-scope, interface-mtu,
    rfc3442-classless-static-routes, ntp-servers;
send host-name "Achim-3c";
send dhcp-client-identifier "00:0c:c6:77:60:01";
retry 10;

How can I configure the DHCP client to automatically get a new IP address in case the DHCP server was changed in the network?


The problem only appears if the failover happens from DSL-Modem towards UMTS-Modem (Huawei E970). If the network run fine with UMTS-modem and I manually switch back to DSL-modem the Linux server smoothly get his new IP from the new DHCP server and therefore difficult to fix :-(

So it looks like it is a problem within the Huawei UMTS-modem configuration of DHCP server.


Are you relying on the DHCP server within your DSL modem and or backup UMTS modem to hand out addresses to your local LAN? In this case, you really should be running your own local DHCP server for your LAN, and disabling the DHCP server on your DSL modem.

If you want to continue down this path, the Linux utility you want to check out is ifplugd. The command you want to tell ifplugd to run when it detects an interface is connected is:

dhclient -v {interface-name}

  • Yes, I rely on the DHCP server build in the DSL/UMTS modem. We talk about several servers installed at different customer sites, so replacing the network infrastructure would be a mess. But using the ifplugd tool to fire a dhclient command is a goo idea. I've just tried the dhclient command itself, it works fine forcing to get a new IP. Somehow it sounds too complicated, isn't there any configuration in dhclient.conf? – Achim Feb 6 '13 at 2:35
  • dhclient is built to interact with a working and reachable DHCP server. If that isn't the case, i.e. connection to DHCP server goes down or DHCP server on router is actually OK but the WAN side is down, you can't do much from the client side with dhclient. – LawrenceC Feb 6 '13 at 20:46

You could try to connect to the headless machine, and (as root) start a script that gets a new DCHP lease (dhclient and whatnot) and log out leaving it running with nohup(1) (or just run it under screen(1)). That should work, no guarantees. Try the stunt on another machine first...

  • I just connected an old laptop via serial and tried a simple dhclient, so even without any release -> and this works fine, network is back :-) But this is much to much effort, Isn't there any automatic sucution by configuration, without carrying a laptop and entering any command hours later?!?!? – Achim Feb 6 '13 at 2:31
  • DHCP is set up to lease IP addresses, the host getting the address should renew the lease before it expires. So your problem should only appear when you change DHCP server. – vonbrand Feb 6 '13 at 2:35
  • vonbrand: Yes, you are right, it only appears when changing th DHCP server. But this is happens always if the DSL-Line drops and an UMTS-Modem takes over. In sum, not more than once a month, but I want the Linux server to continue running after failover, without reboot/command – Achim Feb 7 '13 at 11:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.