Static configuration for the wifi interface is added into /etc/network/interfaces
First you need to generate 256 bit Pre-Shared Key (PSK) from passphrase for your WIFI connection as below
$ sudo wpa_passphrase MY_SSID
# reading passphrase from stdin
xxxxxx123 <= type in the passphrase
network={
ssid="MY_SSID"
#psk="xxxxxx123"
psk=c2ddfd959c6febdc4aac1f3575ded17278a0749d9997d08c07d03a241a812e1c
}
in above example MY_SSID is wireless SSID and 'psk' is the 256-bit pre-shared key calculated from provided 'passphrase'
Now you can add this information into 'interfaces' file as below
$ tail /etc/network/interfaces
# for wifi connection
auto wlan0
iface wlan0 inet static
address 192.168.0.200
netmask 255.255.255.0
gateway 192.168.0.1
dns-nameservers 192.168.0.1
wpa-ssid MY_SSID
wpa-scan-ssid 1
wpa-psk c2ddfd959c6febdc4aac1f3575ded17278a0749d9997d08c07d03a241a812e1c
If your SSID is configured to be hidden, then you need 'wpa-scan-ssid' to be set 1
Once interfaces file is properly configured, you can bring up interface using "ifup wlan0"
Check interface details with 'iw' (or) iwconfig as below
$ sudo iw wlan0 link
Connected to xx:xx:xx:xx:xx:xx (on wlan0)
SSID: MY_SSID
freq: 2427
RX: 73561328 bytes (398315 packets)
TX: 8602925 bytes (32204 packets)
signal: -39 dBm
tx bitrate: 39.0 MBit/s MCS 10
bss flags: short-slot-time
dtim period: 0
beacon int: 100
$ sudo iwconfig wlan0
wlan0 IEEE 802.11bgn ESSID:"MY_SSID"
Mode:Managed Frequency:2.427 GHz Access Point: xx:xx:xx:xx:xx:xx
Bit Rate=39 Mb/s Tx-Power=20 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality=70/70 Signal level=-38 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:6 Invalid misc:877 Missed beacon:0
Note: Disable avahi-daemon and also change hosts line in nsswitch.conf as below
$ grep hosts: /etc/nsswitch.conf
#hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
hosts: files dns
No comments:
Post a Comment