openWRT学习 联系客服

发布时间 : 星期六 文章openWRT学习更新完毕开始阅读

openwrt学习

option txantenna 0,1,2 (atheros, broadcom) 发送端天线标识 (Antenna identifier) option txpower transmission power in dBm 发射功率transmission power

config wifi-iface

option network the interface you want wifi to bridge with wifi要使用的网络接口 option device wifi0, wifi1, wifi2, wifiN wifi设备名

option mode ap, sta, adhoc, monitor, mesh, or wds 操作模式,有AP、client mode、adhoc、monitor、mesh point mode(802.11s)及WDS点对点连接。

option txpower (deprecated) transmission power in dBm 发送功率,应设置在wifi-device。

option ssid ssid name SSID名字

option bssid bssid address 用于WDS,设置为other WDS unit的MAC地址 option encryption none, wep, psk, psk2, wpa, wpa2 加密设置,支持none、WEP、pre-shared key、及wpa radius。

option key encryption key option key1 key 1

option key2 key 2 option key3 key 3 option key4 key 4

option passphrase 0,1 0则将WPA psk为明文passphrase,1则为encoded passphrase。可通过wpa_passphrase工具产生加密的passphrase。在passphrase包含特殊字符时有用。此选项仅适用于mac80211或atheros。

option server ip address radius server IP地址

option port port radius server端口号,缺省为1812 option hidden 0,1 0为广播SSID,1为隐藏

option isolate 0,1 (broadcom) 无线客户端隔离功能,0要禁止隔离,1为开启,缺省为0.

option doth 0,1 (atheros, broadcom) Toggle 802.11h mode,0为禁止802.11h,1为启用,缺省为0.

option wmm 0,1 (atheros, broadcom) Toggle 802.11e mode,0为禁止,1为启用,缺省为0.

Mesh Point

Mesh Point (802.11s) 仅mac80211 驱动支持,需要安装iw包来建立mesh link。Openwrt创建mshN mesh point接口,配置举例:

config wifi-device \ option type \ option channel \

config wifi-iface

option device \ option network lan

版权所有?2012 成都科技有限公司 第 9 页 共 29 页

openwrt学习

option mode \ option mesh_id \

WDS

Wireless Distribution System WDS是个非标准模式,可工作在同类设备间,但不能工作在不同的设备如broadcom和atheros设备间。

Unencrypted WDS connections

未加密的WDS配置如下,我们假定一端的BSSID ca:fe:ba:be:00:01,而另一端为BSSID ca:fe:ba:be:00:01:

config wifi-device \ option type

config wifi-iface

option device \ option network lan

option mode \

option ssid \ option hidden \ option encryption \

config wifi-iface

option device \ option network lan option mode wds

option ssid \ option bssid \

\

option channel \

Encrypted WDS connections

可以加密wds连接,支持psk、psk2及psk+psk2模式,以下是一个使用AES加密算法的pre-shared key例子:

config wifi-device wl0 option type broadcom option channel 5

config wifi-iface

版权所有?2012 成都科技有限公司

第 10 页 共 29 页

openwrt学习

option device \

config wifi-iface

option device \ option network lan

option mode wds

option bssid ca:fe:ba:be:00:02 option ssid \ option encryption psk2

option key \

option network lan option mode ap

option ssid \option encryption psk2

option key \

802.1x configurations

配置略

EAP-PEAP

配置略

限制说明

Limitations

There are certain limitations when combining modes. Only the following mode combinations are supported:

WDS links can only be used in pure AP mode and cannot use WEP (except when sharing the settings with the master interface, which is done automatically).

VAP num defaults to 4, but can be changed by loading the module with the maxvaps=N parameter.

Adding a new driver configuration

具体添加方式略

版权所有?2012 成都科技有限公司

第 11 页 共 29 页

openwrt学习

Network-scripts.tex

Using the network scripts

为使用network,必须通过如下方式包含必须的shell脚本: . /etc/functions.sh # common functions

include /lib/network # include /lib/network/*.sh

scan_interfaces # read and parse the network config

有些协议,如PPP会在运行期间改变配置的接口名,如PPPOE会将eth0改为ppp0,因此要运行scan_interface,而不是从配置中直接读取。运行scan_interface后,ifname选项将包含有效的接口名(用于ip traffic),如果物理设备名与此不同,则会保存在device选项中。

这意味着在scan_interface后运行config_get_lan_ifname,获取的结果可能与运行之前不同。

Writing protocol handers

添加协议处理

可通过在/lib/network下添加shell脚本来定制协议处理,脚本包含: scan_() { local config=\

# change the interface names if necessary }

setup_interface_() { local interface=\ local config=\ # set up the interface }

Network.tex

网络接口配置

网络配置文件为/etc/config/network,被分隔为多个接口配置。每一个接口配置或直接就是ethernet/wifi接口(如eth0、wl0),或包含多个接口的桥接口。

如:

版权所有?2012 成都科技有限公司 第 12 页 共 29 页