配置一个无线接口,device名称见同配置文件:
config wifi-iface 'guest'
option device 'ra'
option mode 'ap'
option ssid 'PandoraBox-2.4G-Guest'
option network 'guest'
option rssikick '0'
option rssiassoc '0'
option encryption 'psk2'
option key 'password'
option isolate '1'
给创建的无线接口配置静态IP:
config interface 'guest'
option proto 'static'
option ipaddr '10.0.0.1'
option netmask '255.255.255.0'
配置dhcp:
config dnsmasq
#监听所有网卡
option nonwildcard '0'
#监听特定网卡
#option nonwildcard '1'
#list interface 'lan'
#list interface 'guest'
#略过
config dhcp 'guest'
option interface 'guest'
option start '100'
option limit '150'
option leasetime '1h'
配置iptables防火墙,访客网络接口为ra1:
iptables -A INPUT -i ra1 -p udp -m multiport --dport 53,67:68 -j ACCEPT
iptables -A FORWARD -i ra1 -o pppoe-wan -j ACCEPT
同时开放5G和2.4G访客网络:
config wifi-iface 'guest'
option device 'ra'
option mode 'ap'
option ssid 'PandoraBox-2.4G-Guest'
option network 'guest'
option rssikick '0'
option rssiassoc '0'
option encryption 'psk2'
option key 'password'
option isolate '1'
config wifi-iface 'guest5'
option device 'rax'
option mode 'ap'
option ssid 'PandoraBox-5G-Guest'
option network 'guest'
option rssikick '0'
option rssiassoc '0'
option encryption 'psk2'
option key 'password'
option isolate '1'
将2.4G和5G桥接:
config interface 'guest'
option proto 'static'
option ipaddr '10.0.0.1'
option netmask '255.255.255.0'
option type 'bridge'
option _orig_ifname 'ra1 rax1'
option _orig_bridge 'true'
option ifname 'rax1'
iptables -A INPUT -i br-guest -p udp -m multiport --dport 53,67:68 -j ACCEPT
iptables -A FORWARD -i br-guest -o pppoe-wan -j ACCEPT
更改guest无线密码:
#!/bin/sh
str=haiyun`date +%s|cut -c 7-10|sed 's/4/6/g'`
echo $str
uci set wireless.guest.key=$str
uci set wireless.guest5.key=$str
uci commit wireless
wifi reload
参考:
https://openwrt.org/docs/guide-user/network/wifi/guestwifi/guest-wlan
标签:none