ArchLinux connecting to wireless through CLI [WPA]

# 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.

Note: /etc/wpa_supplicant.conf is stored in plain text format. This is not risky in the installation environment, but when you reboot into your new system and reconfigure WPA, remember to change the permissions on /etc/wpa_supplicant.conf (e.g. chmod 0600 /etc/wpa_supplicant.conf to make it readable by root only).
  • 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).
Encryption Command
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
Note: The network connection process may be automated later by using the default Arch network daemon, netcfgwicd, or another network manager of your choice.
  • 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 (74.125.224.146) 56(84) bytes of data.
64 bytes from 74.125.224.146: icmp_req=1 ttl=49 time=87.7 ms
64 bytes from 74.125.224.146: icmp_req=2 ttl=49 time=87.0 ms
64 bytes from 74.125.224.146: 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
About these ads

About ardian
I'm a young free/libre open source software/linux, enthusiast who has been working on promoting FLOSS in Kosovo. I'm helping my fellow peopel here in Kosovo in learning GNU/Linux. I helped run the first SFK09(Software Freedom Kosova 09) conference. I organised and talked in many locations in my country. I also have been learning and working on the OpenStreetMap project for Kosovo. I'm working on translating different software packages into Albanian.

One Response to ArchLinux connecting to wireless through CLI [WPA]

  1. Ben says:

    I’ve always wondered why you can’t use iwconfig to configure/connect to a WPA secured network. Shouldn’t it be able to start and stop the wpa_supplicant daemon itself? (worst case, the daemon would have to implement a way of killing itself when it received some message/signal and it’s configured for a certain network, I think)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 694 other followers

%d bloggers like this: