A process for connecting to a wireless network in CentOS

Source: Internet
Author: User

1. First of all, your system to be able to drive the infinite network card, if the character is good, the system has brought your network card driver. Or you'll have to take care of the wireless card driver. Otherwise, there is no need to follow the steps.

2. Take a look at what your wireless card is called:

Iwconfig

Suppose this step we get the NIC name is Wlan0

3. Turn on your wireless card:

set wlan0 up

The General wireless network card is already up state, in order to prevent the wireless card in the down state, executes once the above command.

4. Scan the available wireless networks around:

sudo iw dev wlan0 scan

You will find the output of the information is very messy, this does not know how to streamline, first carefully identified with the eye. Assuming this step we know that the available SSID is CMCC

5. Connect to the wireless network we found in the previous step: (choose one of three cases)

(1) Situation one, open hot spots

sudo iw dev wlan0 connect CMCC

(2) Scenario two, hotspot using WEP encryption

Because CMCC does not have a password, we can use the above command to connect to CMCC. If the hotspot is encrypted with WEP (assuming the password is 123456789), it is said to use the following command: (I did not try)

0:123456789

(3) Situation three, hot use WPA/WPA2

If the hotspot uses the WPA or WPA2 protocol, the following actions are required: (assuming the password is 123456789)

Edit file:/etc/wpa_supplicant/wpa_supplicant.conf

Add the following to the content:

network{SSID="CMCC"  PSK="123456"  priority =1       }

Then execute the command:

sudo iw dev wlan0 connect CMCC
sudo wpa_supplicant-i wlan0-c/etc/wpa_supplicant/wpa_supplicant.conf

6. Get the IP address

You will find that this step, you still can not use the network, yes, you have not obtained an IP address, even if the hotspot is using dynamic address assignment, you still have to execute the following command to obtain an IP address

The following command is used in the online tutorial:

sudo dhcpcd wlan0

I remember this command in ArchLinux, but I did not find this command in my CentOS, nor did I find the relevant package in the source. CentOS indicates that the source is less than the wayward!!!

In fact, this is true in CentOS:

sudo dhclient wlan0

In this step the two commands only apply to the case where the hotspot is dynamically assigned IP, and if the hotspot is statically assigned IP, it is not known how to do so at the moment.

7. Complete

The above is the process of connecting to the wireless network in the command line mode of Linux, which is very troublesome!!!

A process for connecting to a wireless network in CentOS

Related Article

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.