Network/Wireless/Wpa Supplicant

From Debuntu

Jump to: navigation, search

This page will explain how to connect to a wireless network using wpa_supplicant.

Even though nowadays, most linux distro use Network Manager. There might be time when you:

  1. Do not have NetworkManager installed
  2. You are using a strip down Window manager
  3. You can only access the console

Contents

Setting up Wpa Supplicant

In this example, we will set up the details to connect to network myssid using passphrase mypassphrase.

First, we will need to generate the the WPA PSK pre-shared key that will be used by wpa_supplicant. With those details, we will create the configuration file used by wpa_supplicant, then finally we will be able to connect to the network using this configuration file.

Generating the PSK

Wpa_supplicant comes with a utility call wpa_passphrase, this utility will pre-compute the PSK entries for a given ssid with a given passphrase.

To get those details run:

# wpa_passphrase myssid mypassphrase
network={
	ssid="myssid"
	#psk="mypassphrase"
	psk=c22c1e6febc7875af85d033bbf15f5ca836633bac8eb16693fd58bff66fcb66c
}

Setting up /etc/wpa_supplicant.conf

Now, you can use those details to set /etc/wpa_supplicant.conf. In bold are the info given by wpa_passphrase.

ctrl_interface=/var/run/wpa_supplicant

network={
	ssid="myssid"
	scan_ssid=1
	proto=WPA RSN
	key_mgmt=WPA-PSK
	pairwise=CCMP TKIP
	group=CCMP TKIP
	#psk="mypassphrase" You can remove this.... you don't want users to read the passphase in clear.
	psk=c22c1e6febc7875af85d033bbf15f5ca836633bac8eb16693fd58bff66fcb66c
}

Mind that you can declare more than one network entry.

Connecting to the wireless network

Finally, you can authenticate against the network by using the command:

# wpa_supplicant -B -Dwext -iwlan0 -c/etc/wpa_supplicant.conf

From there, iwconfig should show that you are connected to wireless network myssid. the only thing left is to set your IP address as with a standard ethernet interface.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox
Google AdSense