LinuxQuestions.org
Help answer threads with 0 replies.
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 11-10-2008, 07:44 AM   #1
esaym
Member
 
Registered: Nov 2006
Distribution: Lots of Debian
Posts: 165

Rep: Reputation: 32
OpenVPN Client


I recently set up a vpn on a home sever so that I can connect to my local network when I am on the road with my linux laptop. The problem I have is that when I start my laptop I have to first wait for network manager to get an ip address from the what ever wireless net I am on and then I have to run /etc/init.d/openvpn start. Is there any way to automate these 2 processes to where when I turn my laptop on that it will automatically get a local ip and then enable the vpn? I have openvpn routing all traffic back to the vpn server.
 
Old 11-10-2008, 12:34 PM   #2
zer0python
Member
 
Registered: Sep 2003
Posts: 104

Rep: Reputation: 20
just add /etc/init.d/openvpn to the boot process (rc-update in gentoo.) and configure your network card to do dhcp on boot as well.
 
Old 11-11-2008, 02:57 PM   #3
esaym
Member
 
Registered: Nov 2006
Distribution: Lots of Debian
Posts: 165

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by zer0python View Post
just add /etc/init.d/openvpn to the boot process (rc-update in gentoo.) and configure your network card to do dhcp on boot as well.
Well that would work for wired networks but I don't think that would work very well for wireless? Plus The problem right now is that network manager over writes any default route set by openvpn. So if the wireless hiccups or anything network manager will refresh and over write the default route set by openvpn and I might not even notice it.
 
Old 11-11-2008, 05:05 PM   #4
esaym
Member
 
Registered: Nov 2006
Distribution: Lots of Debian
Posts: 165

Original Poster
Rep: Reputation: 32
Ok well I got something working

It looks like /etc/NetworkManager/dispatcher.d/01ifupdown calls all the scripts in /etc/network/*

There are 2 (broken)scripts for automatic vpn startup in /etc/network/if-down.d/openvpn and /etc/network/if-up.d/openvpn

I just modified them so that they call /etc/init.d/openvpn start/stop

/etc/network/if-up.d/openvpn:

Quote:
#!/bin/sh

OPENVPN=/etc/init.d/openvpn

if [ ! -x $OPENVPN ]; then
exit 0
fi

sleep 2 # sleep to let the network settle
$OPENVPN start
echo "nameserver 10.36.40.1" > /etc/resolv.conf #overwrite local lan dns with dns on vpn server
 
  


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
OpenVPN client has not default gateway when connect to OpenVPN server sailershen Linux - Security 3 03-04-2010 02:20 AM
Trying to route via OpenVPN client jjge Linux - Networking 15 02-28-2008 01:31 PM
Trying to route via OpenVPN client jjge Linux - Networking 1 02-21-2008 06:43 AM
Openvpn client to client routing question soup Linux - Networking 0 02-16-2006 11:13 AM
inetd and OpenVPN client rmocius@auste.e Slackware 0 10-14-2004 01:50 AM

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

All times are GMT -5. The time now is 11:43 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