Jump to content
Not connected, Your IP: 13.58.61.176
Antrax

[Linux] Stop connection from command-line

Recommended Posts

Hi all

 

I'm on Xubuntu 14.04 and, since that I wanted to start a connection to AirVPN servers at startup without loading GUI, I added the instruction from command-line ("sudo /usr/bin/airvpn -cli -netlock") in Session and "Startup->Application autostart" (something like said in this post https://airvpn.org/topic/12797-from-windows-7-to-linux-problem/#entry22035).

 

It is working. The problem is that I can't disconnect from the VPN and it's impossible to press x key or Ctrl+C in the terminal because it doesn't load at startup launching the application in this way.

 

I've tried

sudo killall openvpn
 

 

and it actually disconnects from VPN, but after a few seconds I find myself connected to VPN again (the only way is to remove the instruction from Session and "Startup->Application autostart" and reboot).

 

Is there a solution that doesn't require rebooting?

 

Thanks.

Share this post


Link to post

Did you ever find a solution? I'm on Lubuntu 14.04 and notice the same behaviour. With sudo killall airvpn and sudo killall openvpn I'm unable to close AirVPN running in command line mode. A new openvpn instance is opened immediately...

Share this post


Link to post

This is what I do and it is working:

 

# Kill OpenVPN by sending Ctrl + c to the process
sudo pkill -f -SIGINT openvpn
sudo pkill -f -SIGTERM openvpn

# Kill airVPN process by sending Ctrl + c to the process
sudo pkill -f -SIGINT airvpn
sudo pkill -f -SIGTERM airvpn

echo "# Stopping VPN"

sudo iptables -P INPUT ACCEPT
sudo iptables -P FORWARD ACCEPT
sudo iptables -P OUTPUT ACCEPT
sudo iptables -t nat -F
sudo iptables -t mangle -F
sudo iptables -F
sudo iptables -X
sudo iptables -t raw -F
sudo iptables -t raw -X

echo "# Restarting network interfaces"

sudo ifdown etho
sudo ifup eth0

sudo ifdown wlan0
sudo ifup wlan0

Share this post


Link to post

Thanks a lot! Finally able to quit In my case I had to use ifconfig eth0 down instead of ifdown eth0.

Seems to be a typo in your script (etho instead of eth0).

 

What do the iptables rules do exactly? Do I need them?

Share this post


Link to post

Yes it is a typo.

 

I have no ide why did I put iptables there, it has been a long time ago since I made it. I am using network lock, so that is probably the reason, to reset rules and alow normal trafic again.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Security Check
    Play CAPTCHA Audio
    Refresh Image

×
×
  • Create New...