模板:WIFI
来自ARM Wiki
- 查看设备
- 使用
- 动态IP
1 cat << EOF >> /etc/network/interfaces 2 # Wireless interface 3 auto wlan0 4 allow-hotplug wlan0 5 iface wlan0 inet dhcp 6 wireless_mode managed 7 wireless_essid any 8 wpa-driver nl80211 9 wpa-conf /etc/wpa_supplicant.conf 10 11 EOF
- wpa_supplicant.conf为wpa_passphrase生成的文件,例如:(ssid:test passwd:123456)
1 wpa_passphrase test 123456 > /etc/wpa_supplicant.conf
- 注意:WiFi名称可能不是wlan0,请将wlan0换为实际的无线网卡名称
- 静态IP
1 cat <<EOF >> /etc/network/interfaces 2 auto wlxec3dfd322b06 3 allow-hotplug wlxec3dfd322b06 4 iface wlxec3dfd322b06 inet static //静态IP模式 5 wpa-conf /etc/wpa_supplicant.conf 6 address 192.168.100.148 //静态IP地址 7 netmask 255.255.255.0 //子网掩码 8 gateway 192.168.100.1 //网关 9 dns-nameservers 223.5.5.5 //DNS域名服务器 10 EOF
- 注意:WiFi名称可能不是wlan0,请将wlan0换为实际的无线网卡名称
- DNS设置
1 cat <<EOF > /etc/resolv.conf //临时修改DNS,此文件内容可能被覆盖 2 nameserver 8.8.8.8 //主DNS 3 nameserver 114.114.114.114 //副DNS 4 5 EOF
- 推荐方式,参考配置静态ip部分,将DNS写入到/etc/network/interfaces配置文档中