wnic通常工作的模式
http://wireless.kernel.org/en/users/Documentation/modesStation (STA) infrastructure mode
Any wireless driver is capable of running this mode. Thus it could be called the default mode. Two WNICs in STA mode, cannot connect to one another. They require a third WNIC in AP mode to manage the wireless network! A WNIC in STA mode, connects to a WNIC in AP mode, by sending certain management frames to it. This process is called the authentication and association. After the AP sent the successful association- reply, the STA is part of the wireless network.
This mode is also called managed in the fully deprecated WEXT tools (e.g. iwconfig)
AccessPoint (AP) infrastructure mode
In a managed wireless network the Access Point acts as the Master device. It holds the network together by managing and maintaining lists of associated STAs. It also manages security policies. The network is named after the MAC-Address (BSSID) of the AP. The human readable name for the network, the SSID, is also set by the AP.
To use AP mode in Linux you need to use hostapd, at least a current 0.6 release, preferably from git.
Cf. http://wireless.erley.org
Monitor (MON) mode
Monitor mode is a passive-only mode, no frames are transmitted. All incoming packets are handed over to the host computer completely unfiltered. This mode is useful to see what's going on on the network.
With mac80211, it is possible to have a network device in monitor mode in addition to a regular device, this is useful to observe the network whilst using it. However, not all hardware fully supports this as not all hardware can be configured to show all packets while in one of the other operating modes. Monitor mode interfaces always work on a "best effort" basis.
With mac80211, it's also possible to transmit packets in monitor mode, which is known as packet injection. This is useful for applications that wish to implement MLME work in userspace, for example to support nonstandard MAC extensions of IEEE 802.11.
-
See also: radiotap.
Ad-Hoc (IBSS) mode
The Ad-Hoc mode aka IBBS (Independent Basic Service Set) mode, is used to create a wireless network without the need of having an AP in the network. Each station in an IBSS network is managing the network itself. Ad-Hoc is useful for connecting two or more computers to each other when no (useful) AP is around for this purpose.
Wireless Distribution System (WDS) mode
The Distribution System is the wired uplink connection to an AP. The Wireless Distribution System is the wireless equivalent to it. WDS serves as a wireless communication path between cooperating APs (usually in a single ESS), it can be used instead of cabling. Read iw WDS documentation for details on how to enable this, but also review and consider using 4-address mode.
Mesh
Mesh interfaces are used to allow multiple devices to communication with each other by establishing intelligent routes between each other dynamically.
设置为sta模式,
cat /etc/config/wireless
config wifi-device 'radio0'
option type 'mac80211'
option hwmode '11ng'
option path 'platform/ar933x_wmac'
list ht_capab 'SHORT-GI-20'
list ht_capab 'SHORT-GI-40'
list ht_capab 'RX-STBC1'
list ht_capab 'DSSS_CCK-40'
option disabled '0'
option channel 'auto'
option htmode 'HT40+'
option country 'CN'
option noscan '1'
config wifi-iface
option device 'radio0'
option network 'wwan'
option mode 'sta'
option encryption 'psk2'
option ssid 'qwer'
option key qwertyuiop
其中在wifi-iface,option mode sta指定本系统工作模式为客户端
option ssid qwer指定上级路由器的ssid
option encryption psk2指定上级路由器的方式为psk2,如果上级路由器没有密码,则可以设置成none
option key qwertyuiop指定上级路由器的无线密码,如果上级路由器没有密码,此项可以不要
option network wwlan指定了接口是wwan,而系统中还不存在,所以需要在network配置文件新建一个接口wwan
cat /etc/config/network
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix 'fde9:82f4:58b7::/48'
config interface 'lan'
option ifname 'eth1'
option type 'bridge'
option proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
option ip6assign '60'
config interface 'wan'
option ifname 'eth0'
option proto 'dhcp'
config interface 'wan6'
option ifname '@wan'
option proto 'dhcpv6'
config interface wwan
option proto dhcp
重启网络即可
/etc/init.d/network restart
设置为ap模式,
cat /etc/config/wireless
config wifi-device radio0
option type mac80211
option channel auto
option hwmode 11ng
option path 'platform/ar933x_wmac'
option htmode HT20
list ht_capab SHORT-GI-20
list ht_capab SHORT-GI-40
list ht_capab RX-STBC1
list ht_capab DSSS_CCK-40
option htmode HT40+
option country CN
option noscan 1
option disabled 0
config wifi-iface
option device radio0
option network lan
option mode ap
option ssid OpenWRT_SSID
option encryption psk2
option key qwertyuiop
其中在
wifi-iface
,
option mode ap指定本系统工作模式为ap
option ssid OpenWRT_SSID指定本路由器的ssid
option encryption psk2指定本路由器的方式为psk2, 如果本路由器不想设置密码,则可以设置成none
option key qwertyuiop指定本路由器的无线密码, 如果本路由器不设置密码,此项可以不要
option network lan指定了接口是lan,而系统中已经存在,network配置文件同上
重启网络即可
/etc/init.d/network restart
refer to
http://wireless.kernel.org/en/users/Documentation/iw/