make a configuration file and put it in /etc/wpa_supplicant
example conf file (wpa_supplicant.conf)
Replace your-sid and your-passkey by the the actual values set in your wlan (keep the quotes as shown)
Note that these names are case sensitive !
- Code: Select all
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=root
update_config=1
network={
ssid="your-ssid"
scan_ssid=1
psk="your-passkey"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
group=TKIP
}
check if your driver is loaded (wlan0 must be available)
- Code: Select all
iwconfig
If it is not found then the driver is not or not correctly loaded and it won't work
bring up interface
- Code: Select all
ifconfig wlan0 up
connect to wifi access point
- Code: Select all
wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -B
get an ip address from dhcp server
- Code: Select all
udhcpc -b -i wlan0 -q -s /etc/simple.script
In principle now the wlan should be up.
To keep connection when your LAN cable is disconnected you need to adapt the route table
add route for wlan0 (replace xxx.yyy.xxx.yyy by actual ip of your gateway)
- Code: Select all
route add default gw xxx.yyy.xxx.yyy dev wlan0
now you should be able to bring down the wired connection
- Code: Select all
ifconfig eth0 down
But if you do that then the connection you are using will be lost, and you should use the wireless ip to connect.
You can go here for more information to set it up using command files to switch between fixed and wlan connection (after you set up the connection with wpa_supplicant and obtaining ip)
viewtopic.php?f=4&t=1485&p=12798#p12793 and here viewtopic.php?f=4&t=1485&p=12798#p12795
some helpful commands
to check status
- Code: Select all
wpa_cli status
To see which networks your dongle sees and get more info
- Code: Select all
iwlist wlan0 scanning