LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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 08-07-2004, 07:19 PM   #1
J_Szucs
Senior Member
 
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126

Rep: Reputation: 58
pppd: how to bring up an interface?


I configured a ppp-over-ssh vpn, by bringing up a new ppp interface to a remote site, adding some static routes, and inserting a firewall rule that allows traffic via the new ppp interface.

It works - but only if I issue all commands manually in the right order.
However, it would be nice to create a script that can do the same automatically.

A such script could look like this:
# Bring up the vpn link (i.e. create the new ppp interface) by pppd
/usr/sbin/pppd call vpn
# Run a script that adds my specific routes and inserts a rule into the firewall to allow traffic via the new interface
/usr/local/bin/vpn_addroute.sh

But the above script will not work: the vpn_addroute.sh script will not be run as long as the link is up (because pppd only finishes when the link is brought down).

Maybe I could do this:
/usr/sbin/pppd call vpn &
/usr/local/bin/vpn_addroute.sh

But, in this case, vpn_addroute.sh would be run in parallel with pppd, so, how could it find out when the interface is FULLY brought up, I mean, the /etc/ppp/ip-up script has finished running? ( if the vpn_addroute.sh script inserts the firewall rule before the ip-up script called by pppd has finished, then the new firewall rule will be lost because the standard ip-up script resets the firewall).

Naturally, I could (maybe) modify the ip-up script, but I want a "clean" solution that does not modify any system scripts, only adds (or removes) some scripts or modifies some config files in order to bring up the link.

Could you give me a hint how to do this?

Last edited by J_Szucs; 08-07-2004 at 07:21 PM.
 
Old 08-08-2004, 05:52 AM   #2
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 46
You should create a script ip-up.local and put it in the same directory as ip-up.
 
Old 08-08-2004, 08:02 AM   #3
J_Szucs
Senior Member
 
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126

Original Poster
Rep: Reputation: 58
Thanks, it is a good idea.

However, the ip-up.local script is always run, not only when I bring up the vpn. So it would also be run when I just dial in to my ISP, and that way the routes and the firewall rules could be attached to the wrong ppp interface.

To solve the problem, the ip-up.local script should behave differently when bringing up the link to my ISP and when I bringing up the vpn.
So far I have no idea how the ip-up.local script could distinguish between these two cases.

Edit:
Problem solved: the ip-up.local script gets $REMOTEIP as a startup parameter, and that tells the ip-up.local script if it is to bring up the vpn or the link to my ISP.

Thanks for your help!

Last edited by J_Szucs; 08-08-2004 at 08:52 AM.
 
  


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
pppd timeout before pppd interface could start! bioagentice Linux - Software 6 03-27-2005 11:24 AM
Can't bring up eth0 Interface at boot robertmenezes Linux - Networking 8 02-21-2005 01:13 AM
FC2 won't bring up interface eth0 Cikotic Fedora - Installation 4 07-09-2004 03:24 PM
How to bring eth interface up correctly? cold Linux - Networking 2 06-18-2004 02:40 AM
couldn't bring up interface eth0 mikez Linux - Networking 9 02-28-2002 12:02 PM


All times are GMT -5. The time now is 11:08 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration