-   Linux - Networking (
-   -   ppp0 ip rule add script (

andrew44 07-19-2012 07:39 PM

ppp0 ip rule add script

I have a linux router dialing as a client to a VPN service provider. The connection seems pretty stable

This is my pptpconfig script

# tunnel, written by pptpconfig $Revision: 1.16 $

# name of tunnel, used to select lines in secrets files

# name of tunnel, used to name /var/run pid file

# name of tunnel, passed to ip-up scripts

# data stream for pppd to use
pty "pptp --nolaunchpppd "

# domain and username, used to select lines in secrets files
name myusername


# do not require the server to authenticate to our client

#suggested by priavte

# adopt defaults from the pptp-linux package
file /etc/ppp/options.pptp

# end of tunnel file

The connection redials automatically but when it drops it also takes with it any ip rules I've added.

So I created this script. ip-up.local and put it into /etc/ppp. My understanding is that if the connection is dropped this script will be run.

export PPP0=`ifconfig ppp0 | grep "inet addr" | awk '{ print $2 }' | awk 'BEGIN { FS=":" } { print $2 }'`
echo "1 andrew">> /etc/iproute2/rt_tables
ip rule add from table andrew
ip route add default via $PPP0 dev ppp0 table andrew
ip route flush cache

It seems to add the rules each time it needs to but when this script runs the connection seems to drop every minute or so. Is the problem this script?

Thanks in advance,

andrew44 07-21-2012 11:28 PM

The problem was that the mtu was not set. I set it to 1400 and the connection stays up.

All times are GMT -5. The time now is 06:57 PM.