Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2539810
  • 博文数量: 351
  • 博客积分: 76
  • 博客等级: 上将
  • 技术积分: 3555
  • 用 户 组: 普通用户
  • 注册时间: 2004-11-13 21:27
文章分类

全部博文(351)

文章存档

2013年(1)

2012年(4)

2011年(7)

2010年(16)

2009年(34)

2008年(34)

2007年(34)

2006年(68)

2005年(82)

2004年(71)

分类: 系统运维

2009-01-31 18:09:00

手头有一块无线网卡,升级到ubuntu8.04之后就再没试过,今天心血来潮又尝试了一下,总算是成功了,特此记录如下。

环境

操作系统:ubuntu 8.04.1
型号:TP-LINK TL-WN510G
芯片: Atheros Communications Inc. AR2413 802.11bg NIC (rev 01)
速率:54Mbps
支持协议:802.11g


1.插入无线网卡
查看一下网络设置,看看是否多出来了两个设备

jim@jim-laptop:~$ ifconfig
ath0 Link encap:以太网 硬件地址 00:19:e0:85:73:70
inet 地址:192.168.1.104 广播:255.255.255.255 掩码:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 跃点数:1
接收数据包:953 错误:0 丢弃:0 过载:0 帧数:0
发送数据包:1159 错误:0 丢弃:0 过载:0 载波:0
碰撞:0 发送队列长度:0
接收字节:602879 (588.7 KB) 发送字节:282563 (275.9 KB)
wifi0 Link encap:未指定 硬件地址 00-19-E0-85-73-70-00-00-00-00-00-00-00-00-00-00
UP BROADCAST RUNNING MULTICAST MTU:1500 跃点数:1
接收数据包:18704 错误:0 丢弃:0 过载:0 帧数:7185
发送数据包:2060 错误:6 丢弃:0 过载:0 载波:0
碰撞:0 发送队列长度:199
接收字节:2828917 (2.6 MB) 发送字节:351821 (343.5 KB)
中断:18

只要看见ath0就说明网卡设备设别出来了,ath0就是无线网卡设备的名字了,至于那个wifi0是个什么东东,不好意思,本人才疏学浅不知道。

2.确认无线网卡的型号

jim@jim-laptop:~$ lspci
......
0b:00.0 Ethernet controller: Atheros Communications Inc. AR2413 802.11bg NIC (rev 01)

上面的 Atheros Communications Inc. AR2413 802.11bg NIC 就是无线网卡芯片的型号了,其中 Atheros是芯片制造商的名字。

3.打开无线网卡电源

jim@jim-laptop:~$ sudo iwconfig ath0 txpower on
jim@jim-laptop:~$


4.检索区域内的无线网络

jim@jim-laptop:~$ iwlist ath0 scan
ath0 Scan completed :
Cell 01 - Address: 00:1D:0F:4D:8B:E4
ESSID:"TP-LINK"
Mode:Master
Frequency:2.437 GHz (Channel 6)
Quality=28/70 Signal level=-67 dBm Noise level=-95 dBm
Encryption key:off
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
12 Mb/s; 24 Mb/s; 36 Mb/s; 9 Mb/s; 18 Mb/s
48 Mb/s; 54 Mb/s
Extra:bcn_int=100
Extra:ath_ie=dd0900037f01010008ff7f
Cell 02 - Address: 00:21:27:3A:37:0A
ESSID:"TP-LINK"
Mode:Master
Frequency:2.437 GHz (Channel 6)
Quality=12/70 Signal level=-83 dBm Noise level=-95 dBm
Encryption key:on
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
12 Mb/s; 24 Mb/s; 36 Mb/s; 9 Mb/s; 18 Mb/s
48 Mb/s; 54 Mb/s
Extra:bcn_int=100
Extra:ath_ie=dd0900037f01010008ff7f
Cell 03 - Address: 00:18:39:A6:98:E2
ESSID:"linksys"
Mode:Master
Frequency:2.437 GHz (Channel 6)
Quality=3/70 Signal level=-92 dBm Noise level=-95 dBm
Encryption key:on
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s
48 Mb/s; 54 Mb/s
Extra:bcn_int=100
IE: WPA Version 1
Group Cipher : CCMP
Pairwise Ciphers (1) : CCMP
Authentication Suites (1) : PSK

我附近有三个无线AP,ESSID所标记的就是无线AP的名字了,其中有两个无线AP都叫做 TP-LINK,另一个叫linksys,记下这几个无线AP的名字,一会得挨个试。

5.连接无线AP

jim@jim-laptop:~$ sudo iwconfig ath0 essid "linksys"
jim@jim-laptop:~$ ifconfig

不管连上还是连不上都不会给出任何提示,到底连没连上还需要使用命令查看一下才行

ath0 IEEE 802.11g ESSID:"linksys" Nickname:""
Mode:Managed Frequency:2.462 GHz Access Point: Not-Associated
Bit Rate:0 kb/s Tx-Power:18 dBm Sensitivity=1/1
Retry:off RTS thr:off Fragment thr:off
Power Management:off
Link Quality=0/70 Signal level=-95 dBm Noise level=-95 dBm
Rx invalid nwid:8172 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0


上面的黑体字的部分说明没有连接成功,也许是这个AP设置了密码,没关系再换一个就是了。

jim@jim-laptop:~$ sudo iwconfig ath0 essid "TP-LINK"
jim@jim-laptop:~$ ifconfig

执行后再查看一下接入状态

jim@jim-laptop:~$ iwconfig ath0
ath0 IEEE 802.11g ESSID:"TP-LINK" Nickname:""
Mode:Managed Frequency:2.437 GHz Access Point: 00:1D:0F:4D:8B:E4
Bit Rate:36 Mb/s Tx-Power:18 dBm Sensitivity=1/1
Retry:off RTS thr:off Fragment thr:off
Power Management:off
Link Quality=26/70 Signal level=-69 dBm Noise level=-95 dBm
Rx invalid nwid:8268 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

ok,总算是连上了。

注意:如果连接AP需要密码,而你确实也知道AP的密码,那么可以用下面的办法连接
假设密码是 123456789,密码需要四位一组用”-“分开。


jim@jim-laptop:~$ sudo iwconfig ath0 essid "TP-LINK" key 1234-5678-9


6.启用无线网卡

jim@jim-laptop:~$ sudo ifconfig ath0 up


7.设置无线网卡采用dhcp方式自动获取ip

jim@jim-laptop:~$ sudo dhclient ath0
Internet Systems Consortium DHCP Client V3.0.6
Copyright 2004-2007 Internet Systems Consortium.
All rights reserved.
For info, please visit

wifi0: unknown hardware address type 801
wifi0: unknown hardware address type 801
Listening on LPF/ath0/00:19:e0:85:73:70
Sending on LPF/ath0/00:19:e0:85:73:70
Sending on Socket/fallback
DHCPDISCOVER on ath0 to 255.255.255.255 port 67 interval 6
DHCPOFFER of 192.168.1.104 from 192.168.1.1
DHCPREQUEST of 192.168.1.104 on ath0 to 255.255.255.255 port 67
DHCPACK of 192.168.1.104 from 192.168.1.1
bound to 192.168.1.104 -- renewal in 3125 seconds.


现在就可以拔掉网线,使用无线网卡上网了。

8.断开网络
如果需要断开网络,可以使用下面的命令

jim@jim-laptop:~$ sudo ifconfig ath0 down
阅读(13972) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~