Thursday, 2 August 2012

Quick Debian/Ubuntu Wireless from Terminal

To connect to a wireless network from command line can be a bit of a challenge I encountered recently on a Raspberry Pi device... The easiest way to go about it without many more commands:

Become root user or use sudo before each command below:

1. iwconfig  (Look for the device with IEEE 802.11, usually wlan0 or eth1)
2. nano /etc/network/interfaces
 2a. Add the interface found is part of the auto line, mine looks like this:
       auto lo eth1
 2b. Add the following to the file below the other lines:
       iface eth1 inet dhcp  (change eth1 if your interface differs)
       wpa-ssid (the wireless network name)
       wpa-psk JellyBean (The WPA-PSK or WPA2-PSK passphrase)

The above assumes the wireless setup is similar to most I've configured/seen out in the field, if yours is not drop a comment and I'll help you out!

To start the connection run: ifup eth1 (or your interface name)
To stop the connection run: ifdown eth1 (or your interface name)

Hope the above helps someone!

No comments:

Post a Comment