[Dnsmasq-discuss] How to configure routing via DHCP?
Simon Kelley
simon at thekelleys.org.uk
Thu Feb 2 20:48:42 GMT 2006
Dirk Schenkewitz wrote:
> Hi All,
>
> this is not especially dnsmasq-related, only "also" :-) - but I don't know a
> better place to ask about DHCP options than here. :-)
>
> For a PC that moves between 3 networks, I thought it would be nice to
> configure some basic routing via DHCP. I found a list of DHCP-options and
> option 33 ("Static Route") seems to be suitable, but I didn't find how to use
> it - the comment states "static routing table", but not how that should look
> like.
>
> So, my questions are:
>
> - Can anybody tell me how to configure routing via DHCP, with an example?
>
> When correctly set up, 'route' shows my routing table as follows:
> Kernel IP routing table
> Destination Gateway Genmask Flags Metric Ref Use Iface
> link-local * 255.255.0.0 U 0 0 0 eth0
> 10.0.0.0 * 255.0.0.0 U 0 0 0 eth0
> loopback * 255.0.0.0 U 0 0 0 lo
> default 10.1.1.223 0.0.0.0 UG 0 0 0 eth0
> The important line (and the one that does not work automatically now) is the
> last line.
>
If you really want to set up static routes and use option 33 then you'll
need to do some configuration of your dhcp client: we're covered this
ground before, and the relevant information is here:
http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2006q1/000569.html
BUT: the last line in your routing table is a default route, not a
static route. (Well I guess it's a static route too, but a special case)
Because nearly everything needs a default route (sometimes it called the
"router address, because that's what it is) there is a special DHCP
option to set it: the "router" option, number three.
Because dnsmasq is very frequently run on the router, it sends by
default a router option, with a value of the IP address of the machine
running dnsmasq. If that's wrong, then a simple dhcp-option line in
/etc/dnsmasq.conf will override the default:
dhcp-option=3,10.1.1.223
That's probably all you need.
> - Does anybody know a link to a good documentation of the DHCP options
> (preferably with examples!)?
The canonical list (well, apart from new ones defined after it was
published) is RFC 2132: http://www.faqs.org/rfcs/rfc2132.html
> That is, other than dnsmasq.conf, which is IMHO very good (for me, a few short
> examples work better than a detailed & complicated (or too short)
> description), but dnsmasq.conf does not mention option 33. :P
>
> - And to get it on-topic: I don't have to worry about dnsmasq not supporting
> this, do I? ;-)
Nope, it suppports all of them.
>
Cheers,
Simon.
More information about the Dnsmasq-discuss
mailing list