January 23, 2013

connect to a wireless network using terminal in UNIX system

connecting to a wireless network is easy when a GUI program does all the hectic work to us. But how do one connect to a wireless network using the terminal? This tutorial is applicable to ALL UNIX-based computer. It's not limited to Backtrack only.
Before we begin, please familiar yourself with some of this term or command-line code.
  wireless key - your network password or the network security key
  essid - the wireless network name
  ifconfig - Enables your wireless device to communicate with the wireless network
  iwlist - List all available access point, or the wireless network that in range.
  iwconfig - to list all network card attach to your computer/laptop
  dhclient - get an IP Address via DHCP from the connected wireless network 

Lets get the working First, fire up your terminal. We need to know what is the name of our wireless device. To get your wireless device name, type iwconfig then press enter. it will list all available network card whether a wired or a wireless one. next, we will tell our wireless card to wake up. To do this, type ifconfig wlan0 up then press enter. In this post, wlan0 is the name of my wireless card. yours could be different.

We now need to scan if there is a wireless network nearby with a known security key. Now type, iwlist wlan0 scan, again, my wlan0 is the name of my wireless card. A list of available network will be printed out on the terminal. Then, we start a handshake with the network. to do this, type iwconfig wlan0 essid wifi key 5405507cd1 then press enter. Lets breakdown the command, iwconfig essid key .

That is the syntax to use the command of iwconfig. Beware though, if your network contain a spaces in their name, you need to wrap the network name with a quote or this, "".  For an example, suppose your network name is wifi net, you need to type the syntax like this, iwconfig wlan0 essid "wifi net" key 5405507cd1. Again, that syntax is for wireless network that use a HEX key.

To use an ASCII key, s: has to be put after the key command. If you are using ASCII key to connect, use it like this, iwconfig wlan0 essid "wifi net" key s: abc0134567892

After a successful connection, in order for us to connect to the internet, we need to have an IP Address. To get an IP Address, type in dhclient wlan0. you should now be fully connected and have your own IP Address.

No comments:

Post a Comment

Whats your thought on this post?