I'm connecting using VPNBook servers and it works fine with this command:
sudo openvpn --config /etc/openvpn/vpnbook-udp-53.ovpn --auth-user-pass /etc/openvpn/password.txt
but I just can't seem to figure out how to stop it without a reboot.
I've tried service openvpn stop
and /etc/init.d/vpnbook stop
, but that doesn't seem to affect it.
This command definitely works for me, and it should work for you too.
I had same problem with disconnecting from openvpn3
I end up creating this small repo that helps manage the openvpn3 sessions
To disconnect the session, you have know the session's Path
the session path could be found via
You can use my repo to perform same actions with help of bash files.
The successful steps in my case were:
For some reason
killall -SIGINT openvpn
did not work for me, but the steps above did.I stumbled upon having 2 open sessions with the same config path. So I could not use
openvpn3 session-manage --disconect --config <config_path>
So I made a script to loop through sessions (session ids are not always the same as the config paths)
Try this
You can get more info on the different signals you can send here.
In case
sudo killall openvpn
does not finish the job (I experienced it a few times) then a sharp and fatal solution would be:Just hit CTRL+C in the terminal you just started OpenVPN.
after running
sudo killall openvpn
orservice openvpn stop
the virtual interface "tun0" would remain opened and referenced in route table, so actually related connections would be lost since openvpn service is killed.the solution is to delete this virtual connection after killing openvpn service, as it is created everytime when openvpn service gets connected.
so you need to run below commands for disconnecting openvpn:
sudo openvpn3 session-manage --disconnect --config $'client'.ovpn
Replace client with the corresponding name.
This will shutdown the session.
Use the following command, where
0
is the tunnel number: