*** From dhcp-server -- To unsubscribe, see the end of this message. ***

Ted Lemon wrote:
> 
> The linux dhclient-script doesn't have support for the static routes
> option.   The NetBSD one does.   There's no particular reason for this
> - I just haven't propogated the changes.   You should be able to pull
> the code from one to the other.   I don't know why you have routes to
> the other nets at all - the client script can't have added them.
> 
>                                _MelloN_


I'm not exactly sure what routes you are referring to in your last
sentence, but if they are the ones that are appearing when I was using
the static-routes option, then the newer linux kernels seem to
automatically add a route when you bring an interface up (without you
telling it to.)  For example, if my routing table looks like this

Kernel IP routing table
Destination   Gateway       Genmask         Flags Metric Ref    Use
Iface
10.0.0.0      0.0.0.0       255.255.255.0   U     0      0        0 eth0
127.0.0.0     0.0.0.0       255.0.0.0       U     0      0        0 lo
0.0.0.0       10.0.0.1      0.0.0.0         UG    0      0        0 eth0

before I bring eth1 up with the command 'ifconfig eth1 10.0.1.2 netmask
255.255.255.0 broadcast 10.0.1.255', it will look like this afterwards:

Kernel IP routing table
Destination   Gateway       Genmask         Flags Metric Ref    Use
Iface
10.0.0.0      0.0.0.0       255.255.255.0   U     0      0        0 eth0
10.0.1.0      0.0.0.0       255.255.255.0   U     0      0        0 eth1
127.0.0.0     0.0.0.0       255.0.0.0       U     0      0        0 lo
0.0.0.0       10.0.0.1      0.0.0.0         UG    0      0        0 eth0

I believe that this is taken in account for in the linux dhclient-script
around line 124 (it only adds a route if the kernel version is less than
2.1).

Anyway, I've been looking at the dhclient-script for linux and there
would be a problem adding the static-routes option as it is - it would
have to be hardcoded as either adding a host or adding a net (if I'm not
mistaken.)  Let me clarify (and from here on I'm only talking about
linux 2.1 or greater because I don't have a <2.1 box to play with right
now):

The static-routes option takes two arguments, the IP and the Gateway. 
For adding/deleting a net, you *need* a netmask.  Furthermore, if you
just do a command like

node1:~# route add 10.0.1.0 gw 10.0.1.2

you will get a routing table entry such as this:

Destination   Gateway       Genmask         Flags Metric Ref    Use
Iface 10.0.1.0      10.0.1.2      255.255.255.255 UGH   0      0       
0 eth1

which is broken (well, it seems to work as a broadcast, but that's about
it).

The above is how the NetBSD script does it (from the dhclient-script for
NetBSD):

168       set $new_static_routes
169       while [ $# -gt 1 ]; do
170         route add $0 $1
171         shift; shift
172       done

and not having access to any NetBSD boxes, I don't know how this works
out for the host/net issue.

Anyway, the way around it for Linux would be to include a netmask
variable in the static-routes option such that in the scripts if it were
"0.0.0.0" the route would be a host and if it were not "0.0.0.0" the
route would be a net (0.0.0.0 is an invalid netmask argument to a 'route
xxx -net' and the only valid netmask argument to a 'route xxx -host'). 
To preserve backwards compatibility with whoever is already using
static-routes in its current incarnation, the .conf parser could fill in
the IP, Gateway, and Netmask if three arguments are present between
commas or IP, Gateway, and "0.0.0.0" if only two arguments are present. 
Then just the client scripts would need a few simple modifications.

The linux script code could be something like

set $new_static_routes
while [ $# -gt 2 ]; do
        if [ $2 = "0.0.0.0" ]; then
                route add -host $0 gw $1
        else
                route add -net $0 gw $1 netmask $2
        fi
        shift; shift; shift
done

But, I haven't looked at things enough yet to know everything that's
going on (and maybe static-routes is defined as it is in an RFC
somewhere or something) and I could just be spouting nonsense.

Thanks,

--
Jason Holmes


------------------------------------------------------------------------------
To unsubscribe from this list, please visit http://www.fugue.com/dhcp/lists
If you are without web access, or if you are having trouble with the web page,
please send mail to [EMAIL PROTECTED]   Please try to use the web
page first - it will take a long time for your request to be processed by hand.

Archives for this mailing list are available at 
http://www.webnology.com/list-archives/dhcp/dhcp-server

------------------------------------------------------------------------------

Reply via email to