Demand Scenarios
There is a certificate-free Wifi SSID, such as called: OPENWRT, nearby students can be casually connected to this SSID, no paid students no matter what address to visit, will be redirected to the toll reminder page, and pay the fee of the students can be happy online.
Solutions
From the requirements, this is a very standard WifiDog effect, if the future has a very complex requirements, can be directly through the WifiDog to achieve the jump, and then through the Authpuppy to achieve account management, but want to deploy WifiDog and Authpup on OpenWrt PY is not a very easy thing to do.
We are therefore prepared to consider the need to achieve this directly through iptables, and if there is a complex expansion requirement in the future, it will not affect the extension to WifiDog.
Implementation process
Login to OpenWrt via SSH, open/etc/config/uhttpd, add the following configuration at the top of the file
' Portal ' '0.0.0.0:11990 '/www/portal ' '/index.html'
Then create a new static file named Index.html under/www/portal, and the contents of the file can be as follows
"cache-control" content= " No-cache "> <meta name="viewport" content="width= Device-width, initial-scale=1"> <title>wifi</title> Email: [Email protected]</bodu>
Then open the/etc/firewall.user file and add the following configuration at the end:
the 8 11990 8 -j REJECT
After saving, perform/etc/init.d/firewall restart reload iptables configuration
Then perform the/etc/init.d/uhttpd restart reload the UHTTPD configuration
Then use your phone to connect to the wireless network, and you'll find that it always pops up on the tip page.
User authorization
When a user pays the bill, ask him to go to his MAC address, also open the/etc/firewall.user file, such as the user has 2 devices, MAC address is 00:00:00:00:BB:AA and 00:00:00:00:BB:BB add the following 2 rules Then, these 2 devices will be able to surf the Internet freely!
XX:(xx):bb:aa-j MARK--set8, XX: 00 :xx:bb:bb-j MARK--set8
You also need to execute/etc/init.d/firewall restart after adding to make the configuration take effect
Precautions
If access to the OPENWRT Luci management interface via the Ethernet port is also the charge prompt, simply authorize the MAC address of the machine as well.
This article by http://www.wifidog.pro/2015/04/08/openwrt-wifidog-5.html compilation, reprint please indicate the source
OPENWRT WiFiDog to achieve fee alert effect