Thursday, September 29, 2011

commands for wireless lan in debian

After a fresh install of wheezy

sudo ifconfig -a
sudo ifconfig wlan0 up
SIOCSIFFLAGS: Operation not possible due to RF-kill

#rfkill : tool for enabling and disabling wireless devices
sudo apt-get install rfkill

$ sudo rfkill list
0: asus-wlan: Wireless LAN
    Soft blocked: no
    Hard blocked: no
1: asus-bluetooth: Bluetooth
    Soft blocked: no
    Hard blocked: no
2: phy0: Wireless LAN
    Soft blocked: no
    Hard blocked: no


sudo rfkill unblock 0
sudo rfkill unblock 2

sudo rfkill unblock wifi
sudo rfkill unblock wlan

sudo ifconfig -a
sudo ifconfig wlan0 up

# iwconfig modu = force the card to only use the specific set of modulations
sudo iwconfig wlan0 modu 11g

sudo iwlist wlan0 scanning

sudo iwconfig wlan0 mode Managed

sudo iwconfig wlan0 essid {name}

#eg: sudo iwconfig wlan0 essid "My Router"

sudo iwconfig wlan0 channel {channel number}

# WEP encryption
sudo iwconfig wlan0 key {hex digit}

#eg: sudo iwconfig wlan0 key 0123-4567-89

sudo iwconfig

# dhclient -r : to avoid "RTNETLINK answers: File exists" when reconnect network after standby or hibernate
sudo dhclient -r wlan0

sudo dhclient wlan0
sudo ifconfig wlan0



To avoid soft blocked again after reboot add

options ath_pci rfkill=0
options ath_pci rfkill=1
options ath_pci rfkill=2
... (depend on rfkill list)

to /etc/modprobe.d/ath.conf
(any new file with .conf extension)

or
insert 'rfkill unblock wlan' in /etc/rc.local


ifup - ifdown
==========
# my /etc/network/interfaces is
auto lo
iface lo inet loopback

allow-hotplug eth0
iface eth0 inet dhcp

auto wlan0
iface wlan0 inet dhcp
wpa-ssid my_ssid
wpa-psk my_password_shared_key
wpa-key-mgmt WPA-PSK

# now we can bring our interface up and down with the usual ifup and ifdown commands
sudo ifup wlan0
sudo ifdown wlan0

# The "auto" stanza will bring your interface up at system startup.
# If not desired, remove or comment this line.

wpa useful command
================
sudo wpa_cli
zcat /usr/share/doc/wpasupplicant/README.modes.gz | less


Thanks:
Google
http://axcoto.com/blog/article/tag/siocsifflags-operation-not-possible-due-to-rf-kill
http://www.project4fun.com/node/36 shows commands and outputs
http://wiki.debian.org/WiFi/HowToUse#wpasupplicant

No comments:

Post a Comment