6
Mar

Setup Wireless Connections in Terminal

Wireless connections in Linux
Although this may not be helpful to those running modern Linux distributions, it may be helpful to those who are in an embedded environment where things like Network Manager aren’t available. It may even be useful to know how to configure a wireless connection in the terminal for troubleshooting purposes (or maybe you just prefer to do things quickly in the terminal without messing around with a GUI).

Wireless devices vary greatly, so it’s near impossible to create a guide that’s going to work for all of them, but for the most part, these steps will get you there. The first step is to find the correct wireless driver for you device’s chipset. Drivers that work pretty well with Linux are from ralink and zydas. There are others I’m sure, but it just so happens that the following steps work for both the rt2501usb (rt73) and zd1211b (zd1211rw or zd_b) drivers. Once you’ve located the correct driver, use “insmod” to insert the module and then check out /proc/net/wireless to make sure the device was recognized properly. For example:


root# insmod rt73.ko
root# cat /proc/net/wireless
Inter-| sta-| Quality | Discarded packets | Missed | WE
face | tus | link level noise | nwid crypt frag retry misc | beacon | 16
rausb0: 0000 100. 220 177 0 0 0 0 0 0


Once you’ve gotten this far, you should install the wpa_supplicant and wireless-tools packages so you can take advantage of iwconfig and others. Here are a few useful commands:

Another thing to note of the below steps are that the rausb drivers are being using to connect to WPA and WPA2 access points. You may want to use wext instead depending on your environment and how the drivers were compiled. With that said, let’s get to it…

Unencrypted

   
   1) Bring the rausb0 interface up
      * ifconfig rausb0 up
   2) Associate with the AP
      * iwconfig rausb0 essid the_essid
   3) Assign a static IP
      * ifconfig rausb0 192.168.1.101

WEP Encryption

   
   1) Bring the rausb0 interface up
      * ifconfig rausb0 up
   2) Associate with AP
      * iwconfig rausb0 essid the_essid key the_key
   3) Assign a static IP
      * ifconfig rausb0 192.168.1.101

WPA Personal – TKIP

   
   1) Bring the rausb0 interface up
      * ifconfig rausb0 up
   2) Generate a configuration file for wpa_supplicant to use
      * ./wpa_passphrase the_essid the_password > /etc/wpa_supplicant_custom.conf
   3) Use wpa_supplicant to associate with AP and run it in the background (-B)
      * ./wpa_supplicant -irausb0 -Dralink -c/etc/wpa_supplicant_custom.conf -B
   4) Assign a static IP
      * ifconfig rausb0 192.168.1.101

WPA2 Personal – TKIP or AES

   1) Bring the rausb0 interface up
      * ifconfig rausb0 up
   2) Generate a configuration file for wpa_supplicant to use
      * ./wpa_passphrase the_essid the_password > /etc/wpa_supplicant_custom.conf
   3) Insert "proto=RSN" into "network" block in /etc/wpa_supplicant_custom.conf
   4) Use wpa_supplicant to associate with AP and run it in the background (-B)
      * ./wpa_supplicant -irausb0 -Dralink -c/etc/wpa_supplicant_custom.conf -B
   5) Assign a static IP
      * ifconfig rausb0 192.168.1.101

Adhoc Mode

   
   1) Bring the rausb0 interface up
      * ifconfig rausb0 up
   2) Setup rausb0 for Adhoc mode
      * iwconfig rausb0 mode ad-hoc channel 3 enc off essid the_essid
   3) Assign a static IP
      * ifconfig 169.254.114.101 netmask 255.255.0.0
   4) Add default gateway to route (optional)
      * route add default gw 169.254.114.100

Feel free to donate if this post prevented any headaches! Another way to show your appreciation is to take a gander at these relative ads that you may be interested in:


There's 1 Comment So Far

  • Gisi
    May 28th, 2013 at 3:43 am

    Why not for modern distros of linux? I need this help for installing a minimal Debian wheezy… and it not recognice my wifi… Thanks!!!!!!

Share your thoughts, leave a comment!