Subject: Problems with pppd and route
To: None <email@example.com>
From: Ian Zagorskih <firstname.lastname@example.org>
Date: 05/27/2004 03:11:27
In short: can i change routing tables inside ip-up/ip-down pppd scripts or
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
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 10.0.0.1 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> 10.0.0.1" i can ping the server and so on.
Ok, but looks like i can add this entry into routing table only when ppp0
interface is configured and there is known route for 10.0.0.1 itself. The
same i don't need this entry in the table when i disconnect from ISP and ppp0
So i decided to add and remove this fixed routing entry from /etc/ppp/ip-up
and ip-down scripts. Like below:
route add server $remote
route delete server
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.
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 :(
My question is - how to automatically fix routing tables after pppd daemon
enters/leaves online state ?
Any ideas and what I'm doing wrong ?