Discussion:
dhcp classless routes
(too old to reply)
Patrick Welche
2011-01-06 13:37:36 UTC
Permalink
I can see how to write the equivalent of

route add -net w.x.y.z/m g.a.t.e

in /etc/dhcpd.conf using the base system's dhcpd and dhcpcd a la
rfc3442. Am I right in thinking that there is no way of doing the
equivalent of

route add -net w.x.y.z/m g.a.t.e -iface

?

Cheers,

Patrick

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Roy Marples
2011-01-06 17:12:29 UTC
Permalink
Hi Patrick
Post by Patrick Welche
I can see how to write the equivalent of
route add -net w.x.y.z/m g.a.t.e
in /etc/dhcpd.conf using the base system's dhcpd and dhcpcd a la
rfc3442. Am I right in thinking that there is no way of doing the
equivalent of
route add -net w.x.y.z/m g.a.t.e -iface
You can do this :)
You need this in dhcpd.conf

option classless-static-routes code 121 = array of unsigned integer 8;

option classless-static-routes m,w,x,y,z,g,a,t,e ... ;

Like so, adding a default route
option classless-static-routes 0,192,168,0,1;

Something more complex
option classless-static-routes 0,10,73,1,1,24,10,73,0,10,73,1,1,24,10,73,2,
10,73,1,1,32,10,0,0,1,10,73,1,1;

Thanks

Roy

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Patrick Welche
2011-01-06 19:01:32 UTC
Permalink
Post by Roy Marples
Hi Patrick
Post by Patrick Welche
I can see how to write the equivalent of
route add -net w.x.y.z/m g.a.t.e
in /etc/dhcpd.conf using the base system's dhcpd and dhcpcd a la
rfc3442. Am I right in thinking that there is no way of doing the
equivalent of
route add -net w.x.y.z/m g.a.t.e -iface
You can do this :)
You need this in dhcpd.conf
option classless-static-routes code 121 = array of unsigned integer 8;
option classless-static-routes m,w,x,y,z,g,a,t,e ... ;
Like so, adding a default route
option classless-static-routes 0,192,168,0,1;
Something more complex
option classless-static-routes 0,10,73,1,1,24,10,73,0,10,73,1,1,24,10,73,2,
10,73,1,1,32,10,0,0,1,10,73,1,1;
Decoding:
route add default 10.73.1.1
route add -net 10.73.0/24 10.73.1.1
route add -net 10.73.2/24 10.73.1.1
route add -host 10.0.0.1 10.73.1.1

That looks exactly like what I did to do the equivalent of
Post by Roy Marples
Post by Patrick Welche
route add -net w.x.y.z/m g.a.t.e
I don't see what you did differently for the equivalent of
Post by Roy Marples
Post by Patrick Welche
route add -net w.x.y.z/m g.a.t.e -iface
eg
route add -net 10.73.2/24 10.99.99.99 -iface
(I know that doesn't look pretty, but they are all on the same switch)

Have I missed something in your explanation?


Cheers,

Patrick

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Roy Marples
2011-01-06 19:15:05 UTC
Permalink
Post by Patrick Welche
That looks exactly like what I did to do the equivalent of
Post by Patrick Welche
route add -net w.x.y.z/m g.a.t.e
I don't see what you did differently for the equivalent of
Post by Patrick Welche
route add -net w.x.y.z/m g.a.t.e -iface
eg
route add -net 10.73.2/24 10.99.99.99 -iface
(I know that doesn't look pretty, but they are all on the same switch)
Have I missed something in your explanation?
You missed nothing.

However, dhcpcd will automatically route via the correct interface. Or
rather, the interface dhcpcd received the DHCP packet from.

With conflicting route information, dhcpcd will prefer interfaces on
metric as documented in dhcpcd.conf(5)

Thanks

Roy


--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Loading...