ubuntu server: wifi

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.

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

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

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply