Can't reconnect to Wi-Fi after disconnecting

1

I use Arch Linux and this is the command I usually use to disconnect from the Internet: sudo wpa_cli -i wlp2s0 -p /var/run/wpa_supplicant\ GROUP\=wheel/ terminate. To connect again, I use: sudo wpa_supplicant -B -i wlp2s0 -c /etc/wpa_supplicant-wlp2s0.conf. That works at my home, but not here at my cousin's house.

I establish some kind of connection since I at least get Wi-Fi's name (iwgetid returns the correct name of wlan). But that's all, there is no connection with the Internet.

I even tried running sudo dhcpcd -b after sudo wpa_supplicant -B -i wlp2s0 -c /etc/wpa_supplicant-wlp2s0.conf but it has no effect.

Hanlon

Posted 2018-08-11T14:03:23.790

Reputation: 431

Guess: The second time you start wpa_supplicant it has a slightly different configuration than the first time it gets started automatically. Is there any reason you have to terminate wpa_supplicant to disconnect? Why not use whatever way your distro uses (network manager, ifup/ifdown, disconnect with wpa_cli, whatever?) – dirkt – 2018-08-12T06:50:31.920

@dirkt "The second time you start wpa_supplicant it has a slightly different configuration than the first time it gets started automatically." Why do you think so? "Is there any reason you have to terminate wpa_supplicant to disconnect? Why not use whatever way your distro uses (network manager, ifup/ifdown, disconnect with wpa_cli, whatever?)" I don't have neither network manager or ifup/ifdown. As for wpa_cli, I don't think that can be done using it. PS: I'm a minimalist. – Hanlon – 2018-08-12T14:31:08.083

connect/disconnect via wpa_cli. Still think it can't be done? – dirkt – 2018-08-12T15:56:47.633

@dirkt Doesn't work for me. – Hanlon – 2018-08-12T19:27:10.317

Answers

0

I've found another, better way that does the same thing (and does it right):

To disconnect:

sudo ip link set dev wlp2s0 down && sudo dhclient -r wlp2s0

To connect:

sudo ip link set dev wlp2s0 up && sudo dhclient wlp2s0

Hanlon

Posted 2018-08-11T14:03:23.790

Reputation: 431

I'm minimalistic myself, but at least I let ifup/ifdown handle DHCP ... – dirkt – 2018-08-12T15:57:29.987

Maybe that's a better idea, I'll check it out. :) – Hanlon – 2018-08-12T19:29:44.010