openwrt 模式

本文详细介绍了WNIC(无线网络接口控制器)的多种工作模式,包括Station (STA)基础设施模式、AccessPoint (AP)基础设施模式、Monitor (MON)模式、Ad-Hoc (IBSS)模式、Wireless Distribution System (WDS)模式和Mesh模式。在STA模式下,设备连接到AP进行认证和关联;AP模式则作为网络的核心,管理连接的STA;MON模式用于被动监听网络活动;IBSS模式允许设备在没有AP的情况下直接通信;WDS模式用于无线AP间的通信路径;而Mesh模式则通过动态路由实现多个设备间的智能连接。同时,文章还提供了设置WNIC为STA或AP模式的指导。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

wnic通常工作的模式

http://wireless.kernel.org/en/users/Documentation/modes

Station (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.

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/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值