ArchLinux connecting to wireless through CLI [WPA]
November 5, 2011 1 Comment
# iwlist wlan0 scan Cell 01 - Address: 04:25:10:6B:7F:9D Channel:2 Frequency:2.417 GHz (Channel 2) Quality=31/70 Signal level=-79 dBm Encryption key:off ESSID:"dlink" Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s Bit Rates:6 Mb/s; 9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s 36 Mb/s; 48 Mb/s; 54 Mb/s
- If using WPA encryption:
Using WPA encryption requires that the key be encrypted and stored in a file, along with the ESSID, to be used later for connection via wpa_supplicant. Thus, a few extra steps are required:
For the purpose of simplifying and backup, rename the default wpa_supplicant.conf file:
# mv /etc/wpa_supplicant.conf /etc/wpa_supplicant.conf.original
Using wpa_passphrase, provide your wireless network name and WPA key to be encrypted and written to /etc/wpa_supplicant.conf.
The following example encrypts the key “my_secret_passkey” of the “linksys” wireless network, generates a new configuration file (/etc/wpa_supplicant.conf), and subsequently redirects the encrypted key, writing it to the file:
# wpa_passphrase linksys "my_secret_passkey" > /etc/wpa_supplicant.conf
Check WPA Supplicant for more information and troubleshooting.
- Associate your wireless device with the access point you want to use. Depending on the encryption (none, WEP, or WPA), the procedure may differ. You need to know the name of the chosen wireless network (ESSID).
|No Encryption||iwconfig wlan0 essid “linksys”|
|WEP w/ Hex Key||iwconfig wlan0 essid “linksys” key “0241baf34c”|
|WEP w/ ASCII passphrase||iwconfig wlan0 essid “linksys” key “s:pass1”|
|WPA||wpa_supplicant -B -Dwext -i wlan0 -c /etc/wpa_supplicant.conf|
- After utilizing the appropriate association method outlined above, wait a few moments and confirm you have successfully associated to the access point before continuing, e.g.:
# iwconfig wlan0
Output should indicate the wireless network is associated with the interface.
- Request an IP address with /sbin/dhcpcd <interface>, e.g.:
# dhcpcd wlan0
- Lastly, ensure you can route using /bin/ping:
# ping -c 3 www.google.com PING www.l.google.com (126.96.36.199) 56(84) bytes of data. 64 bytes from 188.8.131.52: icmp_req=1 ttl=49 time=87.7 ms 64 bytes from 184.108.40.206: icmp_req=2 ttl=49 time=87.0 ms 64 bytes from 220.127.116.11: icmp_req=3 ttl=49 time=94.6 ms --- www.l.google.com ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2002ms rtt min/avg/max/mdev = 87.052/89.812/94.634/3.430 ms SOURCE: From the great ArchLinux wiki at https://wiki.archlinux.org/index.php/Beginners%27_Guide#Setup_wireless_in_the_live_environment_.28optional.29