Nodogsplash offers a simple way to provide restricted access to an internet connection. It is derived from the codebase of the Wifi Guard Dog project. Nodogsplash is released under the GNU General Public License.(Github)
简单来说,通过Nodogsplash可以把openwrt的路由器变成一台广告发射机,别人一连上你的wifi就得看了你的广告才能上网,吼吼吼~
目前的方法主要是把访客网络和2.4G网络混在一起,这样并不是一个好办法,通过把访客网络分离出来可以把Nodogsplash挂在访客网络上。
好吧,我知道我自己也说不清楚到底什么意思,直接看代码比较直接。
- 增加lan接口,比如lan1
mynetwork="lan1"
myip="XXX.XXX.XXX.XXX"
mynetmask="255.255.255.0"
uci set network.${mynetwork}=interface
uci set network.${mynetwork}.proto=static
uci set network.${mynetwork}.ipaddr=$myip
uci set network.${mynetwork}.netmask=$mynetmask
uci set network.${mynetwork}.ifname=$mynetwork
uci set network.${mynetwork}.type=bridge
uci set network.${mynetwork}.force_link=1
uci set network.${mynetwork}.ip6assign=60
- 修改wireless
这里的访客网络是@wifi-iface[2]
。
uci set wireless.@wifi-iface[2].network="${mynetwork}"
- 新增防火墙
uci add_list firewall.@zone[0].network=${mynetwork}
- 开启dhcp
uci set dhcp.${mynetwork}=dhcp
uci set dhcp.${mynetwork}.interface=${mynetwork}
uci set dhcp.${mynetwork}.start=100
uci set dhcp.${mynetwork}.limit=150
uci set dhcp.${mynetwork}.leasetime=12h
uci commit
GatewayInterface br-lan1