We have an ubuntu box set up to do some monitoring but due to the placement are unable to run CAT5 to the box itself. I have an Atheros PCI card that works great as long as someone is logged into Gnome and it doesn't disconnect from the AP during that time.

Is there a way to have Ubuntu connect to the AP during boot, and always reconnect if it finds a signal from a specified AP? The box would have a static IP and only connecting to a specific AP using WEP.


5 Answers 5


Depending on the physical security of the box, you could configure gdm to auto-login using an unprivileged user account that has access to the wireless device. Then Network Manager would handle all of the auto-reconnection issues.

This is configured under System | Administration | Login Window | Security

  • It's not my preferred action, but its what I ended up having to do. Network Manager still doesn't automatically reconnect for whatever reason, but it at least works at 'boot' now. Jun 10, 2009 at 17:48

First, it's worth knowing that a default Ubuntu Desktop installation uses a piece of software named NetworkManager to manage the network.

The advantage of that is that it's very useful on laptops where you move around among different networks a lot, since it makes it very easy to find and connect to wireless networks.

The drawback is that it seems you must be logged in to get a network connection, and that's obviously less than optimal for a server.

Instead of running NetworkManager, the way to go is to configure your network settings in the file /etc/network/interfaces, a file which will be read at startup. I'm a bit uncertain on how to disable networkmanager, but I think it will detect that an interface has already been configured and stay away from it when you login.

Anyway, assuming that your network card is named ath0, you need to add something like the example below to /etc/network/interfaces:

auto ath0
iface ath0 inet static 
    wireless-essid ESSID
    wireless-ap 00:60:1D:01:23:45
    wireless-key 0123-4567-89

It's been a while since I tested doing this, so the above is untested. The following manpages should be of help:

  • interfaces(5)
  • iwconfig(8)
  • wireless(7)

How can I make NetworkManager connect to a network before I login?

On version 0.7.1 or later edit the profile of the connection you with to start prior to login and select the box in the bottom left "Available to all users"

  • This is the answer that should be shown above others. As long as network-manager is used, this is the preferred way of decoupling wifi and login. Apr 24, 2017 at 10:56

Use wpa_supplicant to manage your wifi connection.

You do not have to be using WPA for this. It will work with wep or even an open wireless network. When your AP is rebooted or loses power, wpa_supplicant will start scanning for available APs and check if one of them matches the config file.

Have a look at this blog post on how to setup wpa_supplicant.


Sure, you should be able to place the appropriate iwconfig and ifconfig commands in /etc/init.d/rc.local though that's not the "Ubuntu way".

  • That doesn't help if card disassociates or the AP is rebooted, the server would still require manual reconnection. Jun 3, 2009 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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