Vous êtes sur la page 1sur 7

Debian Linux Configure Wireless Networking With WPA2 by NIXCRAFT on JANUARY 15, 2011 8 COMMENTS LAST UPDATED JANUARY

Y 15, 2011 in DEBIAN / UBUNTU

I've Atheros AR5001 wifi a/b/g card detected and supported natively under Linux. How do I configure my wireless card with WPA2 networking using /etc/network/interfaces file?

Wi-Fi Protected Access II (WPA2 i.e. IEEE 802.11i) is security protocols for wireless communication. It introduces CCMP, a new AES-based encryption mode with strong security in mind. Under Debian Linux you need to install wpasupplicant to support for WPA and WPA2 networks. Open a command-line terminal (select Applications > Accessories > Terminal), and then type the following commands as root user:

Step #1: Install wpasupplicant

To install wpasupplicant simply type the following command as root user: # apt-get install wireless-tools

OR # apt-get install wpasupplicant

Step #2: Verify WiFi / Wireless Card Is Detected

Use the lspci command to verify that card is detected: # lspci # lspci | grep -i wlan # lspci | grep -i wireless # lspci | grep -i wifi # lspci -nn | grep Network

Sample outputs:

0c:00.0 Network controller: Intel Corporation Ultimate N WiFi Link 5300

This page explains the lspci command to find out Wireless driver chipset information under Linux. Or you can go to Linux wireless LAN support page and make sure your card is listed as supported device under Linux. You can also see your wireless interface name using the following command: # ifconfig -a

OR # dmesg | grep -i wlan # dmesg | grep -i wireless

Step #3: Configure WPA2

Edit /etc/network/interfaces file, enter: # vi /etc/network/interfaces

Setup wlan0 with the SSID and PSK as follows:

auto wlan0 iface wlan0 inet dhcp wpa-ssid YOUR-SSID-HERE wpa-psk YOUR-PASSWORD-HERE

Make sure you use strong pass-phrase. Save and close the file. You can now connect to the interface, enter: # ifup wlan0 # ifconfig wlan0 # ping router-ip-here # ping google.com

OR you can restart the networking service using any one of the following method: # /etc/init.d/networking restart

OR

# service networking restart

Get Info About Your Network

To see more info about wifi, enter: # iwconfig wlan0

Scan Your Wireless Network

Type the following command: # iwlist wlan0 scan

Sample /etc/network/interface Config File

# The loopback network interface auto lo iface lo inet loopback

# The primary network interface auto eth0 iface eth0 inet static address 192.168.1.5 netmask 255.255.255.0 network 192.168.1.0 gateway 192.168.1.1

# The wireless network interface with dhcp auto wlan0 iface wlan0 inet dhcp wpa-ssid nixcraft

wpa-key-mgmt WPA-PSK wpa-group TKIP CCMP wpa-psk YOYR-PASSWORD-HERE

Troubleshooting wpa_supplicant

See wpa_supplicant log file /var/log/wpa_supplicant.*.log using the tail, more, or grep command: # tail -f /var/log/wpa_supplicant.wlan0.log # grep 'something' /var/log/wpa_supplicant.wlan0.log

A Note About GUI Configuration Tool

You can use NetworkManager - a graphical interfaces for GNOME and KDE. If you are using NetworkManager, avoid using Debian's /etc/network/interfaces file. See this page for more information about Gnome / KDE wireless network config tool.

Recommended readings: Anytime you need assistance with Linux wifi configuration option, turn to the following man page first. It will give you detailed information, parameters and switches for wifi configurations. For example, man 5 interfaces opens the man page for the interfaces network configuration file: $ man 5 interfaces $ man 8 wpa_supplicant $ man 8 iwconfig $ man 8 iwlist

sudo apt-get install build-essential libsqlite3-dev zlib1g-dev libncurses5-dev libgdbmdev libbz2-dev libreadline5-dev libssl-dev libdb-dev wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz tar -xzf Python-2.7.3.tgz cd Python-2.7.3 ./configure --prefix=/usr --enable-shared make sudo make install cd .. sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.6 20 sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 10 sudo update-alternatives --set python /usr/bin/python2.6 wget http://peak.telecommunity.com/dist/ez_setup.py sudo python2.7 ez_setup.py sudo easy_install-2.7 virtualenv
#!/bin/bash -e # Setup sudo aptitude install build-essential mkdir -p ${HOME}/.local mkdir build-python cd build-python # Get sources ### Tcl/Tk <http://www.tcl.tk/software/tcltk/download.html> wget "http://downloads.sourceforge.net/project/tcl/Tcl/8.5.13/tcl8.5.13-src.tar.gz" wget "http://downloads.sourceforge.net/project/tcl/Tcl/8.5.13/tk8.5.13-src.tar.gz" ### Berkeley DB <http://www.oracle.com/technetwork/products/berkeleydb/downloads/index-082944.html> wget "http://download.oracle.com/berkeley-db/db-4.8.30.tar.gz" ### Python <http://www.python.org/download/> wget "http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz" # Build Tcl tar xzf tcl8.5.13-src.tar.gz cd tcl8.5.13/unix ./configure --prefix=${HOME}/.local make make install

cd ../.. # Build Tk tar xzf tk8.5.13-src.tar.gz cd tk8.5.13/unix ./configure --prefix=${HOME}/.local make make install cd ../.. # Build Berkeley DB 4.8 tar xzf db-4.8.30.tar.gz cd db-4.8.30/build_unix ../dist/configure --prefix=${HOME}/.local/opt/BerkeleyDB.4.8 --enable-tcl --withtcl=${HOME}/.local/lib make make install cd ../.. # Set compile flags export LDFLAGS="-L${HOME}/.local/lib -L${HOME}/.local/opt/BerkeleyDB.4.8/lib" export CPPFLAGS="-I${HOME}/.local/include -I${HOME}/.local/opt/BerkeleyDB.4.8/include" export CXXFLAGS=${CPPFLAGS} export CFLAGS=${CPPFLAGS} export LD_LIBRARY_PATH=${HOME}/.local/lib:${HOME}/.local/opt/BerkeleyDB.4.8/lib export LD_RUN_PATH=${LD_LIBRARY_PATH} # Build Python 2.7 tar xzf Python-2.7.3.tgz cd Python-2.7.3 ./configure --prefix=${HOME}/.local make make altinstall cd .. # Install virtualenv, pip and virtualenvwrapper curl http://python-distribute.org/distribute_setup.py | ${HOME}/.local/bin/python2.7 curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | ${HOME}/.local/bin/python2.7 ${HOME}/.local/bin/pip install virtualenvwrapper # Update ~/.bashrc echo 'export PATH="${HOME}/.local/bin:${PATH}"' >> ${HOME}/.bashrc echo 'export WORKON_HOME="${HOME}/.local/virtualenv"' >> ${HOME}/.bashrc echo 'export VIRTUALENVWRAPPER_PYTHON="${HOME}/.local/bin/python2.7"' >> ${HOME}/.bashrc echo 'export VIRTUALENVWRAPPER_VIRTUALENV="${HOME}/.local/bin/virtualenv"' >> ${HOME}/.bashrc echo 'export VIRTUALENVWRAPPER_VIRTUALENV_ARGS="--python=python2.7"' >> ${HOME}/.bashrc echo 'source ${HOME}/.local/bin/virtualenvwrapper.sh' >> ${HOME}/.bashrc

# Finish ... cd .. echo -e "\n\n ... Done!"

Vous aimerez peut-être aussi