[转载]OpenWRT使用wifidog实现强制认证的WIFI热点 | 半个橙子
首先安装wifidog到OpenWRT的路由器:
opkg update
opkg install wifidog
wifidog依赖下面这些模块:
iptables-mod-extra
iptables-mod-ipopt
kmod-ipt-nat
iptables-mod-nat-extra
libpthread
由于trunk的固件更新会比较频繁,会导致直接opkg install wifidog安装不了,如果你凑巧又没有备份与固件对应的Packages的话,就需要到http://downloads.openwrt.org/snapshots/trunk升级固件,然后再安装wifidog。我备份了一个2013年7月份(kernel =3.10.3-1-9da5017d589c0594e545ab00a51eecea)的版本的Packages,需要的话拿去用:
如果你的路由器不是openwrt官方支持的版本的话,那就需要自己编译固件。make menuconfig后,在Network–>Captive Portals中选择wifidog.

安装完成后,
/etc/init.d/wifidog enable
/etc/init.d/wifidog start
这时会抛出一个错误,因为我们还没有设置AuthServer的信息。关于安装wifidog更多的信息可以参考:http://wiki.openwrt.org/doc/howto/wireless.hotspot.wifidog
下面安装Auth Server,按照官方的说法:
AuthPuppy is the next generation authentication server for Wifidog networks.
源文档 <http://www.authpuppy.org/>
不过貌似这wifidog和Authpuppy都已经N久没更新了。。。
AuthPutty是需要安装apache2, php5和MySQL。详细介绍在这里:http://www.authpuppy.org/doc/Getting_Started (Windows版点这里)。
安装成功后,访问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
# Default: NONE
# 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 {
FirewallRule allow to 0.0.0.0/0
}
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 proto ‘static’
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 _orig_bridge ‘false’
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
[转载]OpenWRT使用wifidog实现强制认证的WIFI热点 | 半个橙子的更多相关文章
- OpenWRT使用wifidog实现强制认证的WIFI热点
首先安装wifidog到OpenWRT的路由器: opkg update opkg install wifidog wifidog依赖下面这些模块: iptables-mod-extra iptabl ...
- 【转载】华为荣耀V9手机如何设置WiFi热点共享
有时候我们在电脑的时候发现没有无线网络以及有线网络,如果你的手机有相应网络,并且流量足够(当前很多手机流量套餐都是不限量了),可以开启手机上的Wifi热点进行流量共享使用,开启Wifi流量热点后,电脑 ...
- OpenWRT TP_LINK703N 校园网 锐捷认证解决办法
OpenWRT TP_LINK703N 校园网 锐捷认证解决办法 一.准备的工具 1) SSH登录工具,推荐使用MobaXterm_Personal下载链接https://moba.en.s ...
- 一行代码实现笔记本跳过微信认证连接WIFI
一行代码实现笔记本跳过微信认证连接WIFI 本文作者原创,没有参考其他文章,方法很简单但是很实用,转载请注明出处,谢谢! 问题 有一些WIFI需要通过微信认证才能连接,手机当然是可以的,但是我们手头的 ...
- openwrt<转载--openwrt框架分析 >
这次讲讲openwrt的结构. 1. 代码上来看有几个重要目录package, target, build_root, bin, dl.... ---build_dir/host目录是建立工具链时的临 ...
- OpenWrt中wifidog的配置及各节点页面参数
修改/etc/wifidog.conf, 只需要修改文件的前半部分, 其他都保持默认 GatewayID default GatewayInterface br-lan GatewayAddress ...
- [转载]C++中四种强制类型转换方式
C++中四种强制类型转换方式 原文地址:http://www.cnblogs.com/home123/p/6763967.html 类型转换有c风格的,当然还有c++风格的.c风格的转换的格式很简单( ...
- (转载)openwrt nginx
ln -s ../../../feeds/packages/net/fcgiwrap/ fcgiwrap 本帖最后由 cjd6568358 于 2018-6-4 11:21 编辑 刚又把路由器重置重新 ...
- 怎样用路由器共享需要网页认证的wifi
设置步骤:第一步:登录管理界面 1.连接电脑使用单机能上网的电脑,通过网线连接到路由器的LAN口.2.登录管理界面打开电脑的浏览器,清空地址栏后,输入路由器的管理地址(以路由器底部标贴标识的管理地址为 ...
随机推荐
- 把world转成html
本来用php转的 效果不太理想 很不稳定 最后试了下java 效果不错 只记录java的方法好了 其实他们的原理都是一样的啊,都是用到了微软的com 首先是准备工作 下载(明确dll的版本是64位的还 ...
- ThinkPHP与EasyUI整合之二(datagrid):删除多条记录
学习EasyUI已有一段时间了,现在开始逐步把平时学习的细节和难点记录下来. 1. datagrid选中多条记录的语句是: var rows = $('#dg').datagrid('getSelec ...
- 面向Internet的编程
面向Internet的编程 1994年秋天我返回工作时,这个公司的景象已经完全改变.他们决定Oak语言——跨平台的.安全的.易传输的代码——时理想的面向Internet的语言.同时他们在制作名为Web ...
- 目标跟踪之klt---光流跟踪法
近来在研究跟踪,跟踪的方法其实有很多,如粒子滤波(pf).meanshift跟踪,以及KLT跟踪或叫Lucas光流法,这些方法各自有各自的有点,对于粒子滤波而言,它能够比较好的在全局搜索到最优解,但其 ...
- redhat6.5安装postgresql8.4数据库
Redhat6.5安装postgresql8.4数据库 step1 先移除原有的postgresql数据库(如果有),否则直接跳过 rpm -qa | grep postgresql* rpm -ev ...
- hdu 3715(二分+2-sat)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3715 思路:二分深度,2-sat判断可行性,根据矛盾关系建图:设a=0,a'=1,b=0,b'=1;如 ...
- ios - 上下滚动的新闻
#import <UIKit/UIKit.h> @interface ScrollUpDownView : UIView //设置 要现实的文字 @property(nonatomic, ...
- OpenCV学习笔记七:opencv_nonfree模块
一,简介: 顾名思义,这个模块不是free的.主要包含: 1,SIFT implementation. The class implements SIFT algorithm by D. Lowe. ...
- Jmeter与LoadRunner 测试Java项目的坑
32位的JDK,Jmeter.bat 最大内存只能配置1G,测不了大并发,所以用Jmeter测试时一定要改成64位的Jmeter用LR测试java程序的时候必须用32位的JDK 环境变量 在path的 ...
- Android开发:《Gradle Recipes for Android》阅读笔记(翻译)3.4——Flavor Dimensions
问题: 一个product flavor不够,你需要另一个标准去区分不同版本的app 解决方案: 在product flavor中增加flavorDimensions 讨论: 在3.2章展示了一个有三 ...