[plug] How to add static route?

Matt Kemner zombie at penguincare.com.au
Fri Aug 20 13:26:51 WST 2004


On Fri, 20 Aug 2004, quoth Craig Ringer:

> AFAIK you'll need to write a script that takes care of that. Perhaps
> something that looks at the DHCP response and decides what network it's
> on and what to do about the route. Unfortunately, I've had trouble in
> the past getting useful info out of DHCP clients - "WTF was the value of
> option-201" is not a question the ones I looked at seemed to be good at
> answering.

dhcpcd understands dhcp option 33 (static routes) as defined in RFC2132,
although I've not managed to get it to understand option 121 (RFC3442)
which allows for classless routing, whereas Windows understands them fine,
but as option 249 instead (just to be different)

Fortunately the only routes I needed are class-based, but if I needed to
add a static route for 10.0.1.0/24 via one gateway, and 10.0.2.0/24 via
another, I would not have been able to do it under Linux.

I'm still hoping I've missed something, and that I can get one of the
Linux dhcp clients to understand classless static routes.

I could not get pump or dhclient to accept any form of static routes.

In my dhcpd.conf I have:

    # For Windows
    option new-static-routes code 249 = string;

    # 192.168.201/24 via 192.168.18.2 24:192:168:201:192.168.18:02
    # and 10/8  via 192.168.18.2   8:10:192:168:18:02
    option new-static-routes  18:c0:a8:c9:c0:a8:12:02:8:0a:c0:a8:12:02;

    # For Linux
    option static-routes code 33 = string;

    # 192.168.201.0 via 192.168.18.2 192:168:201:0:192.168.18:02
    # and 10.0.0.0  via 192.168.18.2 10:00:00:00:192:168:18:02
    option static-routes   c0:a8:c9:0:c0:a8:12:02:0a:00:00:00:c0:a8:12:02;

If you can figure out the hex encoding in less than 5 minutes when you've
never seen it before, you're a better (wo)man than me.. :)

 - Matt




More information about the plug mailing list