openwrt学习
. /etc/functions.sh 这样就可以使用config_load
local type=\ local name=\
# commands to be run for every section }
option_cb() {
# commands to be run for every option }
wireless.tex文档部分学习
WiFi配置文件为/etc/config/wireless。当前支持broadcom、atheros、mac80211。 设备首次启动会检测无线卡类型,并创建一个默认配置文件(sample configuration file)。每一无线驱动都有自己的配置脚本(/lib/wifi/driver_name.sh),用来处理驱动特定的选项及配置,脚本也会调用驱动特定的二进制如适用于broadcom的wlc,适用于atheros、mac80211的hostapd和wpa_supplicant。 这种结构(architecture)抽象了驱动配置。 通用的broadcom无线配置(略): 通用的mac80211无线配置(略):
通用的atheros无线配置:
config wifi-device \ option type \ option channel \ option hwmode \
config wifi-iface
option device \# option network lan
option mode \
option ssid \ option hidden \
第 6 页 共 28 页
openwrt学习
option encryption \
通用的多radio atheros无线配置:
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
配置文件详述
配置文件有两部分,一是wifi-device,指的是物理wifi接口,而wifi-iface指的是其上的虚拟接口,即VAP。
整个的配置文件如下:
config wifi-device wifi device name
option type broadcom, atheros, mac80211 所支持的驱动类型 option country us, uk, fr, de, etc. 国家码 option channel 1-14 wifi信道,依赖于国家码
option maxassoc 1-128 (broadcom only) 关联的最大client数目,仅broadcom支持。
option distance 1-n (meters) AP与最远的client的距离,仅atheros芯片支持
第 7 页 共 28 页
openwrt学习
option hwmode 11b, 11g, 11a, 11bg (atheros, mac80211) 频率带宽,仅atheros支持。
option rxantenna 0,1,2 (atheros, broadcom) 接收端天线标识 (Antenna identifier) 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 \
第 8 页 共 28 页
openwrt学习
config wifi-iface
option device \ option network lan
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 \ option channel \
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 \
Encrypted WDS connections
可以加密wds连接,支持psk、psk2及psk+psk2模式,以下是一个使用AES加密算法的pre-shared key例子:
config wifi-device wl0
option type broadcom
第 9 页 共 28 页
openwrt学习
option channel 5
config wifi-iface
option device \ option network lan option mode ap
option ssid \ option encryption psk2
option key \
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 \
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
具体添加方式略
第 10 页 共 28 页