Wednesday, April 29, 2015

Useful linux wireless commands


Here are some useful linux wireless commands:

Query wireless devices enable/disable


rfkill list
rfkill unblock <0>

To check details and driver info

lshw -class network

Starting up wireless on the command line

Create a wpa_supplicant file (maybe using wpa_gui):

#Generated by wpa_gui
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="your ssid"
    psk="your passphrase"
    proto=RSN
    key_mgmt=WPA-PSK
    pairwise=TKIP
    auth_alg=OPEN
}


Now run wpa_supplicant to setup the connection:

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

And dhclient wlan0 to get an ipaddress.

Simplified wireless command line

# Enable the interface
ip link set wlan0 up

# Scan for networks
iw dev wlan0 scan

# Run supplicant
wpa_supplicant -D nl80211,wext -i wlan0 -c <(wpa_passphrase SSID KEY)

# Assign IP address
ip addr add 192.168.0.10/24 dev wlan0

# OR dhclient
dhclient wlan0

 

No comments: