[NTLUG:Discuss] defaultroute file

Carl Haddick sysmail at glade.net
Fri Feb 21 22:31:39 CST 2003


On Fri, Feb 21, 2003 at 03:31:32PM -0600, Dennis Myhand wrote:
> I have just loaded an older Debian system (Libranet 1.9.0) and I am 
> having trouble getting a dialup connection working.  I am thinking that 
> when I first set up this system I put in a defaultroute file.  My 
> problem is that that was so long ago I have forgotten how to set up a 
> default route file and where to put such a file.  I think it would go in 
> /etc.  Does anyone out there, maybe a Solaris admin, know how and where 
> I set up a defaultroute file?  Thanks, Dennis in Victoria
> 

Probably what you need is the --defaultroute argument to pppd.  However,
for an overly windy solution to the problem, how 'bout this:

`ifconfig ppp0 | ./getaddr`  # note the backticks

And, in getaddr:

#!/usr/bin/python

import sys,re

ipaddr=re.compile(r'addr:([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)')

for i in sys.stdin.readlines():
    s=ipaddr.search(i)
    if s:
        print 'route add default gw',s.group(1)
        
However, it's common to use the ethernet address on the access server,
not the IP address associated with the PPP link for the default
gateway.  I think in most cases either address will work with equal
effect.

Anyway, this prints the route command 'route add default gw w.x.y.z'
where w.x.y.z is the IP address associated with the PPP link, fetching
that address out of the ifconfig command piped to getaddr.  Since the
whole thing is in backticks, the route command gets executed by the shell.

Note that in all non point-to-point routes a gateway needs to be an
offboard address that is already routeable, either by static route or
implied by being a member of an interface's subnet.  In other words, non
point-to-point gateways need to satisfy two requirements - 'it's not me,
and I already know how to get to it'.

Comments where I've missed the mark most welcome!

-- 
Carl Haddick                                http://www.glade.net
GladeNet Communications             alt email: support at glade.net
200 South Red River                               (254) 562-6381
Mexia, TX 76667                                   (877) 373-3882



More information about the Discuss mailing list