How to connect to a wireless network in CentOS 7 and connect to a wireless network in centos 7
Although I have consulted the relevant network materials, the following content is original content, only dry goods, no nonsense.
1. Switch to the Super User
[Oscar @ localhost desktop] $ su root
2. query available wireless network cards. The red color indicates the network card number.
[Oscar @ localhost desktop] $ iw dev
Phy #0
Interface wlp2s0
Ifindex 3
Wdev 0x1
Addr a4: db: 30: 84: 4b: 1c
Type managed
Note: If the network is successfully connected, it should be like the following. The ssid is the name of the broadcast channel, that is, your wireless network signal. The broadcast channel is the last one.
[Root @ localhost desktop] # 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
3. View wireless network card connection information
[Oscar @ localhost desktop] $ iw wlp2s0 link
Not connected. (No connection is available)
4. view all available wireless network signals
[Root @ localhost desktop] # iw wlp2s0 scan | grep SSID
SSID: USER-20150101NS_Network_2
SSID: Tenda_17BEF8
SSID: PC-20140723DBVC_Network_1
SSID123
SSID: Tenda_0A6410
SSID: Xiaohui
SSID: Tenda_51E4F0
SSID: Nobody Can
SSID: TP-LINK_3C479
SSID: FUCK YOU
SSID: Tenda_046260
SSID: Tenda_188E80
SSID: Liylr
SSID: XIAORUAN
5. Connect to the wireless network
[Root @ localhost desktop] # wpa_supplicant-B-I wlp2s0-c <(wpa_passphrase "liylr" "useradmin ")
Successfully initialized wpa_supplicant
Note: liylr indicates the Wi-Fi signal to be connected, and useradmin indicates the password of the wireless network. Please replace it with your password.
6. assign an IP address (use dhclient to control the network interface card for network operations to obtain the IP address)
[Root @ localhost desktop] # dhclient wlp2s0
7. Check the IP address of the wireless network adapter. If an IP address is available, the network connection is successful. You can surf the Internet.
[Root @ localhost desktop] # ip addr show wlp2s03: wlp2s0: <BROADCAST, MULTICAST, UP, LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
Link/ether a4: db: 30: 84: 4b: 1c brd ff: ff
Inet 192.168.1.101/24 brd 192.168.1.255 scope global dynamic wlp2s0
Valid_lft 7195sec preferred_lft 7195sec
Inet6 fe80: a6db: 30ff: fe84: 4b1c/64 scope link
Valid_lft forever preferred_lft forever