首先安装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

源文档 <http://wiki.openwrt.org/doc/howto/wireless.hotspot.wifidog>

OpenWRT使用wifidog实现强制认证的WIFI热点的更多相关文章

  1. [转载]OpenWRT使用wifidog实现强制认证的WIFI热点 | 半个橙子

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

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

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

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

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

  4. Android 开发 创建WiFi、WiFi热点 ---开发集合

    WIFI 权限 <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> < ...

  5. 创建假的wifi热点

    本帖介绍怎么创建假的wifi热点,然后抓取连接到这个wifi用户的敏感数据.我们还会给周围的无线路由器发送未认证的包,使这些路由器瘫痪,强迫用户连接(或自动连接)我们创建的假wifi热点. 这种攻击也 ...

  6. Android WiFi开发教程(一)——WiFi热点的创建与关闭

    相对于BlueTooth,WiFi是当今使用最广的一种无线网络传输技术, 几乎所有智能手机.平板电脑和笔记本电脑都支持Wi-Fi上网.因此,掌握基本的WiFI开发技术是非常必要的.本教程将围绕一个小D ...

  7. 用DD-WRT自建计费WiFi热点

    架设无线网络(Wlan)向周围的用户有偿共享网络. 传统的方法,能够使用专业的无线与宽带计费网关设备和软件.比方MikroTik等. 只是,对于个人架设WiFi热点来说.这些方案太过昂贵,安装设置也很 ...

  8. 树莓派搭建钓鱼wifi热点

    我们连接的公共wifi其实是非常不安全的网络,骇客可以利用wifi路由设备进行中间人攻击,劫持DNS伪造钓鱼网站.接下来我会做个简单的实验,伪造中国电信的路由ChinaNet并发射出热点wifi等待别 ...

  9. Linux创建WiFi热点

    手机流量用完,需要开WiFi,由于是LinuxMint,感觉配置还算容易,找到一个不错的教程,收藏一下,以备后用.除了修改配置文件那步在我的电脑不需要外其他基本正确,而且Mint本来就衍生自Ubunt ...

随机推荐

  1. Snmp学习总结系列——开篇

    进入公司以来,一直参与到公司的产品研发工作当中去,在产品研发中有一个监控远程服务器CPU使用率,内存使用情况,硬盘的需求,技术总监提出了使用Snmp协议作为远程监控的技术解决方案,头一次听说Snmp这 ...

  2. Lucene 3.0 输出相似度

    http://www.cnblogs.com/ibook360/archive/2011/10/19/2217638.html Lucene3.0之结果排序(原理篇) 传统上,人们将信息检索系统返回结 ...

  3. tms web core程序部署

    tms web core程序部署 笔者把已经开发好的TMS WEB CORE程序部署到阿里云服务器上面,来作为例子. 1)复制TMS WEB CORE前端程序到服务器的c:\room\ 2)复制TMS ...

  4. file is universal (4 slices) but does not contain a(n) armv7s slice

    关于ld: file is universal (2 slices) but does not contain a(n) armv7s slice 升级了xcode之后,支持iOS6和iPhone5, ...

  5. spring websocket自动断开连接再创建引发的问题解决方案

    问题:由于 web session 超时时间为 30 分钟,如用户在 web session 规定时间内没有退出系统,但由于其它原因 用户却断开的 websocket 的连接,如果用户还要聊天或是其它 ...

  6. 使用node-webkit实现打包工具的小结

    之前一直使用的hta在开发工具,最近转到node-webkit上了,对比一下二者的优劣势.hta单个文件,体积较小,但有兼容性的问题(兼容ie6.7.8就行了,也还好),node-webkit使用we ...

  7. .NET零基础入门之01:开篇及CSharp程序、解决方案的结构

    一:为什么选择C# 每个人都有梦想,有些人的梦想就是:成为程序员.最课程(www.zuikc.com)的<零基础c#入门>是试图帮助我们实现这个梦想. 也许你要问:我基础很差怎么办?最课程 ...

  8. Dump dynamic object in LinqPad

      Just like: dynamic paper = MockPaper(); LINQPad.Extensions.Dump(paper); //paper.Dump(); Use LINQPa ...

  9. SVG 文字居中整理

    一.基于SVG文档的文字居中 text-anchor: middle; //水平方向居中 dominant-baseline: middle; //垂直居中 1.使用内联样式配置居中 <svg ...

  10. Java NIO Test Case

    package org.zwl.test.nio; import java.io.IOException; import java.net.InetSocketAddress; import java ...