Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1002238
  • 博文数量: 177
  • 博客积分: 3629
  • 博客等级: 中校
  • 技术积分: 1839
  • 用 户 组: 普通用户
  • 注册时间: 2005-02-23 21:21
文章分类

全部博文(177)

文章存档

2021年(1)

2020年(5)

2019年(4)

2018年(7)

2017年(1)

2016年(4)

2014年(1)

2013年(8)

2012年(10)

2011年(50)

2009年(12)

2008年(10)

2006年(56)

2005年(8)

分类: LINUX

2011-02-24 19:46:40

Wireless Setup (简体中文) From ArchWiki
Jump to: ,

 –  –  –  –  –  –  –  –  –  –  –  –  –  –  –  –  –  –  –  –  –  –  –  –  – 简体中文 –


Contents []
说明

在Arch Linux(或其他Linux发行版)下配置无线网络一般分两步.第一步是识别您的硬件并为您的硬件安装驱动程序,第二步是选择一种方式来管理您的无线连接。这篇文章涵盖了这两方面,并提供了无线管理工具的连接地址。

关于Arch新装系统: 在安装Archlinux时,无线网络驱动和工具已经包含在base-devel 下面.确保为您的无线网卡安装正确的驱动.通常在初始化的光盘系统,和新装的系统一样,Udev会加载合适的驱动,并创建无线网络界面.如果在安装 Archlinux系统的时候没有配置无线网卡,请确保下列所需的软件包已经通过pacman安装完毕,(驱动,必须的固件,无线工 具,等等),并参考以下手册.

Part I: 无线设备驱动 第一步:识别硬件
  1. 检查Linux是否兼容你的硬件.你可以用'hwdetect --show-net' 或者'lshwd',来检测你的无线网卡。
    • 以zd1201为基础的无线卡,像ZyXEL B-220
    • 支持相当多的芯片;详情请点击前边的网址。
    • 支持Atheros的芯片(包括AR5210, AR5211, AR5212 and AR5213)
    • Ralink 的rt2400, rt2500, rt2570等芯片的通用驱动(测试版).
    • 直接从 Ralink 的官方网站下载芯片驱动.
    • 有一些现在仍被维护的Ralink的以前发布的驱动

(这里有一些"老驱动"可能效果不错).

    • 支持 Intel Pro/Wireless 2100 Mini PCI
    • 支持 Intel Pro/Wireless 2200 Mini PCI
    • 支持 Intel Pro/Wireless 3945 AB/G Mini PCI-E
    • orinoco 支持一些基于 Prism 2的网卡。
    • 支持一些基于 Prism 54 的网卡
    • 支持基于Broadcom 43xx 的网卡(老的)。
    • for Broadcom 43xx-based cards
    • 在页面中寻找你的硬件,或者查看在Linux Questions中的 (HCL), 这两个地方也有比较详尽的Linux兼容的硬件列表。
  1. 如果你的硬件只有在windows下的驱动
    • 可以帮助你使用只提供下Windows下驱动的硬件。(一些 Broadcom, 3com, 等的芯片)
    • 你需要从你的Windows驱动下提取用到的.inf文件与.sys文件 -
  2. 如果你的硬件不在上述列表中
    • 想办法在google或者baidu中查找吧,用你硬件的模块名加Linux作为关键词。或者 求助吧
    • 如果还不行,那就可能是你的硬件根本没法在Linux下工作:-( (当然, 这是很罕见的)
安装 如果有线连接已经存在

If you have wired ethernet available, and are simply adding wireless functionality to an existing system, and did not include wireless_tools during initial installation, use pacman to install:

# pacman -S wireless_tools

The drivers' corresponding package names are all highlighted in bold on this page. The packages can be installed during initial package selection on the Arch installation media and can also be installed later with pacman, e.g.:

# pacman -S madwifi
如果只有无线连接

软件包wireless_tools已经放在安装包的base-devel

你必须使用这些用户工具来来启用无线连接,所以你必须从你的安装介质中安装他们(在选择软件包阶段)。特别如果你没有其他方式可以上网的 话,你会在接下来要安装你的Arch System的阶段卡住:你需要这些无线工具和驱动,但是为了获取他们,你还是需要无线工具和驱动。

Wireless Quickstart

The general procedure will be:

  • Identify your interface and appropriate module:
# hwdetect --show-net

or

# lshwd

or

# lspci | grep -i net
  • Ensure the module is loaded with lsmod | grep e.g.:
# lsmod | grep ath
  • Ensure the driver has created a usable interface:
# iwconfig
  • Bring the interface up with ifconfig up. e.g.:
# ifconfig ath0 up
  • (Optional) Scan for available access points:
# iwlist ath0 scan | less
  • Specify the id of the wireless network with iwconfig essid "". Or, if using WEP; iwconfig essid "" key (give the essid (the 'network name') of the network in quotes), e.g.:
# iwconfig ath0 essid "linksys" key 0241baf34c

If your WEP key is ASCII, prefix with s:, e.g.:

# iwconfig ath0 essid linksys key s:mywepkey

对于应用更为广泛的开放式WEP加密,应该是如下命令:

# iwconfig ath0 essid linksys open key s:mywepkey
  • Request an IP address with dhcpcd . e.g.:
# dhcpcd ath0
  • Ensure you can route:
$ ping -c 3

Done.

Refer to to ensure a permanent configuration solution for your system.

If you are using WPA, refer to below.

安装驱动和固件

这里包含如何获取你的网卡驱动的细节。或许你有好几种驱动可以选择,你可以访问来帮助你获取最佳驱动。

wlan-ng pacman -S wlan-ng24 或者 pacman -S wlan-ng26 rt2x00

Ralink 芯片的通用驱动 (替代 rt2500,rt61,rt73 etc). 使用wext驱动程序接口,兼容 wpa_supplicant.这个驱动现在已经集成到 2.6.24内核中。可以用下边的方法手动加载...

modprobe rt2500pci

(用rt2500pci来代替你的硬件,例如rt2400pci, rt2500usb, rt61pci, rt73usb) 有些芯片需要一个firmware文件. 请查看 .

RT2500

对于基于Ralink的PCI/PCMCIA的rt2500系列芯片(Ralink的支持802.11g的第一代芯片):

pacman -S rt2500

支持标准的未加密和WEP的链接的iwconfig工具,尽管它可能对于命令的顺序非常敏感。

在使用标准wext接口时wpa_supplicant是不被支持的。驱动支持WPA(使用硬件加密),但是用的是一种不标准方式。一些主要的wpa_supplicant(0.6.x)版本可能包含对于这个驱动的特殊支持,而且能用iwpriv命令手动链接到WPA

详情请见 。 这对于下面的RT61和RT73一样适用.

RT61

基于PCI/PCMCIA卡的Ralink的后来的802.11g的芯片(包括那些支持转悠的MIMO模式的芯片)。

详见.

RT73

基于USB设备的Ralink的后一代的802.11g的芯片(包括那些支持受限的MIMO模式的)。 详见.

madwifi pacman -S madwifi

这个模块叫做 ath_pci. 为了能够使用所在国家制定的关于channels和transmit power settings, 你可能需要在加载MadWifi驱动的时候添加一个countrycode的配置项. 例如, 在荷兰的时候, 你可能需要用如下的代码来加载MadWifi驱动:

modprobe ath_pci countrycode=528

你可以使用 iwlist 命令来检查你的设置, 可以从 man iwlist 或者 上面得到更多的信息. 为了让系统启动的时候就能够自动应用上那些设置, 可以把它们放到 /etc/modprobe.conf 文件中去:

options ath_pci countrycode=528

注意: 我不得不完全移除那些countrycode的选项否则ath0设备不被创建(andyrtr, kernel 2.6.21)!

ipw2100 与 ipw2200

根据你的芯片型号,执行:

pacman -S ipw2100-fw

或者:

pacman -S ipw2200-fw

然后重新启动来加载驱动。

iwl3945 与 iwl4965

Intel的新 驱动同时支持这两款芯片,该驱动已集成到Linux内核2.6.24以上的内核中。可以用下边的命令轻松安装你的芯片驱动:

pacman -S iwlwifi-3945-ucode

或者:

pacman -S iwlwifi-4965-ucode

如果你的rc.conf中的MOD_AUTOLOAD 设置成了yes(默认就是yes),恭喜你,你的驱动已经安装完毕了. 重新启动并且在终端下运行ifconfig来检查你的驱动是否正常工作了.运行结果中应该包含一个wlan0的项.(译者注:lsmod |grep iwl可以查看驱动是否已经加载了)


如果你喜欢手动加载驱动(就是MOD_AUTOLOAD设成no的情况), 你可以把它加到MODULES 组里边去:

nano /etc/rc.conf

在MODULES=()的列表中添加 iwl3945或者iwl4965, 当然,这取决于你是3945ABG还是4965AGN的网卡

用CTRL + X, Y 退出nano并保存(译者废话两句:当然,你用gedit,kwrite等纯文本编辑器来编辑也完全没问题,但是千万别用windows下的写字板来编辑,这个家伙会把换行'0a'改成'0a 0d'而让你的配置文件坏掉).

这样,重启后就可以自动加载了。在终端中运行'ifconfig'会发现一个名字叫wlan0的新网络接口。


提示:如果iwlwifi驱动经测试没法使用(据译者的测试,iwlwifi就能用),不妨用windows下的NETw4x32驱动配合ndiswrapper来试试,可能会工作得很好。

ipw3945 (不推荐的方法)

注意: ipw3945驱动已经停止开发了. 上边提到的iwlwifi应该工作的很好

你应该安装 ipw3945-ucode, ipw3945, and ipw3945d (daemon).

# pacman -S ipw3945 ipw3945-ucode ipw3945d


为了能够启动的时候正确初始化驱动, 需要修改 /etc/rc.conf 文件(需要root权限)...

nano /etc/rc.conf

在modules=()那一行里面, 把ipw3945添加进去

MODULES=(... mii ipw3945 snd-mixer-oss ...)

在daemons()那一行里面, 把ipw3945d添加进去(ipw3945d必须在network和dhcdbd/networkmanager前面)

DAEMONS=(syslog-ng ipw3945d network ...)

用CTRL + X, Y来保存并退出

在"Loading Modules..."阶段ipw3945模块应该被加载进来, 并且在daemon初始化的时候, 你应该可以看到"Starting IPW3945d"之类的字样, 而且ehtX接口也应该存在了

更新: 在某人的HP nc6320机器上, 除非卸载了ipw3945这个模块, 否则蓝牙是无法连接的.

orinoco

这应当是内核的一部分,是已经被安装的。

ndiswrapper

Ndiswrapper并不是一个真正的驱动,但是如果你无法找到适合你的无线网卡驱动的适合, 它就派上用场了.有的时候, 它是非常有用的.为了使用Ndiswrapper, 你需要Windows驱动中的*.inf文件(*.sys文件应该和*.info在同一个目录中).下面是安装ndiswrapper的几个步骤:

用pacman来安装ndiswrapper:

pacman -S ndiswrapper ndiswrapper-utils

注意: 较早版本的内核需要安装的是ndiswrapper-beyond,而不是ndiswrapper!

注意: 如果你的Arch无法联网的话, 可以从下 载ndiswrapper到本地硬盘来进行安装.需要下载的是ndiswrapper(或者ndiswrapper-beyond)和 ndiswrapper-utils软件包.你也能也需要下载最新的内核kernel26(或者更早版本的内核),因为CD上面提供的内核版本可能不是最 新的.

一旦安装好了ndiswrapper,就要开始配置的步骤了.

ndiswrapper -i filename.inf
ndiswrapper -l
ndiswrapper -m
depmod -a

现在基本上就要安装完ndiswrapper了; 剩下的工作就是更新一下/ect/rc.conf文件去设置当启动的时候加载这个模块(下面是一个简单的例子, 你的可能有些区别的):

MODULES=(ndiswrapper snd-intel8x0 !usbserial)

最主要的是要把ndiswrapper加到MODULES这一行里面去. 最好通过如下的命令测试一下ndiswrapper是否已经加载了:

modprobe ndiswrapper
iwconfig

如果正常的话, 你应该可以看到wlan0接口了. 如果有问题的话, 你可以从 上面得到更多的信息.

prism54

从下载与你的网卡匹配的固件驱动。将文件重命名为'isl3890'。如果不存在/lib/firmware那么创建之,然后将'isl3890'放进去。这应该有效。()

ACX100/111

从[unstable]库中下载并安装'tiacx'包。

pacman -S tiacx

注意:如果你发现kernel log中全是关于驱动的废话,很有可能是以为你正同时运行着Kismet和channel-hopping,你应当在/etc/modprobe.conf中添加

options acx debug=0
BCM43XX

Broadcom 43xx系列芯片的使用者有一种使用ndiswrapper的方法。 在2.6.17以上的内核中最好使用bcm43xx驱动.

  1. 运行 iwconfig 或者 hwd -s 来检查你是否有一个合适的网卡。我运行hwd -s的输出结果如下Network  : Broadcom Corp.|BCM94306 802.11g NIC module: unknown查看哪种支持设备,请看 here.
  2. 运行pacman -S bcm43xx-fwcutter 安装firmware cutter application.
  3. 下载网卡的windows 驱动,要从中解压出 firmware.
  4. 如果是从戴尔官网下载,需要在windows或者wine下运行,(因为下载的是.exe文件,点击安装会自动解压到C:\Dell\[driver numbers])) 或者可以尝试这两个 或者. 只要把下载到的文件保存到桌面,这样就不需要上面一步了。
  5. 运行 bcm43xx-fwcutter -w /lib/firmware /home//Desktop/wl_apsta.o 需要在运行之前新建文件夹 /lib/firmware 。
  6. 重启,确认运行正常。 把 bcm43xx 加入到rc.conf的 modules section里。 Good luck!
b43

相对于bcm43xx,这驱动相对较好解决,而且驱动已经包含在2.6.24及以上的内核中了.

  1. 运行 lspci 来检验你是否有一块合适的网卡。比如输出的结果如下: 0c:00.0 Network controller: Broadcom Corporation BCM4311 802.11b/g WLAN (rev 01)被支持的设备列表见这里.

接下来有两种办法,任选一种:第一种是直接在从 安装"b43-firmware"包。第二种办法就是按下面的来做

  1. 安装固件驱动。名字是b43-fwcutter。
  2. 下载Broadcom的4.150.10.5版本的受限制的驱动:wget
  3. 解压缩.tar xjf broadcom-wl-4.150.10.5.tar.bz2
  4. 从当前目录进入刚建立的目录: cd broadcom-wl-4.150.10.5/driver
  5. 如果你没有/lib/firmware目录那么就建立一个,然后运行 b43-fwcutter -w "/lib/firmware/" wl_apsta_mimo.o
  6. 将你的设备正确配置一下,然后重启。把b43加入配置文件/etc/rc.conf的modules段!MODULES=(...b43 !bcm43xx...)
broadcom-wl

如果现有的bcm43xx或者b43不能驱动您的broadcom 43xx无线网卡. 不仅仅是指bcm4312. 请参考.而且可以在上可以找到相应的软件包.这些芯片通常被用于Dell等笔记本平台.

rtl8187

参见.

zd1211rw 是ZyDAS ZD1211 802.11b/g USB WLAN芯片的驱动,最近的版本的内核已经包括了。[3]有被支持的设备列表。 你只需要这样安装固件驱动: pacman -S zd1211-firmware Part II: 无线网络管理

为了管理已经安装好的无线驱动,并且使无线能正常工作,需要安装一个无线连接管理工具。下面章节将帮助您确定一个最佳管理方法。

过程和需要使用的工具,将依赖于下面几个因素:

  • The easiness of configuration management, from a completely manual setup procedure that you’ll need to repeat at each boot to a software-managed, automatic, autostarting solution
  • The encryption type (or not) that protects the wireless network
  • 是否需要network profiles,比如,如果你需要经常切换不同网络(比如手提电脑)。
Encryption types WEP

The Wired Equivalent Privacy encryption scheme was introduced in 1997. But the discovery of weaknesses in the WEP algorithm in 2001 have made it a poor choice of wireless security protocol. Some tools, such as aircrack, can break the WEP protection in a couple of seconds. Despite this issue, WEP is still popular and the default encryption scheme in many commercial wireless routers.

WPA/WPA2

The Wi-Fi Protected Access security protocol was created in response to the WEP weaknesses. WPA and especially WPA2, which uses the AES encryption algorithm, are considered secure. Wi-Fi certified devices must now provide WPA2. Several modes of authentication are supported by WPA/WPA2: a PSK mode (Pre-Shared Key) designed for home and small office use, and an Enterprise (EAP) mode, which requires an authentication server. The following instructions will only cover the PSK method.

管理方法选择

This table shows the different methods that can be used to activate and manage a wireless network connection, depending on the encryption and management types, and the various tools that are required. 虽然还有其他办法,但这通常是最常使用的:

管理方法 No encryption/WEP WPA/WPA2 PSK
手动, 需要每次系统启动重做一次 ifconfig + iwconfig + dhcpcd/ifconfig ifconfig + iwconfig + wpa_supplicant + dhcpcd/ifconfig
自动管理, centralized without network profile support define interface in /etc/rc.conf not covered
自动管理, with network profiles support Netcfg, wicd, NetworkManager, etc…


无论选的那个方案,最好先尝试手动方法。这将有助于您了解不同步骤的意义,并在出问题时解决之。 Another tip: if possible (e.g. if you admin your wifi access point), try connecting with no encryption, to check everything works. Then try using encryption, either WEP (simpler to configure) or WPA.

手动方式

软件包 wireless_tools 提供的程序是建立一个无线连接的基础工具。如果你需要使用WPA/WPA2 encryption, 您还需要软件包wpa_supplicant。 These powerful userspace console tools work extremely well and allow complete, manual control from the shell.

These examples assume your wireless device is wlan0. Replace wlan0 with the appropriate device name.

Note: Depending on your hardware and encryption type, some of these steps may not be necessary. Some cards are known to require interface activation and/or access point scanning before being associated to an access point and being given an IP address. Some experimentation may be required. For instance, WPA/WPA2 users may directly try to activate their wireless network from step 3.

1. (可选,可能需要) 一些无线网卡在使用wireless_tools前需要激活kernel interface:

# ifconfig wlan0 up

2. (可选,可能需要) See what access points are available:

# iwlist wlan0 scan

We assume you want to use the essid named MyEssid.

3. Depending on the encryption, you need to associate your wireless device with the access point to use and pass the encryption key.

  • No encryption
# iwconfig wlan0 essid "MyEssid"
  • WEP

using an hexadecimal key:

# iwconfig wlan0 essid "MyEssid" key 1234567890

using an ascii key:

# iwconfig wlan0 essid "MyEssid" key s:asciikey
  • WPA/WPA2

You need to edit the /etc/wpa_supplicant.conf file as described in . Then, issue this command:

# wpa_supplicant -B -Dwext -i wlan0 -c /etc/wpa_supplicant.conf

This is assuming your device uses the wext driver. If this does not work, you may need to adjust these options. Check for more information and troubleshooting.

4. Finally, provide an IP address to the network interface. Simple examples are:

# dhcpcd wlan0

for DHCP, or

# ifconfig wlan0 192.168.0.2
# route add default gw 192.168.0.1

for static IP.

Note: Although the manual configuration method will help troubleshoot wireless problems, you will have to retype every command each time you reboot.
集中自动管理,但没有network profile支持
Note: This method and configuration examples are only valid for unencrypted or WEP-encrypted networks, which are particularly unsecure. To use WPA/WPA2, you'll need to use other solutions like using manually or network managers, such as or . Also, avoid mixing these methods as they may create a conflict and prevent the wireless card from functioning.
  • /etc/rc.conf文件中的网络部分是“网络脚本”的配置文件。因此,你可以利用/etc/rc.conf这个文件定义并配置一个简单的无线连接, wlan_=" essid " and INTERFACES=( ). 网络名称替换MyEssid。例如:

For example:

# /etc/rc.conf
eth0="dhcp"
wlan0="dhcp"
wlan_wlan0="wlan0 essid MyEssid" # Unencrypted
#wlan_wlan0="wlan0 essid MyEssid key 1234567890" # hex WEP key
#wlan_wlan0="wlan0 essid MyEssid key s:asciikey" # ascii WEP key
INTERFACES=(eth0 wlan0)

并不是所有的无线网卡都是wlan0. 你可以用ifconfig -a来查看你的网络接口。举个例子:如果你的无线网络接口是ath0的话,你就应该把wlan_wlan0 改成wlan_ath0:

wlan_ath0="ath0 essid MyEssid key 12345678"

把ath0加入INTERFACES= 行,替换wlan0.)

  • 当然,你也可以在/etc/conf.d/wireless中设置你的无线网络(这个文件也是“网络脚本”的配置文件), 举个例子:
# /etc/conf.d/wireless
wlan_wlan0="wlan0 essid MyEssid"
Note: 这方法的局限:对经常变换网络的手提电脑来说,最好还是使用多个,这样能够很容易地切换网络。就是这种方式的一种。
自动管理,并使用网络管理工具 Netcfg2

provides a versatile, robust and fast solution to networking on Arch.

It uses a profile based setup and is capable of detection and connection to a wide range of network types. This is no harder than using graphical tools. Following the directions above, you can get a list of wireless networks. Then, as with graphical tools, you will need a password.

Occasionally, you have to properly at first, if you want to use an encrypted wireless connection (eg: wep, wpa, wpa2, etc.) in netcfg, because netcfg package depends on wpa_supplicant.

详细文档: 开发中版本的详细文档: Network Profiles development

下面还有一系列的替代方案:

wireless-tools

这些强大的控制台工具十分有效而且能够实现完全的、手工的控制。这些例子假设你的无线设备是wlan0。将wlan0换成你自己的设备名称。 很多网卡需要你的核心接口是打开的,这样你才能使用无线工具:

ifconfig wlan0 up

扫描可用接入口:

iwlist wlan0 scan

利用扫描结果,告诉你的无线设备去用哪一个接入口。例如:

iwconfig wlan0 essid linksys

然后像平时一样设置网络接口。简单的例子如下:

dhcpcd wlan0

或者

ifconfig wlan0 192.168.0.2
route add default gw 192.168.0.1
NetworkManager

除了能管理有限链接,NetworkManager还提供了一个易于使用的图形界面程序来选择你想要的的无线移动链接。

详情请见 。

Wicd

Wicd 是一个网络管理工具,能够同时管理无线和有线连接。程序是用Python 和 Gtk写的,比NetworkManager对依赖的要求 更少, 非常适合轻量级桌面用户。 Wicd 现在已经被放在extra里面,有适合 i686和x86_64的版本。

想了解更多,请阅读 的wiki.

Autowifi

Autowifi is a daemon that configures your wireless network automatically depending on the ESSID. Once configured, no user interaction is necessary and no GUI tools are required.

For more information, see the wiki.

Wifi Radar

WiFi Radar是一个Python/PyGTK2的管理无线配置的程序(只有无线的)。它能够扫描可用的网络、为你所选择的网络创建新的配置。

详情请见。

Wlassistant

Wlassistant是一个非常简单直观的图形界面无线网连接管理程序。 安装方法如下:

pacman -S wlassistant

Wlassistant必须以root权限运行:

sudo wlassistant

一种使用wlassistant管理/etc/rc.conf里面有的无线网卡的方法是指出你经常使用的链连接点。开机后你的网卡就会自动连接到这 个essid,但是如果其他的无线网络是需要的/可用的,wlassistant在那时会请求连入它们。通过在名称前加一个@来后台运行/etc /rc.conf中的network守护程序来减少开机等待时间。

其他资源
  • - NetworkManager官方网站
  • - WICD官方网站
  • Wifi Radar - Wifi Radar官方网站
阅读(7957) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~