[nzlug] Routers in dhcp.conf

Daniel Lawson daniel at meta.net.nz
Tue Sep 18 19:29:02 NZST 2007


Raimund Eimann wrote:
> Hi,
>
> is there a possibility of providing subnet-specific routing information to 
> dhcp-clients?
>
> The problem:
>
> Two subnets: 192.168.2.0/24 and 192.168.3.0/24
>
> Router (towards Internet) is in 192.168.2.0/24 with IP 192.168.2.254. Router 
> towards 192.168.3.0/24 is 192.168.2.247.
>
> Router towards any other networks in 192.168.3.0/24 is 192.168.3.254 (second 
> interface of host 192.168.2.247).
>
> In 192.168.2.0/24 a DHCP server provides network info for clients. In its 
> config, the "option routers" entry can be used to tell a client which route 
> to use. Of course, its currently set to 192.168.2.254.
>
> I don't see how an additional routing entry for the 192.168.3.0/24 net can be 
> placed in the DHCPd config, so that 192.168.2.0/24 clients also know how to 
> reach hosts in 192.168.3.0/24.
>   
Steve suggested using the 'static-routes' option in dhcpd.conf. I've had
some issues with some dhcp clients not honouring that option in the
past, so if it doesn't work out for you, think about this instead:

A router will quite happily route back out the same interface a packet
was received on. So it's perfectly OK to add a route on 192.168.2.254
(the default router for 192.168.2.0/24), to route packets destined for
192.168.3.0/24 via 192.168.2.247. This is trivial on an OS based router,
and most halfway decent hardware routers I've seen have options for
adding static routes like this.


In terms of efficiency, the router will typically send an ICMP redirect
to the originating host, which will add a temporary route destined for
the router to 192.168.3.0, so you don't normally end all your traffic to
192.168.3.0/24 via 192.168.2.254









More information about the NZLUG mailing list