码迷,mamicode.com
首页 > 系统相关 > 详细

linux无线配置

时间:2016-11-13 01:35:24      阅读:223      评论:0      收藏:0      [点我收藏+]

标签:ifconfig   cal   linu   net   文件中   无线配置   wlan   密码   代码   

1. 找 wifi 热点

 sudo iwlist scan

2. 生成热点的配置(wpa2加密)
 sudo wpa_passphrase "wifi热点名称" "wpa密码" 
会生成这样格式的配置代码:
 network={
                        ssid="SSID_xxx"
                        #psk="your_pass_here"
                        psk=eb900177d2234487397b54f1fc1d6efc7f30e43b988ad21488ae3eb701a1g3b0
                }
将这段代码添加到 /etc/wpa_supplicant/wpa_supplicant.conf 文件中:
                ctrl_interface=/var/run/wpa_supplicant
                # ctrl_interface_group=wheel
        

                network={
                        ssid="SSID_xxx"
                        #psk="your_pass_here"
                        psk=eb900177d2234487397b54f1fc1d6efc7f30e43b988ad21488ae3eb701a1g3b0
                }
        
        配置就完成了,下面添加启动代码
3. 在 /etc/rc.local 中添加相应的 wifi 启动代码:
                pkill wpa_supplicant
                pkill dhclient
        

                ifconfig wlan0 down
                ifconfig wlan0 up
                iwconfig wlan0 essid "SSID_xxx"
                wpa_supplicant -B -Dwext -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf
        

                dhclient wlan0


 现在重启系统,无线网络就会配置好了

linux无线配置

标签:ifconfig   cal   linu   net   文件中   无线配置   wlan   密码   代码   

原文地址:http://www.cnblogs.com/tomato2014/p/6057893.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!