首先安裝wifidog到OpenWRT的路由器:
opkg update
opkg install wifidog
wifidog依賴下面這些子產品:
iptables-mod-extra
iptables-mod-ipopt
kmod-ipt-nat
iptables-mod-nat-extra
libpthread
<a href="http://openwrt.sinapp.net/">http://openwrt.sinapp.net</a>
如果你的路由器不是openwrt官方支援的版本的話,那就需要自己編譯固件。make menuconfig後,在Network–>Captive Portals中選擇wifidog.

安裝完成後,
/etc/init.d/wifidog enable
/etc/init.d/wifidog start
下面安裝Auth Server,按照官方的說法:
AuthPuppy is the next generation authentication server for Wifidog networks.
不過貌似這wifidog和Authpuppy都已經N久沒更新了。。。
安裝成功後,通路AuthPuppy會要求設定一些資料庫資訊,全部設定完成後能看到首頁:
當然了,我們還需要設定管理者的賬号。
進入Manage plugins,Install apAuthLocalUserPlugin,記得要enable這個插件。
然後,點選Manage Nodes,把預設節點的status改成deployed。這個GW(Gateway) ID default後面配置wifidog.conf的時候需要使用。
到這裡,AuthPuppy就基本配置完畢了。
下面回到路由器,編輯wifidog.conf,一般情況下,我們之後配置ExternalInterface,GatewayInterface和AuthServer這三項就可以,其他預設。下面是我的配置:
GatewayIDdefault #注意這個ID必須跟AuthPuppy的GW ID一緻
# Parameter: ExternalInterface
# Default: NONE
# Optional
#
# Set this to the external interface (the one going out to the Inernet or your larger LAN).
# Typically vlan1 for OpenWrt, and eth0 or ppp0 otherwise,
# Normally autodetected
ExternalInterface eth0 #路由器外網的實體接口
# Parameter: GatewayInterface
# Mandatory
# Set this to the internal interface (typically your wifi interface).
# Typically br-lan for OpenWrt, and eth1, wlan0, ath0, etc. otherwise
GatewayInterface wlan0 #路由器内網的實體接口
AuthServer {
Hostname 192.170.1.104
SSLAvailable no
Path /
}
CheckInterval 60
ClientTimeout 5
FirewallRuleSet global {
FirewallRuleSet validating-users {
FirewallRule allow to 0.0.0.0/0
FirewallRuleSet known-users {
FirewallRuleSet unknown-users {
FirewallRule allow udp port 53
FirewallRule allow tcp port 53
FirewallRule allow udp port 67
FirewallRule allow tcp port 67
FirewallRuleSet locked-users {
FirewallRule block to 0.0.0.0/0
注意這個Interface是實體接口,而不是下面OpenWRT web界面中看到的interface。注意不是下面這個:
可以看到我的Interface裡面沒有wlan0之類的選項,/etc/config/network裡面也看不到。
root@OpenWrt:~# cat /etc/config/network
config interface ‘loopback’
option ifname ‘lo’
option proto ‘static’
option ipaddr ‘127.0.0.1’
option netmask ‘255.0.0.0’
config globals ‘globals’
option ula_prefix ‘fd09:fd03:490d::/48′
config interface ‘lan’
option ipaddr ‘192.168.1.1’
option netmask ‘255.255.255.0’
option ip6assign ’60’
option _orig_ifname ‘eth0′
option _orig_bridge ‘false’
config interface ‘WAN’
option proto ‘dhcp’
option _orig_ifname ‘gretap0′
option ifname ‘eth0′
之前我用gretap0和eth0設定ExternalInterface和GatewayInterface,不行。反着來也不行。網上搜了一圈,找到下面的方法來擷取physical interface:
root@OpenWrt:~# ls -l /sys/class/net
lrwxrwxrwx 1 root root 0 Jan 1 1970 eth0 -> ../../devices/platform/ag71xx.0/net/eth0
lrwxrwxrwx 1 root root 0 Jan 1 1970 lo -> ../../devices/virtual/net/lo
lrwxrwxrwx 1 root root 0 Aug 2 15:58 wlan0 -> ../../devices/platform/ar933x_wmac/net/wlan0
OK,原來我這邊也是有wlan0這個interface的,找到之後添加在wifidog.conf上。重新開機wifidog,成功。
另外:
You can also run wifidog in foreground/debug mode:
wifidog -f -d 7
-f means to run in foreground (do not become a background daemon)
-d 7 increases debug output level to the maximum