How to disconnect from network via wpa_cli?

9,142

Solution 1

Just do wpa_cli disconnect to disconnect, and wpa_cli reconnect to connect again.

Alternatively, you can also ifdown/ifup your wlan interface.

BTW, the man page of wpa_cli for some reason only lists a few commands; use wpa_cli help for a much longer list.

(I can't help you with the nmcli issue).

Solution 2

To disconnect from the network via wpa_cli you can use the following commands:

disable_network <network id>

It is used to disable the network

disconnect

disconnect and wait for reassociate command before connecting

 terminate

terminate wpa_supplicant

edit

the network I'm connected to doesn't even show up when invoking the nmcli connection show -active

You should save your configuration through save_config command.

Share:
9,142

Related videos on Youtube

CAPGuy
Author by

CAPGuy

Updated on September 18, 2022

Comments

  • CAPGuy
    CAPGuy over 1 year

    Is there a way to disconnect from a network via wpa_cli? I'm reading the man page and I've been able to use wpa_cli to connect to my router via push-button connect (WPS); however I'm trying to write a script that will disconnect from the network upon a certain event.

    I attempted to find the network via nmcli but the network I'm connected to doesn't even show up when invoking the nmcli connection show -active command. Many thanks.

  • dirkt
    dirkt over 7 years
    "disable network" only excludes one particular network (i.e. BSSID) from the list of networks to automatically connect to. While this would also work, it's probably not what is wanted.