模板:WIFI AP
来自ARM Wiki
- 配置无线热点,需要配置hostapd、dnsmasq以及iptables
- 1、配置/etc/dnsmasq.conf(使用vi添加以下内容):
interface=wlan0 bind-interfaces //监听wlan0 except-interface=lo dhcp-range=192.168.0.100,192.168.0.254,12h //设置dhcp地址范围和租约时间 dhcp-option=3,192.168.0.1 //设置网关为192.168.0.1 dhcp-option=6,8.8.8.8 //设置DNS为8.8.8.8
- 2、配置/etc/hostapd/hostapd.conf(使用vi添加以下内容):
ssid=norco interface=wlan0 driver=nl80211 channel=7 ignore_broadcast_ssid=0 hw_mode=g ieee80211n=1 wpa=2 wpa_passphrase=12345678 wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP CCMP rsn_pairwise=CCMP
- 2、开启无线热点(此时会开启一个热点名为”norco”,密码为”12345678”的WiFi热点):
1 ifconfig wlan0 up 2 ifconfig wlan0 192.168.0.1 netmask 255.255.255.0 3 hostapd /etc/hostapd/hostapd.conf -B 4 dnsmasq 5 echo 1 > /proc/sys/net/ipv4/ip_forward 6 iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE