centos 无线网卡配置
自己有台不常用的笔记本,是centos系统,一次不小心按了Fn,结果就没有网络了,后来是各种折腾,终于搞定,留个笔记。
1、查看驱动是否还在
$ lspci | grep Network
07:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8188CE 802.11b/g/n WiFi Adapter (rev 01)
如果出现网卡信息,就是驱动正常,配置错误
2、查看网卡状态
$ ifconfig wlan0
wlan0 Link encap:Ethernet HWaddr 7c:4f:b5:73:b4:be
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
$ iwconfig wlan0
wlan0 IEEE 802.11bgn ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=20 dBm
Retry long limit:7 RTS thr=2347 B Fragment thr:off
Power Management:off
tips 如果Tx-Power = off 需要 开启无线网卡电源
iwconfig wlan0 txpower on
3、扫描网络
$ sudo iwlist wlan0 scan
wlan0 Scan completed :
Edited to only show the relevant network
Cell 04 - Address: 00:16:01:12:E7:5E
Channel:6
Frequency:2.437 GHz (Channel 6)
Quality=64/70 Signal level=-46 dBm
Encryption key:off
ESSID:"aprk"
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 18 Mb/s
24 Mb/s; 36 Mb/s; 54 Mb/s
Bit Rates:6 Mb/s; 9 Mb/s; 12 Mb/s; 48 Mb/s
Mode:Master
Extra:tsf=00000000b6d6419d
Extra: Last beacon: 224ms ago
IE: Unknown: 0009666F6F626172776562
IE: Unknown: 010882848B962430486C
IE: Unknown: 030106
IE: Unknown: 2A0102
IE: Unknown: 2F0102
IE: Unknown: 32040C121860
IE: Unknown: DD090010180201F0000000
IE: Unknown: DD180050F2020101800003A4000027A4000042435E0062322F00
4、设置网络
$ sudo iwconfig wlan0 essid "aprk"
查看ssid设置是否成功
wlan0 IEEE 802.11bgn ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=20 dBm
Retry long limit:7 RTS thr=2347 B Fragment thr:off
Encryption key:off
Power Management:off
设置失败,这个地方反复出现问题,尝试添加参数
sudo iwconfig wlan0 key open mode Managed essid "aprk" channel 6
查看ssid设置是否成功
$ sudo iwconfig wlan0 # check to see if settings took hold this time
wlan0 IEEE 802.11bgn ESSID:"aprk"
Mode:Managed Frequency:2.437 GHz Access Point: Not-Associated
Tx-Power=20 dBm
Retry long limit:7 RTS thr=2347 B Fragment thr:off
Encryption key:off
Power Management:off
network默认支持wep加密,建议先设置无需密码,以后在重新添加
5、启用dhcp,获取ip并连接
$ sudo dhclient -v wlan0
Internet Systems Consortium DHCP Client 4.1.1-P1
Copyright 2004-2010 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/wlan0/7c:4f:b5:73:b4:be
Sending on LPF/wlan0/7c:4f:b5:73:b4:be
Sending on Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 6
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 11
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 17
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 15
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 9
No DHCPOFFERS received.
No working leases in persistent database - sleeping.
6、联网成功
安装networkmanager,这个可以有图形界面,不用在以来命令行折腾
$ sudo yum install NetworkManager NetworkManager-gnome #这里根据自己的桌面环境自己调整
7、最后
路由器给wifi加上密码,电脑reboot,之后就会出现网络设置图标,搞定!