Handbook:Parts/Networking/Wireless/zh-cn

介绍
Linux 上的无线网络通常非常简单. 有三种方式来配置 WiFi ：图形客户端、文本模式和命令行.

最简单的方法是在安装桌面环境后使用图形客户端. 大多数图形客户端，例如NetworkManager 都无需多说. 他们都提供了很方便地让用户点击的界面，只需几秒钟即可使用户连接网络.

也可以通过编辑一些配置文件从命令行配置无线网络. 这需要更多的时间来设置，但它仅需下载和安装少量的包. 由于图形客户端的使用方法大多是不言自明的（在其主页上有有用的屏幕截图），因此我们将重点介绍命令行替代方案.

There are three tools that support command-line driven wireless configurations:, , and. Of these three, is the preferred one. The important thing to remember is that wireless networks are configured on a global basis and not an interface basis.

The software, the successor of, supports nearly all cards and drivers, but it cannot connect to WPA-only Access Points. If the networks only offer WEP encryption or are completely open, then beats the other package over simplicity.

Some wireless cards are deactivated by default. To activate them, please consult the hardware documentation. Some of these cards can be unblocked using the application. If that is the case, use to see the available cards and  to activate the wireless functionality. If not, then the wireless card might need to be unlocked through a button, switch or special key combination on the laptop.

WPA supplicant
WPA supplicant project 提供了一个软件包允许用户连接到 WPA 认证的接入点.

Next, configure so that the wpa_supplicant module is preferred over wireless-tools (if both are installed, wireless-tools is the default).

Next configure wpa_supplicant itself (which is a bit more tricky depending on how secure the Access Points are). The below example is taken and simplified from which ships with wpa_supplicant.

Initial setup and managed mode
The wireless tools project provides a generic way to configure basic wireless interfaces up to the WEP security level. While WEP is a weak security method it's still prevalent in the world.

Wireless tools configuration is controlled by a few main variables. The sample configuration file below should describe all that is needed. One thing to bear in mind is that no configuration means "connect to the strongest unencrypted Access Point" - wireless tools will always try and connect the system to something.

Fine-tune AP selection
It is possible to add some extra options to fine-tune the AP selection, but these are not required.

One way is to configure the system so it only connects to preferred APs. By default if everything configured has failed and wireless-tools can connect to an unencrypted Access Point then it will. This can be controlled by the associate_order variable. Here's a table of values and how they control this.

There is also the blacklist_aps and unique_ap selection. blacklist_aps works in a similar way to preferred_aps. unique_ap is a yes or no value that says if a second wireless interface can connect to the same Access Point as the first interface.

Ad-hoc and master modes
To set the system up as an ad-hoc node when it fails to connect to any Access Point in managed mode, use this as a fallback:

It is also possible to connect to ad-hoc networks, or to run the system in master mode so it becomes an access point itself.

Troubleshooting wireless tools
There are some more variables that can help to get the wireless up and running due to driver or environment problems. Here's a table of other things that can be tried.

Defining network configuration per ESSID
In this section, we show how to configure network settings based on the ESSID. For instance, with the wireless network with ESSID ESSID1 configure a static IP address while ESSID ESSID2 uses DHCP.