Making Ubuntu Natty Wireless Connect Before Login

Making Ubuntu Natty Wireless Connect Before Login

This took me several hours to figure out, primarily because Ubuntu 11.04 Natty is different from 99% of the tutorials I could find online.

If you use some sort of network authentication for your desktops and want to use a wireless card, you need your wireless to sign in before the user login screen is displayed.

Here's how to do that.


This method specifically is for desktops, and does not allow a laptop to work when away from the network.

First, remove network-manager

Network-manager will interfere with this, so the safest thing to do is remove it first:

sudo apt-get remove network-manager
Next, find your network card:
lshw -C network

This will spit out something similar to:

# lshw -C network
       description: Wireless interface
       product: AR5413 802.11abg NIC
       vendor: Atheros Communications Inc.
       physical id: 0
       bus info: pci0000:03:00.0
       logical name: wlan0
       version: 01
       serial: 00:1a:c1:35:c9:d1
       width: 32 bits
       clock: 33MHz
       capabilities: pm bus_master cap_list ethernet physical wireless
       configuration: broadcast=yes driver=ath5k driverversion=2.6.38-8-generic firmware=N/A ip= latency=168 link=yes maxlatency=28 mingnt=10 multicast=yes wireless=IEEE 802.11abg
       resources: irq:18 memory:fe400000-fe40ffff

What we're looking for is the "logical name: wlan0"

Next, we need to get the hex version of our WPA password:

wpa_passphrase [myssid]
Obviously replace "[myssid]" with your network SSID. For instance if my SSID was "tutorial":
wpa_passphrase tutorial

It will wait for you to type your WPA password and hit enter.

It should spit out something like:

# wpa_passphrase tutorial
# reading passphrase from stdin

We just need the "psk" line that's not commented out.

Now, edit your /etc/network/interfaces file:

sudo gedit /etc/network/interfaces
And add the following lines:
auto wlan0
iface wlan0 inet dhcp
wpa-ssid "tutorial"
wpa-psk 9ca973ddaa1c0af19a6a56fc8e732ae7ec12e009dc85b6c74d0a8312baf7bdd2

Now your network should start as soon as you boot the computer.

Other Ubuntu Caveat (runlevel unknown)

When you're done with all of this you may find that a lot of services won't start at boot. This would likely be caused by runlevel not starting because eth0 is not in use. You can confirm this at a console by typing:

If the answer is "unknown" here's how to fix it. In /etc/init/rc-sysinit.conf you'll find a line:
start on filesystem and net-device-up IFACE=eth0

Change this to read:

start on filesystem and net-device-up IFACE=wlan
Posted by Tony on May 18, 2011 |