How to use WEP in Ubuntu

A few days ago, I had to connect to wireless network with WEP. It's my first time for WEP on Ubuntu. At the first glance, NetworkManager seemed to work because it known about the security and key. However, it didn't simply like that. In this situation, I have a key in ASCII format and I entered that key into NetworkManager with no luck. So I have to set it manually.

Fortunately, my laptop is Linux. It is fully scriptable. I could write a simple script to activate wireless setting anytime. Below is my script.

#!/bin/sh

INF=eth1
ESSID=SECUREWIFI
KEY=SECRETKEY
iwconfig $INF essid "$ESSID" key "s:$KEY"
dhclient $INF

In this example, my wireless device is eth1, my ESSID is SECUREWIFI and the key is SECRETKEY. iwconfig assigned ESSID and the key to the specified interface.

iwconfig $INF essid "$ESSID" key "s:$KEY"

And then requested for an IP address using dhclient.

dhclient $INF

Because the signal quality was not stable and there were so many access points in that area, my laptop may change to other access point oftenly. As a result, the assigned IP address might be changed. This is a problem of wireless infrastructure in that room. So I don't need to run iwconfig again. To solve this problem, I just needed to run dhclient to obtain new IP address according to the current access point again.

dhclient $INF

Tags: , , ,

Post new comment