LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-22-2016, 05:31 AM   #1
edcelvista24
LQ Newbie
 
Registered: Apr 2016
Posts: 8

Rep: Reputation: Disabled
Smile How To kill Specific Openvpn Connection


Ex.
Im using Linux
i have 3 openvpn tunnels tun0, tun1, tun2
For the example scenario if tun2 is not connected i want it to be renewed by not affecting other tunnels. I will kill the tun1 openvpn connection and run another one in that tunnel . Please Help , Thanks
 
Old 04-23-2016, 05:22 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,844

Rep: Reputation: 8009Reputation: 8009Reputation: 8009Reputation: 8009Reputation: 8009Reputation: 8009Reputation: 8009Reputation: 8009Reputation: 8009Reputation: 8009Reputation: 8009
Quote:
Originally Posted by edcelvista24 View Post
Ex.
Im using Linux
i have 3 openvpn tunnels tun0, tun1, tun2
For the example scenario if tun2 is not connected i want it to be renewed by not affecting other tunnels. I will kill the tun1 openvpn connection and run another one in that tunnel . Please Help , Thanks
Read the "Question Guidelines" link in my posting signature. Do basic research before posting questions...putting "how to restart one openvpn tunnel" into Google pulls up over 158,000 hits. The very first hit is from the OpenVPN forums:
https://openvpn.net/archive/openvpn-.../msg00360.html

Also, the init scripts cover such things, as documented in the man pages. The initscripts for openvpn allow single instances to be managed by name:
Code:
/etc/init.d/openvpn stop vpn_tunnel1
...or start/restart the tunnel by name.
 
Old 04-23-2016, 06:18 PM   #3
edcelvista24
LQ Newbie
 
Registered: Apr 2016
Posts: 8

Original Poster
Rep: Reputation: Disabled
Thanks for the reply
if my tunnels in ifconfig name tun1
then
/etc/init.d/openvpn stop tun1
right?
 
Old 04-24-2016, 05:08 PM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,844

Rep: Reputation: 8009Reputation: 8009Reputation: 8009Reputation: 8009Reputation: 8009Reputation: 8009Reputation: 8009Reputation: 8009Reputation: 8009Reputation: 8009Reputation: 8009
Quote:
Originally Posted by edcelvista24 View Post
Thanks for the reply
if my tunnels in ifconfig name tun1
then
/etc/init.d/openvpn stop tun1
right?
Wrong. Did you read what I posted, or read that thread I directed you to?

AGAIN, the name you pass the control script is the one you defined in your openvpn config file. If that's what you named it, then yes....but typically it's not.
 
Old 04-27-2016, 02:16 PM   #5
imort
LQ Newbie
 
Registered: Apr 2016
Posts: 6

Rep: Reputation: Disabled
Quote:
Originally Posted by edcelvista24 View Post
Ex.
Im using Linux
i have 3 openvpn tunnels tun0, tun1, tun2
For the example scenario if tun2 is not connected i want it to be renewed by not affecting other tunnels. I will kill the tun1 openvpn connection and run another one in that tunnel . Please Help , Thanks
Try the following:

/etc/init.d/openvpn stop tun0
/etc/init.d/openvpn start tun0

By 'tun0' you'll need to substitute your openvpn conf file name for this connection.
 
Old 04-28-2016, 07:29 AM   #6
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,844

Rep: Reputation: 8009Reputation: 8009Reputation: 8009Reputation: 8009Reputation: 8009Reputation: 8009Reputation: 8009Reputation: 8009Reputation: 8009Reputation: 8009Reputation: 8009
Quote:
Originally Posted by imort View Post
Try the following:

/etc/init.d/openvpn stop tun0
/etc/init.d/openvpn start tun0

By 'tun0' you'll need to substitute your openvpn conf file name for this connection.
Right...that's exactly what was told to the OP in the first reply, post #2.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to route specific users/processes via OpenVPN nuvista175 Linux - Networking 2 02-22-2013 02:30 AM
troubleshooting: connection blocked, but only for 1 specific client and 1 specific NIC arri Linux - Networking 3 10-18-2011 11:31 AM
using OpenVPN for specific application(s) amaj1407 Linux - Networking 10 07-05-2009 02:10 PM
Log Out a Specific User (KILL) carlosinfl Linux - General 8 08-29-2007 10:53 AM
kill specific process fj8283888 Linux - General 6 05-31-2007 06:28 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration