Tag Archives: wireless

Set up wireless in Linux via the command line

I recently bought an Acer Revo 3600 to replace my ageing PopcornHour A100. I’ve installed a minimal version of Ubuntu Linux on it as well as xbmc. As this is in my bedroom far away from my router, I only wanted to use the wireless chip.

As I have no gui, I have to manually set this up. If you do happen to be in some sort of gui and want to get out of it quickly, just press ctrl+alt+f1 or ctrl+alt+f2 and so on. This will just open up another terminal session for you.

You’ll need to know the name of your SSID as well as your password of course. In my case here I’m using WPA2. You’ll need to have wpasupplicant installed. If you have a wired connection it’ll be easy to install. If not you’ll need to get it elsewhere and copy it on your box. I am using Ubuntu, so the same method should work with Debian. Just use your distro’s packet manager to get it installed.

sudo apt-get install wpasupplicant

If not already root, you’ll now need to log in as root

sudo su -

Now you need to type wpa_passphrase ssid password > /etc/wpa_supplicant.conf. This is my example:

wpa_passphrase Cisco Thisisyourpassk\$y > /etc/wpa_supplicant.conf

As this is Linux, you need to remember to use break characters when using special characters. My ssid is named Cisco and my password is Thisisyourpassk$y. I’ve used the break character just before the $ sign. You will see if you have this correct by opening up the /etc/wpa_supplicant.conf file like so:

vi /etc/wpa_supplicant.conf
network={
        ssid="Cisco"
        #psk="Thisisyourpassk$y"
        psk=357b62bf79a0d096901fe32d3138b6d962b95675976f08d044d117970b04d0fa
}

You should see that the break character worked as the psk over here shows the correct password in full.

Copy the psk value as you’ll need it in the next step.

Open your interface config file (in Ubuntu/Debian it’s over here):

vi /etc/network/interfaces

Add the following to this file:

#The wireless interface
auto wlan0
iface wlan0 inet dhcp
wpa-ssid "Cisco"
wpa-ap-scan 1
wpa-key-mgmt WPA-PSK
wpa-psk "357b62bf79a0d096901fe32d3138b6d962b95675976f08d044d117970b04d0fa"

Save and exit. Now restart your network:

/etc/init.d/networking restart

You should now be connected, and can monitor it via ifconfig and iwconfig:

root@XBMCLive:~# iwconfig 

wlan0     IEEE 802.11bg  ESSID:"Cisco"
          Mode:Managed  Frequency:2.472 GHz  Access Point: 00:1D:A2:E7:56:30
          Bit Rate=54 Mb/s   Tx-Power=20 dBm
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:7B16-2A4A-9A61-158A-9537-84FE-3F90-E275 [3]
          Power Management:off
          Link Quality=36/70  Signal level=-74 dBm  Noise level=-94 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0
root@XBMCLive:~# ifconfig
wlan0     Link encap:Ethernet  HWaddr 0c:60:76:68:60:25
          inet addr:10.20.31.10  Bcast:10.20.31.255  Mask:255.255.255.0
          inet6 addr: fe80::e60:76ff:fe68:6025/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:649 errors:0 dropped:0 overruns:0 frame:0
          TX packets:677 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:94586 (94.5 KB)  TX bytes:123349 (123.3 KB)

This only works if your kernel actually has the driver of course. If not, you may need to download the windows driver and use ndiswrapper. I’ve got an exmple of doing this in my post over here: http://mellowd.co.uk/ccie/?p=114

I would also suggest deleting your /etc/wpa_supplicant.conf file to prevent anyone in future getting your password.

How to get Abit Airpace working in Ubuntu Server 64bit

Okay so it’s taken a while to get this working, but it finally is! If you need to get an Abit AirPace Wi-Fi card working in 64-bit Ubuntu server (with no gui tools) this is how you do it.

First you need to install ndiswrapper:

sudo aptitude install ndiswrapper-utils
sudo aptitude install ndiswrapper-utils-1.9
sudo aptitude install ndisgtk

Now you need to download the actual 64-bit driver. As there is no official one I’ve used this one: ar5007eg-64-0.2.tar.gz

Extract the drivers to a folder that won’t get deleted. I’ve put mine in /etc/wireless_driver
Now install the driver:

sudo ndiswrapper -i net5211.inf
sudo ndiswrapper -m

If you do a sudo iwconfig you should see the interface now listed.
Now you need to install the following tools:

sudo aptitude install wireless-tools
sudo aptitude install wpasupplicant

The next step will be to associate the card with your AP. I’m using WPA2 on mine so this is how I did mine. The first thing you need to do is get your SSID password converted into hex.

 sudo wpa_passphrase "SSID" "Passphrase"

Substitute SSID and Passphrase for your actual SSID and password (Ignore the inverted commas themselves). The output will give you a long hex password like so:

psk=blahblahblahwhatever

save this password as you’ll need it in just a bit. N.B. Try not to have a SSID with spaces or a password with special characters. If you do then enter the password with a break character first. The backslash is the break character. This will need to be placed in front of every special character you have when entering your password

Edit your interfaces startup file like so:

 sudo vi /etc/network/interfaces

This is my config, you’ll need to change the SSID and Passphrase to your own

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp

#The wireless interface
auto wlan0
iface wlan0 inet dhcp
wpa-ssid "SSID"
wpa-ap-scan 1
wpa-key-mgmt WPA-PSK
wpa-psk "Passphrase we created earlier"

Now we just need to restart the network and everything should be ok:

sudo /etc/init.d/networking restart

You should see the interface in both ifconfig and iwconfig