{"id":509,"date":"2015-03-19T08:35:14","date_gmt":"2015-03-19T00:35:14","guid":{"rendered":"http:\/\/www.datarelab.com\/blog\/?p=509"},"modified":"2015-03-19T08:35:14","modified_gmt":"2015-03-19T00:35:14","slug":"centos-%e6%97%a0%e7%ba%bf%e4%b8%8a%e7%bd%91%e8%ae%be%e7%bd%ae","status":"publish","type":"post","link":"https:\/\/www.datarelab.com\/blog\/Technical_literature\/509.html","title":{"rendered":"CentOS \u65e0\u7ebf\u4e0a\u7f51\u8bbe\u7f6e"},"content":{"rendered":"<p>CentOS\u91c7\u7528\u7684\u5185\u6838\u901a\u5e38\u6bd4\u8f83\u4fdd\u5b88\uff0c\u652f\u6301\u7684\u786c\u4ef6\u4e5f\u6709\u4e00\u5b9a\u7a0b\u5ea6\u7684\u6ede\u540e\uff0c\u6bd4\u5982\u5bf9\u65e0\u7ebf\u7f51\u5361\u7684\u652f\u6301\u3002\u5982\u679c\u6ca1\u6709\u65e0\u7ebf\u7f51\u5361\u7684\u9a71\u52a8\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u5347\u7ea7\u5185\u6838\u5b8c\u6210\u3002\u5982\u679c\u6700\u65b0\u5185\u6838\u6ca1\u6709\u5305\u542b\u4f60\u7f51\u5361\u7684\u9a71\u52a8\uff0c\u5c31\u9700\u8981\u624b\u52a8\u5b89\u88c5\u4e86\u3002<\/p>\n<p>\u5982\u679c\u8981\u786e\u8ba4\u662f\u5426\u65e0\u7ebf\u7f51\u5361\u662f\u5426\u88ab\u9a71\u52a8\u4e86\uff0c\u53ef\u4ee5\u4f7f\u7528\uff1a<\/p>\n<p>[root@vfeelit ~]# iwconfig \u5b89\u88c5\uff1ayum install -y wireless-tools<br \/>\nlo no wireless extensions.<\/p>\n<p>wlan0 IEEE 802.11bgn ESSID:\"ap_283303695\"<br \/>\nMode:Managed Frequency:2.462 GHz Access Point: 6C:E8:73:46:EF:7A<br \/>\nBit Rate=121.5 Mb\/s Tx-Power=14 dBm<br \/>\nRetry long limit:7 RTS thr:off Fragment thr:off<br \/>\nEncryption key:off<br \/>\nPower Management:off<br \/>\nLink Quality=70\/70 Signal level=-18 dBm<br \/>\nRx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0<br \/>\nTx excessive retries:0 Invalid misc:68 Missed beacon:0<br \/>\n\u5fc5\u987b\u51fa\u73b0wlan\u8fd9\u6837\u7684\u63a5\u53e3\uff08\u4e5f\u53ef\u80fd\u662f\u5176\u5b83\u540d\u5b57\uff09\uff0c\u5982\u679c\u6ca1\u6709\u8bf4\u660e\u6ca1\u6709\u65e0\u7ebf\u7f51\u5361\uff0c\u6216\u65e0\u7ebf\u7f51\u5361\u6ca1\u6709\u88ab\u9a71\u52a8\uff08\u5c31\u662f\u6ca1\u6709\u9a71\u52a8\u7a0b\u5e8f\uff09\u3002<\/p>\n<p>\u5148\u5173\u95edNetworkManager,\u5b83\u548c\u624b\u52a8\u8bbe\u7f6e\u51b2\u7a81\uff1a<\/p>\n<p>[root@vfeelit ~]# service NetworkManager stop<br \/>\n[root@vfeelit ~]# chkconfig --list | grep Net<br \/>\nNetworkManager 0:\u5173\u95ed 1:\u5173\u95ed 2:\u5173\u95ed 3:\u5173\u95ed 4:\u5173\u95ed 5:\u5173\u95ed 6:\u5173\u95ed<br \/>\n[root@vfeelit ~]# chkconfig --level 2345 NetworkManager off<br \/>\n\u5efa\u7acb\u914d\u7f6e\u6587\u4ef6<\/p>\n<p>#\/etc\/sysconfig\/network-scripts\/ifcfg-wlan0<\/p>\n<p>DEVICE=wlan0<br \/>\nESSID=\"ap_283303695\"<br \/>\nTYPE=Wireless<br \/>\nBOOTPROTO=static<br \/>\nIPADDR=192.168.1.100<br \/>\nNETMASK=255.255.255.0<br \/>\nGATEWAY=192.168.1.1<br \/>\nIPV6INIT=no<br \/>\nONBOOT=yes<br \/>\n\u8fd9\u91cc\u8ddf\u914d\u7f6e\u6709\u7ebf\u7f51\u5361\u5dee\u4e0d\u591a\uff0c\u4e0d\u8fc7\u8981\u6ce8\u610fDEVICE\u8981\u6307\u5b9aiwconfig\u663e\u793a\u7684\u65e0\u7ebf\u7f51\u5361\u540d\uff0cTYPE\u8981\u8bbe\u7f6e\u4e3aWireless\uff0c\u7528ESSID\u6307\u5b9a\u63a5\u5165\u540d\u79f0\u3002\u5982\u679c\u91c7\u7528WEP\u5bc6\u7801\u9a8c\u8bc1\uff0c\u8fd9\u91cc\u8fd8\u8981\u4f7f\u7528KEY\u6307\u5b9a\u5bc6\u7801\uff08\u5f53\u524d\u91c7\u7528WPA-PSK\/WPA2-PSK\u9a8c\u8bc1\uff0c\u6240\u4ee5\u8fd9\u91cc\u4e0d\u9700\u8981\u6307\u5b9aKEY\uff09\u3002<\/p>\n<p>\u4e4b\u540e\u91cd\u542f\u7f51\u7edc\uff1a<\/p>\n<p>[root@vfeelit network-scripts]# ifconfig wlan0<br \/>\nwlan0 Link encap:Ethernet HWaddr 00:26:C7:32:CE:D2<br \/>\ninet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0<br \/>\ninet6 addr: fe80::226:c7ff:fe32:ced2\/64 Scope:Link<br \/>\nUP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1<br \/>\nRX packets:3306 errors:0 dropped:0 overruns:0 frame:0<br \/>\nTX packets:396 errors:0 dropped:0 overruns:0 carrier:0<br \/>\ncollisions:0 txqueuelen:1000<br \/>\nRX bytes:312460 (305.1 KiB) TX bytes:54709 (53.4 KiB)<br \/>\nIP\u5730\u5740\u7b49\u4fe1\u606f\u5df2\u7ecf\u5206\u914d\uff0c\u4e0d\u8fc7\u8fd9\u65f6\u8fd8\u6ca1\u6709\u8fde\u63a5\u4e0a\u65e0\u7ebf\u7f51\u7edc\uff0c\u90a3\u662f\u56e0\u4e3a\u65e0\u7ebf\u63a5\u5165\u9700\u8981\u5bc6\u7801\u9a8c\u8bc1\u3002\u7531\u4e8e\u8fd9\u91cc\u91c7\u7528\u4e86WPA-PSK\/WPA2-PSK\u9a8c\u8bc1\uff0c\u6240\u4ee5\u9700\u8981\u4f7f\u7528\u53e6\u4e00\u4e2a\u5de5\u5177\u3002<\/p>\n<p>[root@vfeelit network-scripts]# yum install wpa_supplicant<\/p>\n<p>wpa_supplicant-0.7.3-4.el6_3.x86_64<br \/>\nwpa_supplicant\u53ef\u80fd\u5df2\u7ecf\u5b89\u88c5\u3002\u63a5\u4e0b\u6765\uff1a<\/p>\n<p>wpa_passphrase [ESSID] [\u5bc6\u7801] &gt;&gt; \/etc\/wpa_supplicant\/wpa_supplicant.conf<\/p>\n<p>## vi \/etc\/wpa_supplicant\/wpa_supplicant.conf<br \/>\nctrl_interface=\/var\/run\/wpa_supplicant<br \/>\nctrl_interface_group=wheel<br \/>\nnetwork={<br \/>\nssid=\"ap_283303695\"<br \/>\n#psk=\"s15889660090\"<br \/>\npsk=c0f293f6e1c21bd99d5764a565f9708e187da6972bc96dc5f1c69a35211a3116<br \/>\n}<br \/>\n\u5b9e\u9645\u4e0a\u5f80\/etc\/wpa_supplicant\/wpa_supplicant.conf\u6dfb\u52a0\u4e86network\u5757\u3002\u7136\u540e\u8fd0\u884cwpa_supplicant\uff1a<\/p>\n<p>wpa_supplicant -Dwext -iwlan0 -c\/etc\/wpa_supplicant.conf<br \/>\n\u5982\u679c\u5e0c\u671b\u8fd9\u4e2a\u7a0b\u5e8f\u5728\u540e\u53f0\u663e\u793a\uff0c\u9700\u8981\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<p>wpa_supplicant -B -Dwext -iwlan0 -c \/etc\/wpa_supplicant\/wpa_supplicant.conf #B\u8868\u793a\u540e\u53f0\u8fd0\u884c<\/p>\n<p>#\u53ef\u4ee5\u7528wpa_supplicant -h\u67e5\u770b\u57fa\u672c\u7528\u6cd5\uff1a<br \/>\ndrivers:<br \/>\nwext = Linux wireless extensions (generic)<br \/>\nnl80211 = Linux nl80211\/cfg80211<br \/>\nwired = Wired Ethernet driver<br \/>\noptions:<br \/>\n-B = run daemon in the background<br \/>\n-D = driver name (can be multiple drivers: nl80211,wext)<br \/>\n-c = Configuration file<br \/>\n-f = log output to debug file instead of stdout<br \/>\n\u4e4b\u540e\u5e94\u8be5\u5c31\u53ef\u4ee5\u8fde\u63a5\u4e0a\u65e0\u7ebf\u7f51\u7edc\u4e86\u3002<\/p>\n<p>iwconfig\u547d\u4ee4\u53ef\u4ee5\u7528\u6765\u8bbe\u7f6e\u7f51\u7ebf\u7f51\u5361\u7684\u4fe1\u606f\uff0c\u6bd4\u5982essid\uff0ckey\u7b49\uff0c\u53c2\u8003\uff1a<\/p>\n<p>[root@vfeelit network-scripts]# iwconfig -h<br \/>\nUsage: iwconfig [interface]<br \/>\ninterface essid {NNN|any|on|off}<br \/>\ninterface mode {managed|ad-hoc|master|...}<br \/>\ninterface freq N.NNN[k|M|G]<br \/>\ninterface channel N<br \/>\ninterface bit {N[k|M|G]|auto|fixed}<br \/>\ninterface rate {N[k|M|G]|auto|fixed}<br \/>\ninterface enc {NNNN-NNNN|off}<br \/>\ninterface key {NNNN-NNNN|off}<br \/>\ninterface power {period N|timeout N|saving N|off}<br \/>\ninterface nickname NNN<br \/>\ninterface nwid {NN|on|off}<br \/>\ninterface ap {N|off|auto}<br \/>\ninterface txpower {NmW|NdBm|off|auto}<br \/>\ninterface sens N<br \/>\ninterface retry {limit N|lifetime N}<br \/>\ninterface rts {N|auto|fixed|off}<br \/>\ninterface frag {N|auto|fixed|off}<br \/>\ninterface modulation {11g|11a|CCK|OFDMg|...}<br \/>\ninterface commit<br \/>\nCheck man pages for more details.<br \/>\n\u4e00\u822c\uff0c\u76f4\u63a5\u8fd0\u884ciwconfig\u67e5\u770b\u662f\u5426\u6709\u65e0\u7ebf\u7f51\u5361\uff08\u6bd4\u5982wlan0\uff09,\u7136\u540e\u542f\u52a8\u8fd9\u4e2a\u7f51\u5361\uff1a<\/p>\n<p>ifconfig wlan0 up<br \/>\n\u7136\u540e\u53ef\u4ee5\u7528\u8fd9\u4e2a\u65e0\u7ebf\u7f51\u5361\u641c\u7d22\u65e0\u7ebf\u7f51\u7edc\uff1a<\/p>\n<p>[root@vfeelit network-scripts]# iwlist wlan0 scan<br \/>\nwlan0 Scan completed :<br \/>\nCell 01 - Address: 6C:E8:73:46:EF:7A<br \/>\nChannel:11<br \/>\nFrequency:2.462 GHz (Channel 11)<br \/>\nQuality=70\/70 Signal level=-19 dBm<br \/>\nEncryption key:on<br \/>\nESSID:\"ap_283303695\"<br \/>\nBit Rates:1 Mb\/s; 2 Mb\/s; 5.5 Mb\/s; 11 Mb\/s; 6 Mb\/s<br \/>\n9 Mb\/s; 12 Mb\/s; 18 Mb\/s<br \/>\nBit Rates:24 Mb\/s; 36 Mb\/s; 48 Mb\/s; 54 Mb\/s<br \/>\nMode:Master<br \/>\nExtra:tsf=00000001a5e4b17c<br \/>\nExtra: Last beacon: 95ms ago<br \/>\nIE: WPA Version 1<br \/>\nGroup Cipher : TKIP<br \/>\nPairwise Ciphers (2) : TKIP CCMP<br \/>\nAuthentication Suites (1) : PSK<br \/>\nIE: IEEE 802.11i\/WPA2 Version 1<br \/>\nGroup Cipher : TKIP<br \/>\nPairwise Ciphers (2) : TKIP CCMP<br \/>\nAuthentication Suites (1) : PSK<br \/>\n\u627e\u5230\u9700\u8981\u63a5\u5165\u7684\u65e0\u7ebf\u7f51\u7edc\uff0c\u83b7\u53d6Address\u3001Channel\u3001Frequency\u3001Encryption key\u3001ESSID\u3001Mode\u548c\u52a0\u5bc6\u65b9\u5f0f\uff08\u4ee5\u4e0a\u662f\u4f7f\u7528wpa\uff09\u3002<\/p>\n<p>\u7136\u540e\u53ef\u4ee5\u4f7f\u7528iwconfig\u8bbe\u7f6e\u76f8\u5173\u53c2\u6570\uff08\u4e5f\u53ef\u4ee5\u5199\u5165\u914d\u7f6e\u6587\u4ef6\u4e2d\u53bb\uff09\uff0c\u6bd4\u5982\uff1a<\/p>\n<p>iwconfig wlan0 essid \"ap_283303695\"<br \/>\niwconfig wlan0 key s15889660090 ##\u4f7f\u7528wep\u9a8c\u8bc1\u65f6\u6709\u6548<br \/>\niwconfig wlan0 ap auto<\/p>\n<p>##\u7528ifconfig\u8bbe\u7f6eIP<br \/>\nifconfig wlan0 192.168.1.100 netmask 255.255.255.0 gw 192.168.1.1<\/p>\n<p>##\u786e\u8ba4\u5df2\u7ecf\u6dfb\u52a0\u4e86\u9ed8\u8ba4\u8def\u7531<br \/>\nroute -n<br \/>\n\u8fd9\u4e9b\u4fe1\u606f\u53ef\u4ee5\u4fdd\u6301\u5230ifcfg-wlan0\u4e2d\u53bb\u3002<\/p>\n<p>\u5982\u679c\u91c7\u7528wpa\u9a8c\u8bc1\uff0c\u8fd8\u9700\u8981\u8fd0\u884cwpa\u547d\u4ee4\u6765\u7ba1\u7406\u65e0\u7ebf\u5bc6\u7801\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CentOS\u91c7\u7528\u7684\u5185\u6838\u901a\u5e38\u6bd4\u8f83\u4fdd\u5b88\uff0c\u652f\u6301\u7684\u786c\u4ef6\u4e5f\u6709\u4e00\u5b9a\u7a0b\u5ea6\u7684\u6ede\u540e\uff0c\u6bd4\u5982\u5bf9\u65e0\u7ebf\u7f51\u5361\u7684\u652f\u6301\u3002\u5982\u679c\u6ca1\u6709\u65e0\u7ebf\u7f51\u5361\u7684\u9a71\u52a8 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-509","post","type-post","status-publish","format-standard","hentry","category-Technical_literature"],"views":1283,"_links":{"self":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/posts\/509","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/comments?post=509"}],"version-history":[{"count":0,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/posts\/509\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/media?parent=509"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/categories?post=509"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/tags?post=509"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}