2015年1月

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

Openwrt 添加wifidog

OpenWrt source repository downloads

You can either check out the OpenWrt source code via git or svn.
GIT
The recommended way of checking out the OpenWrt source code is cloning the Git repository using one of the following commands:
trunk (main development tree)

  • Main repository

    git clone git://git.openwrt.org/openwrt.git

14.07 branch (Barrier Breaker)

  • Main repository

    git clone git://git.openwrt.org/14.07/openwrt.git

12.09 branch (Attitude Adjustment)

  • Main repository

    git clone git://git.openwrt.org/12.09/openwrt.git

  • Packages feed

    git clone git://git.openwrt.org/12.09/packages.git

SVN
You can checkout the source from the OpenWrt Subversion repository using one of the following commands:

  • Development branch:

    svn co svn://svn.openwrt.org/openwrt/trunk/

  • Barrier Breaker 14.07 branch:

    svn co svn://svn.openwrt.org/openwrt/branches/barrier_breaker

  • Attitude Adjustment 12.09 branch:

    svn co svn://svn.openwrt.org/openwrt/branches/attitude_adjustment

  • Backfire 10.03 branch:

    svn co svn://svn.openwrt.org/openwrt/branches/backfire

  • Kamikaze 8.09 branch:

    svn co svn://svn.openwrt.org/openwrt/branches/8.09

  • Kamikaze 7.09 branch:

    svn co svn://svn.openwrt.org/openwrt/tags/kamikaze_7.09

本文章由 http://www.wifidog.pro/2015/01/08/openwrt%E6%B7%BB%E5%8A%A0wifidog-1.html 整理编辑,转载请注明出处