CentOS 7 command line link wifi

Source: Internet
Author: User

CentOS 7 command line link wifi

Previously, I made my computer into a dual system and added a centos7 server. I am in a hurry because I cannot connect to my home network on vacation ..

After some investigation, I finally got connected and made a note for later use. Haha.

1. First, switch to the super Management User
[User @ localhost] $su root

2. Check the available network card. The red mark is the network card, which is not all the same
[Root @ localhost] $iw dev
Phy #0
Interface wlp2s0
Ifindex 3
Wdev 0x1
Addr a4: db: 30: 84: 4b: 1c
Type managed
The above is the printed information of the unconnected network. If it is already connected, it is as follows:
[Root @ localhost] #iw dev
Phy #0
Interface wlp2s0
Ifindex 3
Wdev 0x1
Addr a4: db: 30: 84: 4b: 1c
Ssid liylr
Type managed
Channel 11 (2462 MHz), width: 40 MHz, center1: 2452 MHz
The ssid is the name of the broadcast channel, that is, your wireless network signal. The broadcast channel is the last one.

3. view the initial status before connection.
[Root @ localhost] #ifconfig wlp2s0
Wlp2s0: flags = 4098 <BROADCAST, MULTICAST> mtu 1500
Ether 60: d8: 19: cc: 74: 84 txqueuelen 1000 (Ethernet)
RX packets 13547 bytes 13381624 (12.7 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 12659 bytes 1974514 (1.8 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

4. test whether the network is connected
[Root @ localhost] #iw wlp2s0 link
Not connected.

5. Get the SSID
[Root @ localhost] #iw wlp2s0 scan | grep SSID
Command failed: Network is down (-100)
The wireless network is not activated. Activate it first.
[Root @ localhost] #ifconfig wlp2s0 up
[Root @ localhost] #ifconfig wlp2s0
Wlp2s0: flags = 4099 <UP, BROADCAST, MULTICAST> mtu 1500
Ether 60: d8: 19: cc: 74: 84 txqueuelen 1000 (Ethernet)
RX packets 13547 bytes 13381624 (12.7 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 12659 bytes 1974514 (1.8 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
6. view all available wireless network signals
[Root @ localhost] #iw wlp2s0 scan | grep SSID
SSID: USER-20150101NS_Network_2
SSID: Tenda_17BEF8
SSID: PC-20140723DBVC_Network_1
SSID: 123
SSID: Tenda_0A6410
SSID: xiaohui
SSID: Tenda_51E4F0
SSID: Nobody Can
SSID: TP-LINK_3C479

7. Connect to the wireless network
[Root @ localhost] #wpa_supplicant -B -i wlp2s0 -c <(wpa_passphrase "Tenda_17BEF8" "useradmin")
Successfully initialized wpa_supplicant

Tenda_17BEF8 is the SSID you want to connect, and useradmin is the link password.

8. assign an IP address (use dhclient to control the network interface card for network operations to obtain the IP address)
[Root @ localhost] #dhclient wlp2s0

9. Check the IP address of the wireless network adapter. An IP Address indicates that the network connection is successful.
[Root @ localhost] #ifconfig wlp2s0
Wlp2s0: flags = 4163 <UP, BROADCAST, RUNNING, MULTICAST> mtu 1500
Inet 192.168.168.139 netmask 255.255.255.0 broadcast 192.168.168.255
Inet6 fe80: 62d8: 19ff: fecc: 7484 prefixlen 64 scopeid 0x20
Ether 60: d8: 19: cc: 74: 84 txqueuelen 1000 (Ethernet)
RX packets 13567 bytes 13386147 (12.7 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 12682 bytes 1979923 (1.8 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

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.