Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
| zh-cn:doc:howto:clientmode [2017/10/30 14:12] – biAji | zh-cn:doc:howto:clientmode [2018/02/17 21:32] – ↷ Links adapted because of a move operation | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== 无线客户端模式 ====== | ||
| + | 本文概述了以// | ||
| + | |||
| + | 这种能力的用途很广泛,比如: | ||
| + | |||
| + | * 将独立设备或[[wp> | ||
| + | * 建立点对点连接; | ||
| + | * 反转AP和客户端以适应驱动造成的限制; | ||
| + | * 可以在不影响网络其余部分的情况下关闭独立设备。 | ||
| + | |||
| + | OpenWrt支持多种客户端模式,包括使用// | ||
| + | |||
| + | ===== WDS - 无线分布系统 ===== | ||
| + | |||
| + | WDS模式是无线[[wp> | ||
| + | |||
| + | 由于其非标的本性,WDS在不同的无线驱动和制造商固件采用了不同的实现,以至于它们经常互不兼容。为使用WDS,所有部署的设备应当使用同样的软硬件以保证兼容性。 | ||
| + | |||
| + | OpenWrt支持两种类型的WDS,根据无线芯片和驱动分类如下: | ||
| + | |||
| + | * [[wp> | ||
| + | * AP-to-Sta WDS (" | ||
| + | |||
| + | WDS的最大优势是[[wp> | ||
| + | {{: | ||
| + | |||
| + | ==== Broadcom WDS ==== | ||
| + | |||
| + | The setup of Broadcom WDS is explained in the recipe article [[doc: | ||
| + | |||
| + | ==== AP-to-Sta WDS (Madwifi, mac80211) === | ||
| + | |||
| + | The setup of Madwifi or mac80211 WDS is explained in the recipe article [[docs: | ||
| + | |||
| + | This option is the preferred approach for wireless chipsets that support the Linux mac80211 wireless drivers (e.g. Atheros wireless chipsets). If the file / | ||
| + | |||
| + | < | ||
| + | config wifi-device ' | ||
| + | option type ' | ||
| + | ... | ||
| + | </ | ||
| + | |||
| + | ===== 路由客户端模式 ===== | ||
| + | |||
| + | The //routed client mode// is the most generic wireless option. It is supported by all chipsets and drivers and requires no special modifications. The downside of routed client mode is the inability to bridge network segments or relay broadcast traffic. This affects for example the Windows Network Neighbourhood where [[wp> | ||
| + | |||
| + | With routed client mode there are two possibilities to implement the network topology, depending on the specific requirements. | ||
| + | |||
| + | ==== 伪装 ==== | ||
| + | |||
| + | Using // | ||
| + | {{: | ||
| + | |||
| + | Hosts from the client network (red) are able to reach hosts in the AP network (blue), the client router // | ||
| + | |||
| + | See the [[docs: | ||
| + | |||
| + | ==== 路由 ==== | ||
| + | |||
| + | This option requires a // | ||
| + | |||
| + | {{: | ||
| + | |||
| + | Hosts from the client network (red) are able to directly communicate with hosts in the AP network (blue) and vice versa. The rectangles represent static route entries. | ||
| + | See the [[docs: | ||
| + | |||
| + | |||
| + | ===== 客户端桥接模式 (仅适用brcm-2.4) ===== | ||
| + | |||
| + | The //bridged client mode// is a proprietary Broadcom extension called //WET (Wireless Ethernet Transceiver) mode//. It is mostly Layer 2 transparent but has some disadvantages that may hinder network connectivity under certain circumstances (see [[doc: | ||
| + | |||
| + | {{: | ||
| + | |||
| + | All hosts are within the same subnet, W-LAN and LAN are bridged on both the AP and the client router. | ||
| + | For a configuration example of bridged client mode, read the [[doc: | ||
| + | |||
| + | ===== 客户端桥接模式 (使用relayd) ===== | ||
| + | |||
| + | It is possible to achieve a bridge-like client mode setup with the help of //relayd//. | ||
| + | |||
| + | {{: | ||
| + | |||
| + | The setup is explained in the [[doc: | ||
| + | |||
| + | ===== 客户端桥接模式引发的问题 ===== | ||
| + | |||
| + | // | ||
| + | |||
| + | There are 3rd-party patches to implement //ARP-NAT// for platforms other than // | ||
| + | |||
| + | ==== 使用标准客户端模式引发的问题 ==== | ||
| + | {{: | ||
| + | |||
| + | The 802.11 standard only uses three MAC addresses for frames transmitted between the Access Point and the Station. | ||
| + | Frames transmitted from the Station to the AP don't include the ethernet source MAC of the requesting host and response frames are missing the destination ethernet MAC to address the target host behind the client bridge. | ||
| + | |||
| + | - //Bridged Host// sends a packet to the //Target// host | ||
| + | - Frame is relayed via the //W-LAN Client// and the MAC address of the transmitting wireless adapter is used as source MAC, the sending ethernet MAC is discarded | ||
| + | - //W-LAN AP// receives the frame and redirects it to the //Target// | ||
| + | - //Target// receives the frame and generates a response | ||
| + | - //Target// responds to the received frame using the (wrong) source MAC as destination | ||
| + | - //W-LAN AP// relays the frame to the //W-LAN Client// with the given destination MAC | ||
| + | - //W-LAN Client// receives the frame and assumes it is the final destination since it's wireless MAC is used in the frame, the packet is not forwarded | ||
| + | - //Bridged Host// never sees a response frame since the //W-LAN Client// became the destination, | ||
| + | |||
| + | |||
| + | ==== 使用WDS的解决方案 ==== | ||
| + | |||
| + | {{: | ||
| + | |||
| + | If WDS is used, both the AP and the Station switch to the // | ||
| + | |||
| + | - //Bridged Host// sends a packet to the //Target// host | ||
| + | - Frame is relayed via the //W-LAN Client//, the sending ethernet MAC is preserved | ||
| + | - //W-LAN AP// receives the frame and redirects it to the //Target// using the second source MAC as sender address | ||
| + | - //Target// receives the frame and generates a response | ||
| + | - //Target// responds to the received frame using the given source MAC as destination | ||
| + | - //W-LAN AP// relays the frame to the //W-LAN Client// with the right MAC as second destination address | ||
| + | - //W-LAN Client// receives the frame and redirects it to the final destination using the second destination MAC as target | ||
| + | - //Bridged Host// receives the response frame, connection is established | ||
| + | |||
| + | |||
| + | ==== 为什么它能在brcm-2.4上工作 ==== | ||
| + | |||
| + | The proprietary //wl.o// Broadcom wireless driver implements an ARP-NAT (Layer 2 address translation) mechanism called //WET mode//. | ||
| + | ARP-NAT is comparable to // | ||
| + | |||
| + | However, the address translation used by the Broadcom driver is not fully transparent and can cause various hard to debug network issues: | ||
| + | |||
| + | * A host on the AP side may not be able to reach a host on the Station side until the other side made an initial connection attempt | ||
| + | * Layer 3 routing on the Station side using a host behind the AP as gateway is unreliable or does not work at all | ||
| + | * The mapping entries in the ARP-NAT table may time out causing sudden connection loss | ||
| + | * The translation table may run out of space resulting in connection problems for some hosts on the Station side | ||
| + | |||
| + | ===== 桥接/ | ||
| + | |||
| + | :!: FIXME Bridged client mode only works on // | ||
| + | |||
| + | ==== 桥接 ==== | ||
| + | There are no bridged and routed modes on Kamikaze, per se. Instead, multiple interfaces are bridged with an entry in / | ||
| + | |||
| + | | '' | ||
| + | option ' | ||
| + | option ' | ||
| + | *..'' | ||
| + | |||
| + | Then in ''/ | ||
| + | |||
| + | | '' | ||
| + | *.. | ||
| + | |||
| + | config ' | ||
| + | *.. | ||
| + | option ' | ||
| + | |||
| + | Alternatively, | ||
| + | |||
| + | | '' | ||
| + | option ' | ||
| + | |||
| + | ==== 路由 ==== | ||
| + | For routed mode, the wireless device needs to be used in a normal network configuration in / | ||
| + | |||
| + | ===== 网络发现 ===== | ||
| + | Both Broadcom and Atheros chipsets support scanning with the iwlist command. | ||
| + | |||
| + | < | ||
| + | iwlist scanning | ||
| + | </ | ||
| + | |||
| + | ===== 常用命令 ===== | ||
| + | * ifconfig | ||
| + | * iwconfig | ||
| + | * wpa_cli | ||
| + | |||
| + | ===== 小提示 ===== | ||
| + | ==== wpa_supplicant对隐藏AP和虚拟AP(VAP)的处理 ==== | ||
| + | If you're having trouble connecting to either a hidden AP or a virtual AP (usually because wpa_supplicant doesn' | ||
| + | * ap_scan (See the example [[http:// | ||
| + | * 1: wpa_supplicant initiates scanning and AP selection | ||
| + | * 0: driver takes care of scanning, AP selection, and IEEE 802.11 association parameters | ||
| + | * 2: like 0, but associate with APs using security policy and SSID (but not BSSID). | ||
| + | * scan_ssid | ||
| + | * 0: do not scan this SSID with specific Probe Request frames (default) | ||
| + | * 1: scan with SSID-specific Probe Request frames (this can be used to find APs that do not accept broadcast SSID or use multiple SSIDs; this will add latency to scanning, so enable this only when needed) | ||