分享

CentOS安装和配置无线网卡及通过本地代理上网介绍

pig2 发表于 2014-4-16 09:52:34 [显示全部楼层] 只看大图 回帖奖励 阅读模式 关闭右栏 1 18515
导读
我们安装一个软件可能为什么需要指导:
1.不知道步骤?
2.里面的细节不太明白?
3.一些需要注意的地方,没有修改?
同样,CentOS的相关设置亦是如此。下面看一下无线网卡及本地代理上网设置








CentOS安装和配置无线网卡


CentOS安装和配置无线网卡主要分几步:
1.下载无线网卡驱动程序;
2.安装无线网卡驱动程序;
3.配置无线拨号配置文件;
4.注意事项。

首先CentOS安装无线网卡

1,到http://snapshots.madwifi-project.org/madwifi-hal-0.10.5.6下载最新的madwifi- hal-0.10.5.6文件,如madwifi-hal-0.10.5.6-r4016-20090429.tar.gz;
2,解压后.gz文件后用make && make install编译安装,最好从新启动一下系统;
3,确保下列类似信息的存在:[simonsun@magic ~]$ /sbin/lspci | grep Ethernet

  1. 02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 02)  
  2. 06:00.0 Ethernet controller: Atheros Communications Inc. AR242x 802.11abg Wireless PCI Express Adapter (rev 01)  
  3. [simonsun@magic ~]$ dmesg | grep "HAL"  
  4. [simonsun@magic ~]$ /sbin/lsmod | grep ath  
  5. dm_multipath 240130   
  6. scsi_dh117131 dm_multipath  
  7. ath_rate_sample162561   
  8. ath_pci 2308440   
  9. wlan2037605 wlan_tkip,wlan_scan_sta,ath_rate_sample,ath_pci  
  10. ath_hal 3056323 ath_rate_sample,ath_pci  
  11. dm_mod 6220111 dm_multipath,dm_raid45,dm_snapshot,dm_zero,dm_mirror,dm_log  
  12. [simonsun@magic ~]$/sbin/iwlist  
  13. Usage: iwlist [interface] scanning  
  14. [interface] frequency  
  15. [interface] channel  
  16. [interface] bitrate  
  17. [interface] rate  
  18. [interface] encryption  
  19. [interface] key  
  20. [interface] power  
  21. [interface] txpower  
  22. [interface] retry  
  23. [interface] ap  
  24. [interface] accesspoints  
  25. [interface] peers  
  26. [interface] event  
  27. [simonsun@magic ~][        DISCUZ_CODE_9        ]nbsp;
复制代码

即:网卡是否检测到、网卡驱动是否被系统识别、是否有错误信息等。

CentOS安装好之后,然后开始搜寻无线网络,如

  1. [simonsun@magic ~]$ /sbin/iwlist ath0 scan  
  2. ath0Scan completed :  
  3. Cell 01 - Address: 08:10:74:2B:C3:90  
  4. ESSID:"NETCORE"  
  5. Mode:Master  
  6. Frequency:2.437 GHz (Channel 6)  
  7. Quality=46/70Signal level=-49 dBmNoise level=-95 dBm  
  8. Encryption key:on  
  9. Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s  
  10. 9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s  
  11. 48 Mb/s; 54 Mb/s  
  12. Extra:bcn_int=100
  13. IE: WPA Version 1  
  14. Group Cipher : TKIP   
  15. Pairwise Ciphers (1) : TKIP   
  16. Authentication Suites (1) : PSK  
  17. Cell 02 - Address: 00:22:B0:91:5B:D1  
  18. ESSID:"dlink-starsing"  
  19. Mode:Master  
  20. Frequency:2.417 GHz (Channel 2)  
  21. Quality=23/70Signal level=-72 dBmNoise level=-95 dBm  
  22. Encryption key:on  
  23. Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s  
  24. 9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s  
  25. 48 Mb/s; 54 Mb/s  
  26. Extra:bcn_int=100
  27. IE: IEEE 802.11i/WPA2 Version 1  
  28. Group Cipher : TKIP   
  29. Pairwise Ciphers (2) : CCMP TKIP   
  30. Authentication Suites (1) : PSK  
  31. IE: WPA Version 1  
  32. Group Cipher : TKIP   
  33. Pairwise Ciphers (2) : CCMP TKIP   
  34. Authentication Suites (1) : PSK  
  35. Extra:ath_ie=dd0900037f01010060ff7f
  36. Cell 03 - Address: 00:19:E0:AD:B1:5E  
  37. ESSID:"TP-LINK"  
  38. Mode:Master  
  39. Frequency:2.437 GHz (Channel 6)  
  40. Quality=17/70Signal level=-78 dBmNoise level=-95 dBm  
  41. Encryption key:on  
  42. Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s  
  43. 12 Mb/s; 24 Mb/s; 36 Mb/s; 9 Mb/s; 18 Mb/s  
  44. 48 Mb/s; 54 Mb/s  
  45. Extra:bcn_int=100
  46. Extra:ath_ie=dd0900037f01010008ff7f
  47. Cell 04 - Address: 00:21:27:BA:63:A2  
  48. ESSID:"TP-LINK_BA63A0"  
  49. Mode:Master  
  50. Frequency:2.437 GHz (Channel 6)  
  51. Quality=12/70Signal level=-83 dBmNoise level=-95 dBm  
  52. Encryption key:off  
  53. Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s  
  54. 9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s; 36 Mb/s  
  55. 48 Mb/s; 54 Mb/s  
  56. Extra:bcn_int=100
  57. Extra:wme_ie=dd180050f2020101030003a4000027a4000042435e0062322f00
  58. Extra:ath_ie=dd0900037f01010000ff7f
  59. Cell 05 - Address: 00:B0:0C:04:C4:D2  
  60. ESSID:"TENDA"  
  61. Mode:Master  
  62. Frequency:2.452 GHz (Channel 9)  
  63. Quality=15/70Signal level=-80 dBmNoise level=-95 dBm  
  64. Encryption key:on  
  65. Bit Rates:6 Mb/s; 9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s  
  66. 36 Mb/s; 48 Mb/s; 54 Mb/s  
  67. Extra:bcn_int=100
  68. Cell 06 - Address: 00:23:CD:36:D3:C4  
  69. ESSID:"TP-LINK_36D3C4"  
  70. Mode:Master  
  71. Frequency:2.437 GHz (Channel 6)  
  72. Quality=11/70Signal level=-84 dBmNoise level=-95 dBm  
  73. Encryption key:off  
  74. Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s  
  75. 12 Mb/s; 24 Mb/s; 36 Mb/s; 9 Mb/s; 18 Mb/s  
  76. 48 Mb/s; 54 Mb/s  
  77. Extra:bcn_int=100
  78. Extra:ath_ie=dd0900037f01010008ff7f
  79. Cell 07 - Address: 00:B0:0C:03:B0:64  
  80. ESSID:"Tenda"  
  81. Mode:Master  
  82. Frequency:2.437 GHz (Channel 6)  
  83. Quality=17/70Signal level=-78 dBmNoise level=-95 dBm  
  84. Encryption key:on  
  85. Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 9 Mb/s  
  86. 18 Mb/s; 36 Mb/s; 54 Mb/s; 6 Mb/s; 12 Mb/s  
  87. 24 Mb/s; 48 Mb/s  
  88. Extra:bcn_int=100
  89. Extra:wme_ie=dd180050f2020101000003a4000027a4000042435e0062322f00
  90. Cell 08 - Address: 00:1B:11:8C:3B:8C  
  91. ESSID:"dlink"  
  92. Mode:Master  
  93. Frequency:2.462 GHz (Channel 11)  
  94. Quality=7/70Signal level=-88 dBmNoise level=-95 dBm  
  95. Encryption key:on  
  96. Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s  
  97. 9 Mb/s; 12 Mb/s; 48 Mb/s; 18 Mb/s; 24 Mb/s  
  98. 36 Mb/s; 54 Mb/s  
  99. Extra:bcn_int=100
复制代码

根据实际情况编辑如下文件,或者通过system-config-network的图形化界面配置
  1. [simonsun@magic ~]$ sudo vim /etc/sysconfig/network-scripts/ifcfg-ath0  
  2. # Atheros Communications Inc. AR242x 802.11abg Wireless PCI Express Adapter  
  3. DEVICE=ath0
  4. BOOTPROTO=none
  5. ONBOOT=no
  6. HWADDR=00:22:43:2d:ae:2b  
  7. NETMASK=255.255.255.0  
  8. DHCP_HOSTNAME=  
  9. IPADDR=192.168.0.152  
  10. DOMAIN=  
  11. TYPE=Wireless  
  12. ESSID=NETCORE
  13. CHANNEL=  
  14. MODE=Managed  
  15. SECURITYMODE=off
  16. RATE=auto
  17. USERCTL=no
  18. IPV6INIT=no
  19. PEERDNS=yes
  20. GATEWAY=192.168.0.1
复制代码

配好会有:
  1. [simonsun@magic ~]$ /sbin/iwconfig ath0  
  2. ath0IEEE 802.11gESSID:"NETCORE"Nickname:"magic.linux"  
  3. Mode:ManagedFrequency:2.437 GHzAccess Point: 08:10:74:2B:C3:90   
  4. Bit Rate:48 Mb/s Tx-Power:17 dBm Sensitivity=1/1  
  5. Retry:off RTS thr:off Fragment thr:off  
  6. Power Management:off  
  7. Link Quality=48/70Signal level=-48 dBmNoise level=-96 dBm  
  8. Rx invalid nwid:38122Rx invalid crypt:0Rx invalid frag:0  
  9. Tx excessive retries:0Invalid misc:0 Missed beacon:0
复制代码

最后,激活配置好的无线网卡
  1. [simonsun@magic ~]$ sudo /sbin/ifconfig ath0 up  
  2. [simonsun@magic ~]$ sudo /sbin/ifup ath0  
  3. [simonsun@magic ~]$/sbin/ifconfig ath0  
  4. ath0Link encap:EthernetHWaddr 00:22:43:2D:AE:2B  
  5. inet addr:192.168.0.152Bcast:192.168.0.255Mask:255.255.255.0  
  6. inet6 addr: fe80::222:43ff:fe2d:ae2b/64 Scope:Link  
  7. UP BROADCAST RUNNING MULTICASTMTU:1500Metric:1  
  8. RX packets:106106 errors:0 dropped:0 overruns:0 frame.:0  
  9. TX packets:30806 errors:1 dropped:1 overruns:0 carrier:0  
  10. collisions:0 txqueuelen:0   
  11. RX bytes:140732082 (134.2 MiB)TX bytes:1976717 (1.8 MiB)  
  12. [simonsun@magic ~]$ ping www.google.com  
  13. PING www-china.l.google.com (66.249.89.99) 56(84) bytes of data.  
  14. 64 bytes from jp-in-f99.google.com (66.249.89.99): icmp_seq=1 ttl=246 time=67.1 ms  
  15. 64 bytes from jp-in-f99.google.com (66.249.89.99): icmp_seq=2 ttl=246 time=65.3 ms  
  16. 64 bytes from jp-in-f99.google.com (66.249.89.99): icmp_seq=3 ttl=246 time=66.4 ms  
  17. 64 bytes from jp-in-f99.google.com (66.249.89.99): icmp_seq=4 ttl=246 time=65.8 ms  
  18. --- www-china.l.google.com ping statistics ---  
  19. 4 packets transmitted, 4 received, 0% packet loss, time 3001ms  
  20. rtt min/avg/max/mdev = 65.352/66.205/67.137/0.714 ms  
  21. [simonsun@magic ~][        DISCUZ_CODE_13        ]nbsp;
复制代码

4.注意事项,一般需要设置DNS,不要忘了;如果是根据mac地址限制网络使用的话,一定要将无线网卡的mac地址正确的添加到路由器;如果连接模式通过WPA-PSK进行加密登录的话,就需要用到wpa_supplicant:
  1. [simonsun@magic ~]$ sudo yum install \*wpa\*  
  2. [simonsun@magic ~]$ /usr/sbin/wpa_passphrase NETCORE 123456781  
  3. network={ssid="NETCORE"
  4. #psk="123456781"
  5. psk=21135846dce955a6319561d7216a1407d1cb97b8fb339c05f8773a3f780d6663}  
  6. [simonsun@magic ~]$ sudo vim /etc/wpa_supplicant/wpa_supplicant.conf  
复制代码
修改如下:
  1. ctrl_interface=/var/run/wpa_supplicant  
  2. ctrl_interface_group=wheel
  3. #network={  
  4. # ssid="any"
  5. # key_mgmt=NONE
  6. #}  
  7. network={  
  8. ssid="NETCORE"
  9. #psk="123456781"
  10. psk=21135846dce955a6319561d7216a1407d1cb97b8fb339c05f8773a3f780d6663
  11. }  
  12. [simonsun@magic ~]$ sudo vim /etc/sysconfig/wpa_supplicant  
复制代码

修改INTERFACES为前面装好驱动后识别的网卡,如ath0,我这里是:
  1. # Use the flag "-i" before each of your interfaces, like so:  
  2. #INTERFACES="-i eth1 -i wlan0"
  3. INTERFACES="-i ath0"
  4. # Use the flag "-D" before each driver, like so:  
  5. #DRIVERS="-D wext"
  6. DRIVERS="-D wext"
  7. # Other arguments  
  8. # -u Enable the D-Bus interface (required for use with NetworkManager)  
  9. # -f Log to /var/log/wpa_supplicant.log  
  10. OTHER_ARGS="-u -f /var/log/wpa_supplicant.log"
复制代码

然后启动wpa服务
[simonsun@magic ~]$ sudo /etc/rc.d/init.d/wpa_supplicant start
Starting wpa_supplicant: /etc/wpa_supplicant/wpa_supplicant[确定]-i ath0 -D wext -u -f /var/log/wpa_supplicant.log

然后拨号,平时上网,只执行如下脚本即可
  1. 然后启动wpa服务
  2. [simonsun@magic ~]$ sudo /etc/rc.d/init.d/wpa_supplicant start
  3. Starting wpa_supplicant: /etc/wpa_supplicant/wpa_supplicant[确定]-i ath0 -D wext -u -f /var/log/wpa_supplicant.log
  4. 然后拨号,平时上网,只执行如下脚本即可
复制代码

这样,我们就完成了CentOS安装和配置无线网卡的工作。



centos配置代理上网




将centOS的ip设置为本地ip,如下:inet addr:192.168.0.30 Bcast:192.168.0.255 Mask:255.255.255.0
在能上网的机器(windows)上安装ccproxy,并进行如下设置:
为能上网设置一个本地ip,操作如下:
2008605433809009321.jpg


安装ccproxy,并进行如下设置:(仅添加centOS的ip)
2.jpg


回到centOS,打开fireFox,设置如下:其中代理的ip为第一步中添加的本地ip,端口和上一步中的设置相对应。
3.jpg




让yum也能通过上面所设置的代理进行软件的安装和更新
在/etc/yum.conf中加入如下两句话:
proxy=http://XXX.XXX.XXX.XXX:XXXX 前面为代理的地址,后面为端口
这里请再注意,如果你是用PP等代理服务器软件的话,请再璔加以下的内容
proxy=FTP://XXX.XXX.XXX.XXX:XXXX   一般的代理服务器的地址都是一样的,只是http跟ftp的代理端口不同。

如果你的代理有用户名跟密码,请再增加以下的内容
proxy_username=你的用户名
proxy_password=你的用户名的密码        


注意,这是通过yum安装软件可能会出现下面的错误:GPG key retrieval failed
解决:下载RPM-GPG-KEY-CentOS(光盘里面有),并执行rpm --import RPM-GPG-KEY-CentOS-5






已有(1)人评论

跳转到指定楼层
junzi234 发表于 2014-6-12 09:52:16
mark 留着别用
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条