分类 wifidog安装 下的文章

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 整理编辑,转载请注明出处

openwrt 配置wifidog 相关的network

Configuring OpenWrt Network
The network configuration in Kamikaze is stored in /etc/config/network and is divided into interface configurations. Each interface configuration either refers directly to an ethernet/wifi interface (eth0, wl0, ..) or to a bridge containing multiple interfaces. It looks like this:

config interface     "lan" 
      option ifname    "eth0" 
      option proto     "static" 
      option ipaddr    "192.168.1.1" 
      option netmask   "255.255.255.0" 
      option gateway   "192.168.1.254" 
      option dns       "192.168.1.254"

ifname specifies the Linux interface name. If you want to use bridging on one or more interfaces, set ifname to a list of interfaces and add:

option type     "bridge"

It is possible to use VLAN tagging on an interface simply by adding the VLAN IDs to it, e.g. eth0.1. These can be nested as well.

This sets up a simple static configuration for eth0. proto specifies the protocol used for the interface. The default image usually provides ’none’ ’static’, ’dhcp’ and ’pppoe’. Others can be added by installing additional packages.

When using the ’static’ method like in the example, the options ipaddr and netmask are mandatory, while gateway and dns are optional. You can specify more than one DNS server, separated with spaces.

DHCP currently only accepts ipaddr (IP address to request from the server) and hostname (client hostname identify as) - both are optional.
PPP based protocols (pppoe, pptp, ...) accept these options:

  • username: The PPP username (usually with PAP authentication)
  • password: The PPP password
  • keepalive: Ping the PPP server (using LCP). The value of this option specifies the maximum number of failed pings before reconnecting. The ping interval defaults to 5, but can be changed by appending "," to the keepalive value
  • demand: Use Dial on Demand (value specifies the maximum idle time.
  • server(pptp): The remote pptp server IP

For all protocol types, you can also specify the MTU by using the mtu option.

Setting up static routes
You can set up static routes for a specific interface that will be brought up after the interface is configured.
Simply add a config section like this:

  config route foo 
   option interface lan 
   option target 1.1.1.0 
   option netmask 255.255.255.0 
   option gateway 192.168.1.1

The name for the route section is optional, the interface, target and gateway options are mandatory. Leaving out the netmask option will turn the route into a host route.

Setting up the switch (currently broadcom only)
The switch configuration is set by adding a ’switch’ config section. Example:

  config switch       "eth0" 
      option vlan0    "1 2 3 4 5*" 
      option vlan1    "0 5"

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