Subject: Re: Problems with pppd and route
To: Ian Zagorskih <>
From: Mike M. Volokhov <>
List: tech-userlevel
Date: 05/27/2004 09:22:45
On Thu, 27 May 2004 03:11:27 +0700
Ian Zagorskih <> wrote:

> In short: can i change routing tables inside ip-up/ip-down pppd scripts or 
> not ?

Yes. On all my systems it works perfectly in the same manner as you
described. What OS you've used?

> In details, the scheme looks like this:
> ppp -> GPRS -> Internet -> server
> I.e. i connect with PPP/GPRS to the ISP and want to access some server inside 
> Internet. I know server's IP address and it's supposed to be fixed and 
> unchanged.
> When i connect to the ISP with PPP/GPRS all works really fine and finally i 
> got two addresses for ppp0 interface: local and remote. Usually local address 
> is like 10.0.a.b and remote is almost always and i use it as a 
> gateway to access Inet through PPP.
> When i use "defaultroute" option with pppd or when after connection is 
> established i manually add an entry in the routing table like "route add 
> <server>" i can ping the server and so on.

Hmm... I think "defaultroute" should be enough, except you need this
GPRS connection to server only.

> Ok, but looks like i can add this entry into routing table only when ppp0 
> interface is configured and there is known route for itself. The 
> same i don't need this entry in the table when i disconnect from ISP and ppp0 
> goes down.
> So i decided to add and remove this fixed routing entry from /etc/ppp/ip-up 
> and ip-down scripts. Like below:
> ---ip up---
> #!/bin/sh
> remote=$5
> route add server $remote
> ---ip up---
> ---ip down---
> #!/bin/sh
> route delete server
> ---ip down---
> Both scripts are called fine by pppd and i can see that pppd passes correct 
> remote host IP address. Same as i'm sure that route is called too. Scripts 
> are running as root, as expected.

How you check this?

> The problem is that ip-up script doesn't actually change the routing table. It 
> stays unchanged regardless to "route add" request ! Only when ip-up script 
> terminates and pppd goes online i can execute the same "route add" command 
> with success. But this isn't what i want to do :(

Does that scripts have execution bit set (i.e. "chmod +x /etc/ppp/ip-*")?

> My question is - how to automatically fix routing tables after pppd daemon 
> enters/leaves online state ?
> Any ideas and what I'm doing wrong ?

If all setups is correct, may be it will be helpful ran pppd with debug
options or even via ktrace.