I have a headless debian home server (Jessie, 8.9). Occasionally we have power outages. The problem is that the router doesn't boot as fast as the debian server when the electricity comes back. The router needs +1 minutes to boot up but the server boots in ~10 seconds.

My server doesn't initiate new requests for the ethernet link after the interface initialization has detected there is no link (router hasn't finished booting, won't accept connections yet). I'm using static IP set on debian.

How do I configure my interface to check again later, or delay initialization long enough for the router to finish booting and accept the connection?

  • Under RHEL/CentOS/Fedora I'd suggest you to use the LINKDELAY=time parameter in the ifcfg-<device> file, however I haven't found if it's available in Debian. But you may try. Oct 24, 2017 at 19:52

3 Answers 3


Rather than setting a static IP on the Debian server, you may what to set a static IP setting through the router's DHCP server.

Some routers have more options and some have fewer... However, it's usually possible to set the router DHCP server to have at least one dynamic pool of IPs and at least a few static IPs. This way the static IPs will be assigned from the DHCP server rather than the clients.

On my home network, I setup an isc dhcp server that runs on a spare netbook and turned off my router's rather limited dhcp server. If your home server is always running whenever anyone is using the Internet, you could probably run the LAN DHCP from the server.

If you do, and if you decide on using ISC DHCP (which I recommend), then you can easily set static IPs hosts vi the /etc/dhcpd.conf something like this:

subnet netmask {
        pool {range; }

host workstation {
        hardware ethernet f4:8d:14:5c:4b:6a;

which provides a nice sized dynamic pool from .129 through .190 and a static IP of .60

Or... perhaps your router allows you to do something similar.

  • As I mentioned above: the static IP set by the DHCP server on the router doesn't solve the issue. The server doesn't initiate a new connection. ISC DHCP is a nice thing, but I don't think it would solve this specific issue.
    – JCs
    Oct 25, 2017 at 18:59

DHCP with static lease is a good option (I use that also).

However something else came to my mind:

Debian Jessie is using Upstart.

  • With Upstart you can perform net init when physical connection is on.

OR ... what if you write a script which:

  • Pings the router - if successfull exits
  • If the ping is unsuccesfull, perform an ifdown and ifup
  • Maybe checking if you are logged in (and if yes, it does not do ifdown)
  • Run this scrip fairly regularly (every 2 or 10 minutes from cron).
  • I believe the link local addresses are all on the subnet. I've never used link local IPv4 addresses on my networks, so I'm not sure how it would all tie together through a router to WAN. There's probably a question about that somewhere on here... Oct 24, 2017 at 20:22
  • @RubberStamp, neither did I use link local addresses rather than private network addresses, like I have 2 routers with fixed address (one is provider owned, other is mine), 4-5 different static leased DHCP devices (mainly computers, IP cameras, NAS), others are dinamic DHCP (mobiles, tablets, guests devices'). I need some computer with fixed IP because of port forwarding from "firewall" router.
    – V-Mark
    Oct 24, 2017 at 21:02
  • Oops! I misinterpreted your statement as I quickly read "perform net init when physical connection is on" Oct 24, 2017 at 21:26
  • DHCP with static lease doesn't solve the issue. The server doesn't initiate new connection. I will try to make a bash script to check the connection as a workaround. But I would like to see a proper solution for this which doesn't require scripts.
    – JCs
    Oct 25, 2017 at 18:52

I made a script which pings the router periodically. If the ping fails then it tries to bring back the interface by calling ifdown and ifup with a short delay.

Note that pinging the router doesn't work if the interface is down, also ifup doesn't work if the interface wasn't closed properly before with ifdown.

The scipt is based on this questions best answer.



while true; do
        LOG_TIME=`date +%b' '%d' '%T`
        if ! ping -q -c 2 "$pingip" >> /dev/null ; then
                if [[ "$isdown" -eq 0 ]]; then
                        printf "$LOG_TIME $0: Interface %s is down!\n" "$iface" | tee -a $LOG_FILE
                ifdown $iface
                sleep 1
                ifup $iface
                if [[ "$isdown" -eq 1 ]]; then
                        printf "$LOG_TIME $0: Interface %s is up!\n" "$iface" | tee -a $LOG_FILE
        sleep "$timeout"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .