We will go through steps to configure wireless network interface having WPA security through command line in ubuntu
- Ensure that wpa_supplicant package is installed. If not try to get it by running
- sudo apt-get install wpasupplicant
- Open your /etc/networking/interfaces (with sudo) file and add below two lines
auto wlan0
iface wlan0 inet dhcp
- reboot the system (Dont worry if the startup says all network are not started. We will set it up)
- Now type "wpa_supplicant -h" to get list of driver names. Observe the section "drivers:" in the output. Watch out for driver text like "Linux Wireless extension". Generally it is wext
- Now we will create a configuration file for wpa. Create one in /etc/wpa_supplicant.conf with below content
ctrl_interface=/var/run/wpa_supplicant
eapol_version=1
ap_scan=1
fast_reauth=1
- Now we will generate the text required for the WPA authentication. Type below command where NetworkSSID is your wireless network name
- wpa_passphrase "NetworkSSID"
- Enter your WPA passphrase when it prompts
- Now it will generate a ouput similar to below
network={
ssid="NetworkSSID"
#psk="YOUR_PSK"
psk=lklksdjflwejroi209429083lkdfjlskdfjslkdfjlk
}
- Copy the above text to the end of /etc/wpa_supplicant.conf and also add scan_ssid, proto & key_mgmt keys as below (#psk can be removed as it's just a comment)
- Now type below command to test all the configurations done till now. In below command wlan0 is the interface name we defined in /etc/networking/interfaces and wext is your wireless driver name
- sudo wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf -Dwext
- You should see below text in output
- WPA: Key negotiation completed with
- The above output confirms that all steps are correct till now
- Now we just need to tell ubuntu to use this wpa_supplicant configuration for this particular wireless device. For that, add two lines in /etc/networking/interfaces immediately after (iface wlan0 inet dhc) line which we added in the beginning. So it would look like (combined)
- Reboot the system
network={
ssid="NetworkSSID"
scan_ssid=1
prot=WPAi
key_mgmt=WPA-PSK
psk=lklksdjflwejroi209429083lkdfjlskdfjslkdfjlk
}
auto wlan0
iface wlan0 inet dhcp
wpa-driver wext
wpa-conf /etc/wpa_supplicant.conf
That's it. Now you should be able to access wifi from your ubuntu machine
No comments:
Post a Comment