首页 > 代码库 > linux无线配置

linux无线配置

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无线配置