Tuesday, December 18th, 2007

Configure Wireless on the Command Line

Today I have mainly been attempting to create a very light installation of Ubuntu on an old Pentium III. I started by installing a base system with the Ubuntu alternative install disk. After the base system was installed I then tried to configure my wireless card from the command line. I was half expecting this to be a difficult task, however it wasn't actually too difficult and thanks to some rather nifty instructions I managed to get my wireless card working in no time. For future reference here are the necessary commands:

1. Turn the interface on with the following command:

sudo ifconfig wlan0 up

2. Scan for a list of all the available access points:

iwlist wlan0 scanning

3. Select the access point with the following command:

sudo iwconfig wlan0 essid ACCESSPOINT

4. Set WEP or WPA passphrase, if needed:

sudo iwconfig wlan0 key PASSPHRASE

5. Finally, connect to DHCP server and obtain an IP address:

sudo dhclient

I'll post more details about the actual system install when I get more time, for now I just wanted to get these instructions down in case I end up having to start again from scratch.

Tagged with: cli, networking, terminal, ubuntu


6 Responses to “Configure Wireless on the Command Line”

  1. woot wrote,

    There are other slightly different ways to do it if you know that you'll only be connecting to one network, (ie the computer is a desktop).

    Personally I use a setup like this:

    a generated wpa_supplicant.conf using wpa_passphrase in /etc/

    my /etc/network/interfaces looks like

    auto ath0 iface ath0 inet dhcp pre-up wpa_supplicant -Bw -iath0 -c/etc/wpa_supplicant.conf -dmadwifi pre-up dhclient ath0 pre-up sleep 5 post-down killall -r wpa_supplicant post-down killall -r dhclient

    Obviously this might not be the best way, and honestly I don't remember anymore why I needed the sleep 5 in there. This does however work well. I'll reconnect if the network drops out and it connects automatically on startup. (It also occurs to me that I might not actually need the dhclient call.)

  2. Monte wrote,

    I find installing Ubuntu to be very easy. I use a old computer with a Pentium II, 192 Mb Ram and 300 MHz processor for my play machine and try everything on it. I am connected to the internet on it, but not wireless. Thanks for the tip, I will try a wireless card on it using your instructions. By the way, 7.10 is approaching a point where the full Ubuntu will not install on this old machine, and Xbuntu will not run a live cd on it.

  3. Philip wrote,

    @Monte: Wow, that's some old hardware you're got. I find that the default GNOME version of Ubuntu runs far too sluggishly on my 600Mhz PIII and doesn't make for an enjoyable user experience. So, I've been playing around with Fluxbox and Openbox, starting from a minimal base install and working my way up. I'm quite impressed with the results and my old PIII is now rockin'. In fact, I'm so impressed with the simplicity and speed of Openbox I think I'm going to drop my GNOME desktops completely.

  4. Sam wrote,

    Philip: I found the same and started using xfce. I love it. Especially the file manager.

  5. martin wrote,

    the command sudo iwconfig wlan0 key thisismykey give me that error …..

    Error for wireless request "Set Encode" (8B2A) : invalid argument "thisismykey". sure i am doing something wrong :-) any help is appreciated!!!

  6. Varun wrote,

    @martin

    When you are using key as ASCII i.e. simple english letters use key s:mypassword, standard is for HEX key.

    Thanks

Add Your Comment

Use the form below to add your comment. Markdown syntax is available. Note, comments are moderated by me for spam filtering. Alternatively, feel free to contact me privately.