首先安装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,需要的话拿去用:

http://openwrt.sinapp.net

如果你的路由器不是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

源文档 <http://unix.stackexchange.com/questions/57309/how-can-i-tell-whether-a-network-interface-is-physical-device-or-virtual-alia>

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热点 | 半个橙子的更多相关文章

  1. OpenWRT使用wifidog实现强制认证的WIFI热点

    首先安装wifidog到OpenWRT的路由器: opkg update opkg install wifidog wifidog依赖下面这些模块: iptables-mod-extra iptabl ...

  2. 【转载】华为荣耀V9手机如何设置WiFi热点共享

    有时候我们在电脑的时候发现没有无线网络以及有线网络,如果你的手机有相应网络,并且流量足够(当前很多手机流量套餐都是不限量了),可以开启手机上的Wifi热点进行流量共享使用,开启Wifi流量热点后,电脑 ...

  3. OpenWRT TP_LINK703N 校园网 锐捷认证解决办法

    OpenWRT TP_LINK703N 校园网 锐捷认证解决办法 一.准备的工具 1)      SSH登录工具,推荐使用MobaXterm_Personal下载链接https://moba.en.s ...

  4. 一行代码实现笔记本跳过微信认证连接WIFI

    一行代码实现笔记本跳过微信认证连接WIFI 本文作者原创,没有参考其他文章,方法很简单但是很实用,转载请注明出处,谢谢! 问题 有一些WIFI需要通过微信认证才能连接,手机当然是可以的,但是我们手头的 ...

  5. openwrt<转载--openwrt框架分析 >

    这次讲讲openwrt的结构. 1. 代码上来看有几个重要目录package, target, build_root, bin, dl.... ---build_dir/host目录是建立工具链时的临 ...

  6. OpenWrt中wifidog的配置及各节点页面参数

    修改/etc/wifidog.conf, 只需要修改文件的前半部分, 其他都保持默认 GatewayID default GatewayInterface br-lan GatewayAddress ...

  7. [转载]C++中四种强制类型转换方式

    C++中四种强制类型转换方式 原文地址:http://www.cnblogs.com/home123/p/6763967.html 类型转换有c风格的,当然还有c++风格的.c风格的转换的格式很简单( ...

  8. (转载)openwrt nginx

    ln -s ../../../feeds/packages/net/fcgiwrap/ fcgiwrap 本帖最后由 cjd6568358 于 2018-6-4 11:21 编辑 刚又把路由器重置重新 ...

  9. 怎样用路由器共享需要网页认证的wifi

    设置步骤:第一步:登录管理界面 1.连接电脑使用单机能上网的电脑,通过网线连接到路由器的LAN口.2.登录管理界面打开电脑的浏览器,清空地址栏后,输入路由器的管理地址(以路由器底部标贴标识的管理地址为 ...

随机推荐

  1. Eclipse 快速修复

    Eclipse 快速修复 使用快速修复 在 Eclipse 编辑器中当你输入字母时,编辑器会对你输入的内容进行错误分析. Java 编辑器中使用 Java 语法来检测代码中的错误.当它发现错误或警告时 ...

  2. 图像增强之DDE---基于红外图像的数字图像细节增强DDE

    (1)DDE应用背景 (2)DDE算法简介 (3)DDE 实现 (4)DDE 总结和不足 ----------author:pkf -----------------time:2-9 -------- ...

  3. linux c 常常混淆的概念

    指针函数 and 函数指针 指针函数是指带指针的函数,即本质是一个函数.函数都有返回类型(假设不返回值,则为无值型),仅仅只是指针函数返回类型是某一类型的指针. 定义格式 类型名 *函数名(函数參数列 ...

  4. CFindReplaceDialog学习

    The CFindReplaceDialog class allows you to implement standard string Find/Replace dialog boxes in yo ...

  5. Valgrind使用-转载

    完全转载的,仅当学习使用 对应链接地址:http://www.gjprj.cn/news1.asp?id=2862 另见valgrind的使用简介,http://blog.csdn.net/sduli ...

  6. ios -解决view遮挡按钮问题

    #pragma mark -解决view遮挡按钮问题 //分享按钮赋予 self 最顶部 / web按钮赋予 self 最顶部 / showBtn显示按钮 self 最顶部 / scrollviews ...

  7. unintest基础1

    import unittest class Testfunc(unittest.TestCase): def testfunc(self): print('testfunc1') def testfu ...

  8. tomcat ; nginx ;mysql

    [说明]上午在服务器上部署了自己的web目录(tomcat虚拟目录),下午安装并了解了nginx(出了点问题,后来解决了),晚上尝试nginx和tomcat配置(一头雾水) 一:今日完成 1)配置to ...

  9. 《从零开始学Swift》学习笔记(Day 12)——说几个特殊运算符

    原创文章,欢迎转载.转载请注明:关东升的博客   除了一些常用的运算符,还有一些其他的: •      引用号(.):实例调用属性.方法等操作符. •      问号(?):用来声明可选类型. •   ...

  10. 如何避免升级 Linux 实例内核后无法启动

    如何避免升级 Linux 实例内核后无法启动_系统配置_操作运维 Linux_常见问题_云服务器 ECS-阿里云 https://help.aliyun.com/knowledge_detail/59 ...