[Dnsmasq-discuss] How to configure routing via DHCP?

Dirk Schenkewitz schenkewitz at docomolab-euro.com
Wed Feb 8 11:19:24 GMT 2006


On Tuesday, 7. February 2006 12:31, Simon Kelley wrote:
> Dirk Schenkewitz wrote:
> > ...
> Just for completeness, it's worth noting that option 33 is obsolete and
> deprecated. The reason is that it has no way to send a netmask. This was
> fine in the days before CIDR, where the netmask could be derived from
> the address, but it doesn't work with CIDR.

Aha. I was already wondering about how/where to put the netmask... 
A "routing table" entry usually contains one, but for option 33 I didn't see 
it. Now after I read RFC3442 I realize that the netmask could be derived
from the address. This would enough for now, here, but I can see the time 
coming where something better is needed.

> Option 33 has been replaced with option 121, which is defined in RFC
> 3442. This gives a way to encode the netmask within the DHCP option
> data. For the next release of dnsmasq, I've added support for this
> encoding, so it will be possible to do
>
> dhcp-option=121,192.168.1.0/24,1.2.3.4

That's great, Thank you very much! (For the info and for supporting it.)
Hmm, AFAIU RFC3442 describes the "raw" packet information as:

'121' Length-byte Destination-descriptor Router-address

while "Destination-descriptor" consistst of the netmask width and the 
"important part" of the network address (it can be 1 to 5 bytes long) and the 
"Router-address" is always 4 bytes long, optionally followed by one or more 
blocks of  

Destination-descriptor Router-address

while the "Length-byte" specifies the number of "Destination-descriptor 
Router-address"-blocks and is "1" if there is only one such block.

AFAIU, the "192.168.1.0/24" part in your example means 
Network-Adress/Netmask-Length and the 1.2.3.4 is the gateway. Will it be 
possible to do 

dhcp-option=121,192.168.1.0/24,1.2.3.4,10.128.0.0/9,10.129.3.4 

with dnsmasq? 

> I'm not sure if the ISC have added corresponding decode support in
> dhclient. If not, there is some amazing shell code to do it here:
>
> http://linux.thai.net/~thep/patches/rfc3442

Thank you very much, again. I'll save this for later. Thanks a lot, again.

> >>>- 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
> >
> > I had found that one (and overlooked that "The default route (0.0.0.0)
> > is an illegal destination for a static route"). But I found it is not
> > clear about how exactly these entries should be specified. Maybe because
> > it specifies the format of the "transmitted packet" of that option.
> > Perhaps how to specify it depends on the DHCP client.
>
> It does depend on the client. In dnsmasq, you can always specify exactly
> the bits you want in the transmitted packet, but using "hex and colons".
>
> dhcp-option=45,0e:34:e5:11
>
> but for most things  its easier to use one of the supported shortcuts.
>
> text: dhcp-option=34,"some text"
> (list of) IP addresses:  dhcp-option=56,1.2.3.4,5.6.7.8
> decimal number: dhcp-option=76,1

Hmm... the colon form of 121,192.168.1.0/24,1.2.3.4 would be 

121,1:18:C0:A8:1:1:2:3:4 

and the colon form of 121,192.168.1.0/24,1.2.3.4,10.128.0.0/9,10.129.3.4 (if 
supported) would be 

121,2:18:C0:A8:1:1:2:3:4:9:A:80:A:81:3:4 

if I got it right... Looks like this requires some less-trivial parsing & 
converting on your side...
(For faster reading: 18x=24d, C0x=192d, A8x=168d, Ax=10d, 80x=128d, 81x=129d 
provided that I didn't miscalculate anything.)

> >>>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
>
> It does mention option 3 in the list of options-provided-bt default.

Ok, now I found it. I searched the file for "3," thinking there might be an 
uncommentable line that I could change and only "23," was found :-)

> I'll add a "uncomentable line" to show how that can be overridden. I'll
> also add an example for option 121

Great! Simon, I owe you some beer/wine/whatever. Your answers are worth money.

Thanks a lot for your ongoing work, your answers, for listening to the people 
and generally for being so nice. Once in a while I must say this.

Cheers
  Dirk



More information about the Dnsmasq-discuss mailing list