CentOS wireless network connection

Source: Internet
Author: User

CentOS wireless network connection

This section describes how to connect to the wireless network in centos6 through the command line. Of course, this requires the support of the wireless network card. Here we assume that the driver has been installed.

[root@baby-centOS~] #ifconfigwlan0 wlan0Linkencap:EthernetHWaddrAC:72:89:04:EA:84 UPBROADCASTMULTICASTMTU:1500Metric:1 RXpackets:0errors:0dropped:0overruns:0frame:0 TXpackets:0errors:0dropped:0overruns:0carrier:0 collisions:0txqueuelen:1000 RXbytes:0(0.0b)TXbytes:0(0.0b)

This wlan0 is the interface of the wireless network card. It indicates that the wireless network card has been recognized by the kernel. Then, two tools are required: wireless-tools and wpa_supplicant. You can install the SDK directly from the yum source or by downloading the source code package.

1)

[root@baby-centOS~] #iwlistwlan0scanning wlan0Scancompleted: Cell01-Address:64:09:80:03:75:6A Channel:1 Frequency:2.412GHz(Channel1) Quality=34 /70 Signallevel=-76dBm Encryptionkey:on ESSID: "censun-2" BitRates:1Mb /s ;2Mb /s ;5.5Mb /s ;11Mb /s ;9Mb /s 18Mb /s ;36Mb /s ;54Mb /s ...... ...... ......

Use the network interface specified by iwlist to scan and view the available pa.

Then, edit the/etc/wpa_supplicant/wpa_supplicant.conf file based on the information of a certain pa. Of course, this file can also be stored elsewhere, as long as you specify this key file when connecting to the wireless network.

ctrl_interface= /var/run/wpa_supplicant ctrl_interface_group=wheel network={ ssid= "pa_name" #pa_name psk= "passwd" # Password }

Then connect to the wireless network:

[root@baby-centOS~] #wpa_supplicant-iwlan0-c/root/wpa_supplicant.conf-Dwext-B

Meaning of each parameter:-I # indicates the connected Nic

-C # specify the storage location of the key file

-D # specify the driver type as General

-B # Run it in the background

[root@baby-centOS~] #iwconfigwlan0 wlan0IEEE802.11bgnESSID: "cyyun_develop" Mode:ManagedFrequency:2.437GHzAccessPoint:10:0D:7F:61:AD:E2 BitRate=1Mb /s Tx-Power=15dBm Retrylonglimit:7RTSthr:offFragmentthr:off Encryptionkey:off PowerManagement:off LinkQuality=57 /70 Signallevel=-53dBm Rxinvalidnwid:0Rxinvalidcrypt:0Rxinvalidfrag:0 Txexcessiveretries:0Invalidmisc:3Missedbeacon:0

The connection is successful !!!

[root@baby-centOS~] #vim/etc/sysconfig/network-scripts/ifcfg-wlan0 DEVICE=wlan0 HWADDR=AC:72:89:04:EA:84 TYPE=Ethernet UUID=39166a56-c6ac-452a-8234-efca68c86d04 ONBOOT=no NM_CONTROLLED=no BOOTPROTO=dhcp

After the configuration is complete, start the interface.

[root@baby-centOS~] #ifupwlan0 DeterminingIPinformation for wlan0... done . [root@baby-centOS~] #ipaddrshowwlan0 3:wlan0:<BROADCAST,MULTICAST,UP,LOWER_UP>mtu1500qdiscmqstateUPqlen1000 link /ether ac:72:89:04:ea:84brdff:ff:ff:ff:ff:ff inet192.168.5.65 /24 brd192.168.5.255scopeglobalwlan0 # Existing IP addresses inet6fe80::ae72:89ff:fe04:ea84 /64 scopelink valid_lftforeverpreferred_lftforever

However, after the machine is restarted, You need to reconnect and start the interface. This can be solved in this way./etc/rc. d/rc. local is the last script that will be run during system startup. You can put the commands for connecting and starting interfaces in this script.

/usr/sbin/wpa_supplicant -iwlan0-Dwext-c /etc/wpa_supplicant/wpa_supplicant .conf-B /sbin/ifup wlan0

Use the absolute path whenever possible. In this way, the machine automatically connects to the specified Wireless Network !!!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.