分类 wifidog分析 下的文章

wifidog 认证出现绿屏问题

使用wifidog 做无线认证的网关协议,经常会遇到个绿色页面,其实这个页面是wifidog 源码里的 wifidog-msg.html,直接用浏览器打开时这个样子的。
1.jpg

这个页面什么时候会出现呢?我们来看下wifidog 的网关协议。
在wifidog.conf里有个配置:

HtmlMessageFile /etc_ro/wifidog-msg.html

这个文件名是可以改的,不过我们没必要这么麻烦,这里就按着默认的介绍下绿屏出现的原因。
从conf.c文件里我们可以看到HtmlMessageFile 对应着config变量中的htmlmsgfile, 然后找到htmlmsgfile 变量使用之处只有如下函数中:

void send_http_page(request *r, const char *title, const char* message);

这个函数很明显就是给浏览器发送http 页面的,举个例子:
send_http_page(r, "WiFiDog error", "Invalid token");
这个是把上面的$title 换成“wifidog error", $message换成"Invalid token",$nodeID换成wifidog.conf 中的 GatewayID。

本文章由 http://www.wifidog.pro/2015/01/09/wifidog%E7%BB%BF%E5%B1%8F.html 整理编辑,转载请注明出处

wifidog uci 设置网络命令

OPENWRT使用命令行设置无线和有线网络

在我们将路由器固件刷成开源的基于Linux内核的openwrt系统后,由于openwrt默认未安装WEB管理界面,所以我们需要先通过SSH或者telnet对路由器进行网络设置,设置完成后可通过openwrt的软件包管理opkg安装web设置界面Luci。
设置lan ip(即访问路由的ip)
Shell代码
uci set network.lan.ipaddr=[lan ip]

使用pppoe设置
Shell代码
uci set network.wan.proto=pppoe //设置wan口类型为pppoe
uci set network.wan.username=[上网帐户]
uci set network.wan.password=[上网密码] //这两行设置pppoe用户名和密码

如果要挂在上级路由下面,就需要进行下面的设置
Shell代码
uci set network.wan.proto=none //关掉wan
uci set network.lan.gateway=[上级路由ip] //网关指向上级路由
uci set network.lan.dns=[上级路由ip] //dns指向上级路由
uci set dhcp.lan.ignore=1 //关掉lan的dhcp

最后对无线网络进行配置
Shell代码
uci set wireless.@wifi-device[0].disabled=0 //打开无线
uci set wireless.@wifi-device[0].txpower=17 //设置功率为17dbm 太高会烧无线模块
uci set wireless.@wifi-device[0].channel=6 //设置无线信道为6
uci set wireless.@wifi-iface[0].mode=ap //设置无线模式为ap
uci set wireless.@wifi-iface[0].ssid=[自己设置SSID] //设置无线SSID
uci set wireless.@wifi-iface[0].network=lan //无线链接到lan上
uci set wireless.@wifi-iface[0].encryption=psk2 //设置加密为WPA2-PSK
uci set wireless.@wifi-iface[0].key=[密码] //设置无线密码

提交应用配置
Shell代码
uci commit //应用
/etc/init.d/network restart //重启网络服务

安装luci管理界面
Shell代码
opkg update // 更新软件列表
opkg list-installed // 查看已安装软件
opkg install luci // 安装LUCI
opkg install luci-i18n-chinese // 支持中文

即可完成LUCI的安装。
输入以下命令开启支持web服务的uhttpd,并设置其为自启动:
Shell代码
/etc/init.d/uhttpd enable # 开机自启动
/etc/init.d/uhttpd start # 启动uhttpd

本文章由 http://www.wifidog.pro/2015/01/09/wifidog-uci.html 整理编辑,转载请注明出处

openwrt使用crontab 实现wifidog定时启动

OpenWrt使用crontab执行计划任务
crontab -l

列出当前的默认计划任务列表

crontab -r

删除当前的默认计划任务列表

crontab -e

启用vi修改当前的默认计划任务列表

crontab后面还可以跟FILE参数,指定计划任务列表

然后是计划任务列表的格式:

[minute] [hour] [day of month] [month] [day of week] [program to be run]

其中各个参数的取值范围是:

minute(0-59)
hour(0-23)
day of month(1-31)
month(1-12)
day of week(0-7,0 or 7 is Sun)

每个参数里的取值可以有4种间隔符:

  • 表示任意

  • 表示范围

, 表示枚举多个值

/ 表示每隔

例如:

周一到周五每天晚上23:30执行ruijieclient -k

30 23 * * 1-5 /bin/ruijieclient -k

每天每隔10分钟执行date

*/10 * * * * date

另外每次执行完成任务后系统会发送信息给你,如果你不想收,可以在每条执行语句后面加:

/dev/null 2>&1

本文章由 http://www.wifidog.pro/2015/01/08/wifidog%E5%AE%9A%E6%97%B6%E5%90%AF%E5%8A%A8.html 整理编辑,转载请注明出处

openwrt配置wifidog wireless

configure openwrt Wireless
The WiFi settings are configured in the file /etc/config/wireless (currently supported on Broadcom, Atheros and mac80211). When booting the router for the first time it should detect your card and create a sample configuration file. By default ’option network lan’ is commented. This prevents unsecured sharing of the network over the wireless interface.

Each wireless driver has its own configuration script in /lib/wifi/driver_name.sh which handles driver specific options and configurations. This script is also calling driver specific binaries like wlc for Broadcom, or hostapd and wpa_supplicant for atheros.

The reason for using such architecture, is that it abstracts the driver configuration.

Generic Broadcom wireless config:

  config wifi-device      "wl0" 
      option type         "broadcom" 
      option channel      "5" 

  config wifi-iface 
      option device       "wl0" 
  #   option network  lan 
      option mode         "ap" 
      option ssid         "OpenWrt" 
      option hidden       "0" 
      option encryption   "none"

Generic Atheros wireless config:

  config wifi-device      "wifi0" 
      option type         "atheros" 
      option channel      "5" 
      option hwmode "11g" 

  config wifi-iface 
      option device       "wifi0" 
  #   option network  lan 
      option mode         "ap" 
      option ssid         "OpenWrt" 
      option hidden       "0" 
      option encryption   "none"

Generic mac80211 wireless config:

  config wifi-device      "wifi0" 
      option type         "mac80211" 
      option channel      "5" 

  config wifi-iface 
      option device       "wlan0" 
  #   option network  lan 
      option mode         "ap" 
      option ssid         "OpenWrt" 
      option hidden       "0" 
      option encryption   "none"

Generic multi-radio Atheros wireless config:

  config wifi-device  wifi0 
      option type     atheros 
      option channel  1 

  config wifi-iface 
      option device   wifi0 
  #   option network  lan 
      option mode     ap 
      option ssid     OpenWrt_private 
      option hidden   0 
      option encryption none 

  config wifi-device  wifi1 
      option type     atheros 
      option channel  11 

  config wifi-iface 
      option device   wifi1 
  #   option network  lan 
      option mode     ap 
      option ssid     OpenWrt_public 
      option hidden   1 
      option encryption none

There are two types of config sections in this file. The ’wifi-device’ refers to the physical wifi interface and ’wifi-iface’ configures a virtual interface on top of that (if supported by the driver).

A full outline of the wireless configuration file with description of each field:

  config wifi-device    wifi device name 
      option type       broadcom, atheros, mac80211 
      option country    us, uk, fr, de, etc. 
      option channel    1-14 
      option maxassoc   1-128 (broadcom only) 
      option distance   1-n 
      option hwmode     11b, 11g, 11a, 11bg (atheros, mac80211) 
      option rxantenna  0,1,2 (atheros, broadcom) 
      option txantenna  0,1,2 (atheros, broadcom) 
      option txpower  transmission power in dBm 

  config wifi-iface 
      option network  the interface you want wifi to bridge with 
      option device   wifi0, wifi1, wifi2, wifiN 
      option mode     ap, sta, adhoc, monitor, or wds 
      option txpower  (deprecated) transmission power in dBm 
      option ssid     ssid name 
      option bssid    bssid address 
      option encryption none, wep, psk, psk2, wpa, wpa2 
      option key      encryption key 
      option key1     key 1 
      option key2     key 2 
      option key3     key 3 
      option key4     key 4 
      option server   ip address 
      option port     port 
      option hidden   0,1 
      option isolate  0,1 
      option doth     0,1 (atheros, broadcom) 
      option wmm      0,1 (atheros, broadcom)

本文章由 http://www.wifidog.pro/2015/01/08/openwrt-wifidog-wireless.html 整理编辑,转载请注明出处