Under Linux wifi connection through the command

Background story: I was the Secretary to make a new retail, machine supports 4G, wifi, cable, may involve switching and connection to the network

Project requirements: end user web wifi enter a name and password, the client can connect through information delivered by the server

Technology Research: nmcli instructions mentioned before, this time he came again

a)        连接nmcli device wifi connect wifiname password wifipasswd

b) Delete nmcli con del wifiname

c)        启动nmcli connection up wifiname

d)        关闭nmcli connection down wifiname

If wifi is hidden, then the above methods will not work, and here I am doing a supplement:

According to wifi and wifi name of the device (INTERFACE) Add: nmcli c add type wifi con-name "NAME" ifname "INTERFACE" ssid "SSID" NAME here and wifi SSID name to write, INTERFACE is the wifi DEVICE (nmcli device status can be viewed)

Wifi connection set encryption and password: nmcli c modify "NAME" wifi-sec.key-mgmt wpa-psk wifi-sec.psk "PASSWORD"

启动wifi:nmcli c up "NAME"

关闭wifi:nmcli c down "NAME"

This is quite simple, today introduced here, we can also do an extended according to their needs, feel free to leave a message for technical exchange and sharing.

Guess you like

Origin www.linuxidc.com/Linux/2019-11/161369.htm