I just installed Ubuntu 14.04 server on my computer that has both a wired network port and a wifi card. I would like for the server to use the wired network if is not available, and use wifi when it is not available.

The original /etc/network/interfaces look like the following:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto p4p1
iface p4p1 inet dhcp

I followed this post and modified my file to be:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

auto wlan0
iface wlan0 inet dhcp
wpa-ssid <my_ssid>
wpa-psk <my_ssid_password>

# The primary network interface
auto p4p1
iface p4p1 inet dhcp

When I restart wlan0, I'm able to connect to my wifi, no problem. If I restart the computer with my network cable plugged in, no problems either as both the wired and wifi connections connect to my network. However, if I have my wired connection unplugged and reboot, I see the message 'Starting configure network device' at startup. I then see the message 'waiting up to 60 more seconds for network configuration' before the system fully boots (so it waits 120+ seconds for the network). When the computer boots, my wifi connections is connected.

So, I guess things work, but the my headless server takes a long time to fully boot. What am I doing wrong? Is there anyway to fix this bootup lag? Thank you.


The declarations 'auto p4p1' and 'auto wlan0' ask the system to automatically start both interfaces. When you start with the ethernet detached and have asked that the interface start anyway, the system stumbles: "waiting up to 60 more seconds for network configuration."

It would be more efficient, but certainly not automatic, to leave out the 'auto' declaration:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

#auto wlan0
iface wlan0 inet dhcp
wpa-ssid <my_ssid>
wpa-psk <my_ssid_password>

# The primary network interface
#auto p4p1
iface p4p1 inet dhcp

And start either interface manually as needed:

sudo ifup -v wlan0