WiFi
Note: To configure WiFi you need to install wireless tools first (done by default for APF27) and of course to have a running WiFi interface like: the APF27 wireless extension board or a USB to WiFi adapter, with corresponding Linux drivers loaded. |
Contents
Common operations
List network interfaces supporting WiFi
# iwconfig lo no wireless extensions. eth0 no wireless extensions. sit0 no wireless extensions. wmaster0 no wireless extensions. wlan0 IEEE 802.11bg ESSID:"" Mode:Managed Frequency:2.412 GHz Access Point: Not-Associated Tx-Power=0 dBm Retry min limit:7 RTS thr:off Fragment thr=2352 B Encryption key:off Power Management:off Link Quality:0/100 Signal level:112/146 Noise level:0/0 Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:0 Invalid misc:0 Missed beacon:0
Show all Access Points (AP) available for your APF (here with wlan0 interface)
# iwlist wlan0 scan wlan0 Scan completed : Cell 01 - Address: XX:XX:XX:66:47:48 ESSID:"TOTO" Mode:Master Channel:1 Frequency:2.412 GHz (Channel 1) Quality=88/100 Signal level:25/100 Encryption key:on Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s 9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s 48 Mb/s; 54 Mb/s Extra:tsf=00000009d398fec8 Extra: Last beacon: 1390ms ago ...
Connect to an unencrypted AP
# iwconfig wlan0 essid AP_NAME
- Check it:
# iwconfig wlan0
Get an IP address
# udhcpc -i wlan0
Encryption settings
When configuring WiFi cryptography, only WEP can be setup easily from a terminal with single commands. If you want to configure your interface for WPA/WPA2, install and configure wpa_supplicant.
WEP configuration
This example is given for a WiFi Access Point named armadeus, the encoding key used here is not recommended, of course ;) :
# iwconfig wlan0 essid armadeus # iwconfig wlan0 key 12345678901234567890 # ifconfig wlan0 up (if interface is not already up) ADDRCONF(NETDEV_UP): wlan0: link is not ready # ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
Now, the WiFi adapter is ready and attached :
# iwconfig lo no wireless extensions. eth0 no wireless extensions. sit0 no wireless extensions. wmaster0 no wireless extensions. wlan0 IEEE 802.11bg ESSID:"armadeus" Mode:Managed Frequency:2.437 GHz Access Point: 00:1B:2F:E7:E4:08 Bit Rate=2 Mb/s Tx-Power=7 dBm Retry min limit:7 RTS thr:off Fragment thr=2352 B Encryption key:XXXXXXXXXXXXXXXXXXXXXXXXXX Security mode:restricted Power Management:off Link Quality:0/100 Signal level:73/146 Noise level:0/0 Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:0 Invalid misc:0 Missed beacon:0
Accessing outside world
We can manually configure the network to access Internet via the WiFi interface instead of the Ethernet one:
# ifconfig eth0 down # ifconfig wlan0 192.168.0.212 # route add default gw 192.168.0.1 dev wlan0
And configure the nameserver in /etc/resolv.conf
domain dev.null nameserver 192.168.0.207 ~ ~ ~
If you have a DHCP server on your network, you can also use it and previous steps (route+resolv.conf) will be done automatically:
# udhcpc -i wlan0
We can now ping the best website in the world :
# ping www.armadeus.org PING www.armadeus.org (213.186.33.5): 56 data bytes 64 bytes from 213.186.33.5: seq=0 ttl=122 time=66.735 ms 64 bytes from 213.186.33.5: seq=1 ttl=122 time=50.392 ms ^C --- www.armadeus.org ping statistics --- 2 packets transmitted, 2 packets received, 0% packet loss round-trip min/avg/max = 50.392/58.563/66.735 ms
Surf on the net
To surf on the web, you can use (for example) links software :
# links www.armadeus.org
It's an ASCII internet browser. For more informations about Links.