Solved

How do I restart  a Cisco VPN client automatically under Linux?

Posted on 2010-09-09
5
554 Views
Last Modified: 2012-06-27
I have a cisco vpn client on a Cent OS 4.4 and want to make sure it comes back up automatically in case the connection goes down on the other side of the VPN tunnel.

I tried to add a cron job like:
* * * * * vpnclient connect MyConnection

Open in new window

 

This didn't work.

I see a couple of processes related to the vpn client:
root     13299  0.0  0.0  2672 1136 pts/4    S+   23:34   0:00 vpnclient
root     13300  0.0  0.0  3744  916 ?        Ss   23:34   0:00 cvpnd
nobody   13301  0.0  0.0  4008 1708 ?        S    23:34   0:00 cvpnd

Open in new window

How can I turn the vpnclient into a daemon? I think this might be the solution but I'm not sure.
Thank you!
0
Comment
Question by:el930692
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 7

Accepted Solution

by:
expert1010 earned 125 total points
ID: 33644603
I don't know vpnclient from Cisco but normaly other clients do have reconnect as a configuration option. I did some googling and found this.

http://www.networkworld.com/community/node/42121

If it's the same thing with the Linux client as the windows client you would just put a few extra lines in the configuration file.

Example from the link above.

AutoInitiationEnable=1
AutoInitiationRetryInterval=2
AutoInitiationList=MY-CORP-NET
[MY-CORP-NET]
Network=192.168.10.0
Mask=255.255.255.0
ConnectionEntry=CORP-VPN1
0
 
LVL 3

Assisted Solution

by:berniep
berniep earned 125 total points
ID: 33644933
regarding your cron sample that you say didn't work, does that command work from a shell to bring it up?
does the cron entry produce an error? try redirecting the output to a log file:
* * * * * vpnclient connect MyConnection >/tmp/vpnclient.out 2>&1
maybe the vpnclient binary is not found in the path in cron - try putting the absolute path there
0
 

Author Comment

by:el930692
ID: 33646280
The "vpnclient connect MyConnection" is the command I use when I turn on the VPN connection the regular way through the shell. I'll add it to a log file as you suggested.
0
 

Author Comment

by:el930692
ID: 33646447
Thank you expert1010.

I already have your solution implemented. It's just not very clear to me what happens if the connection goes down. Is it trying to reconnect as a service in the background or on the shell since that's how I currently initiate the connection?

How would I test it to see is this setting does it it supposed to do?

That's why I wanted to implement my cron job since I know how a little more how that supposed to behave.
0
 

Author Closing Comment

by:el930692
ID: 33646729
I found out that I need something like this in the cron job:
*/5 * * * * /etc/init.d/vpnclient_init start

I set AutoInitiationRetryInterval=2 in the .ini file and as a backup the cron jon above.

So if the VPN client will try to bring the connection back up every two minutes and just to make sure the cron job it will try to bring the connection up every 5 minutes.
0

Featured Post

Will You Be GDPR Compliant by 5/28/2018?

GDPR? That's a regulation for the European Union. But, if you collect data from customers or employees within the EU, then you need to know about GDPR and make sure your organization is compliant by May 2018. Check out our preparation checklist to make sure you're on track today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Remote Desktop Services in AWS 4 49
VPN, Squid-  unable to log https requests 5 103
port forwarding 2 66
Objects in Cisco ASA 2 52
Using Windows 2008 RRAS, I was able to successfully VPN into the network, but I was having problems restricting my test user from accessing certain things on the network.  I used Google in order to try to find out how to stop people from accessing c…
Secure VPN Connection terminated locally by the Client.  Reason 442: Failed to enable Virtual Adapter. If you receive this error on Windows 8 or Windows 8.1 while trying to connect with the Cisco VPN Client then the solution is a simple registry f…
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question