iwconfig //命令查看一下有没有wlan0
备份配置文件:
cp /etc/network/interfaces /etc/network/interfaces_bak
然后修改interfaces文件 如果为静态ip,那么按照如下设置:
#auto eth0
#iface eth0 inet static
#address 192.168.1.118
#gateway 192.168.1.1
#netmask 255.255.255.0
auto wlan0
iface wlan0 inet static
address 192.168.1.139
gateway 192.168.1.1
netmask 255.255.255.0
wpa-ssid TP-LINK_196958 //用户名
wpa-psk ××××× //无线密码
dns-nameservers 8.8.8.8 //防止重启清空
如果为DHCP动态获取,那么按照如下设置:
auto wlan0
iface wlan0 inet dhcp
dns-nameservers 202.117.112.3
wpa-ssid myssid
wpa-psk 1234567890
设置开机启动:
vim /etc/rc.local
sudo /sbin/ifconfig wlan0 up
sudo /etc/init.d/networking restart
exit 0
修改dns设置:
sudo vi /etc/resolv.conf
增加如下内容:
nameserver 210.34.018
nameserver 8.8.8.8
重启网卡:
sudo /etc/init.d/networking restart
查看网卡:
ifconfig
扫描网络:
iwlist wlan0 scan
参考:
[1]. http://blog.51yip.com/linux/1341.html
[2]. http://www.360doc.com/content/12/0406/14/3700464_201388554.shtml
[3]. http://gm100861.blog.51cto.com/1930562/895579
[4] http://blog.appdevp.com/archives/188