A way to connect to network through WIFI on Centos 7


I bought a DELL laptop,but can not connect to network through wifi.There's lots of methods on the Internet,but few of them resolve my problem.If u face the same situation,U can try my way.

Phenomenon:

1' NO-CARRIER

2'UNMANAGED

KEY Steps:

1.Get WiFi interface's Name

[does@localhost ~]$ nmcli device
DEVICE      TYPE      STATE        CONNECTION
virbr0      bridge    connected    virbr0     
virbr0-nic  tap       connected    virbr0-nic
p1p1        ethernet  unavailable  --         
lo          loopback  unmanaged    --         
wlp6s0      wifi      unmanaged    --

2.Enble WiFi Module

[does@localhost ~]$ ip link show wlp6s0
3: wlp6s0: mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 1000
    link/ether b0:c0:90:32:c4:fa brd ff:ff:ff:ff:ff:ff

[does@localhost ~]$ su
Password:
[root@localhost does]# ip link set wlp6s0 up
[root@localhost does]# ip link show wlp6s0
3: wlp6s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DEFAULT qlen 1000
    link/ether b0:c0:90:32:c4:fa brd ff:ff:ff:ff:ff:ff

3.Scan The Wireless Net

[root@localhost does]# iw wlp6s0 scan | grep SSID
    SSID: AHELLO
    SSID: huohb
    SSID: NULL
    SSID: c2303102
    SSID: xiaofeibao

Note:NULL is the name of my SSID.

root@kali:~# wpa_passphrase NULL >> /etc/wpa_supplicant.conf
123456
root@kali:~#
(where '123456' is the Network password)
Note:There is a way to input the ssid and password in the command line,but it doesn't work on my PC.
4.Connect to Network
[root@localhost does]# wpa_supplicant -B -i wlp6s0 -c /etc/wpa_supplicant.conf
Successfully initialized wpa_supplicant
[root@localhost does]# ip add show wlp6s0
3: wlp6s0: mtu 1500 qdisc mq state UP qlen 1000
    link/ether b0:c0:90:32:c4:fa brd ff:ff:ff:ff:ff:ff
    inet6 fe80::b2c0:90ff:fe32:c4fa/64 scope link
       valid_lft forever preferred_lft forever
5.Get IP Address
[root@localhost does]# dhclient wlp6s0
[root@localhost does]# ip add show wlp6s0
3: wlp6s0: mtu 1500 qdisc mq state UP qlen 1000
    link/ether b0:c0:90:32:c4:fa brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.105/24 brd 192.168.1.255 scope global dynamic wlp6s0
       valid_lft 7202sec preferred_lft 7202sec
    inet6 fe80::b2c0:90ff:fe32:c4fa/64 scope link
       valid_lft forever preferred_lft forever
6.Test
[root@localhost does]# ping www.baidu.com
PING www.a.shifen.com (111.13.100.91) 56(84) bytes of data.
64 bytes from 111.13.100.91: icmp_seq=1 ttl=54 time=7.02 ms
64 bytes from 111.13.100.91: icmp_seq=2 ttl=54 time=6.10 ms
64 bytes from 111.13.100.91: icmp_seq=3 ttl=54 time=24.7 ms
64 bytes from 111.13.100.91: icmp_seq=4 ttl=54 time=5.93 ms
^C
--- www.a.shifen.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 5.938/10.964/24.794/7.995 ms

Results:

[root@localhost does]# ip link show wlp6s0
3: wlp6s0: mtu 1500 qdisc mq state UP mode DORMANT qlen 1000
    link/ether b0:c0:90:32:c4:fa brd ff:ff:ff:ff:ff:ff

[root@localhost does]# nmcli device
DEVICE      TYPE      STATE        CONNECTION
virbr0      bridge    connected    virbr0     
virbr0-nic  tap       connected    virbr0-nic
wlp6s0      wifi      connected    wlp6s0     
p1p1        ethernet  unavailable  --         
lo          loopback  unmanaged

Reference:

http://www.blackmoreops.com/2014/09/18/connect-to-wifi-network-from-command-line-in-linux/

KeyWords

Connect to WiFi network from command line in Linux