about options classless-static-routers of ISC dhcp
Ray Phillips
r.phillips at jkmrc.com
Wed Feb 14 07:35:24 UTC 2007
Qiaoyong:
>How can I configure DHCP Server to add some classless static route
>to client and how to describe it in dhcpd.conf?
>
>such as :
>
>destination gateway
>10.1.0.0 10.3.0.253
As I understand it, it's necessary to first define the option in
dhcpd.conf as an array of bytes, e.g.:
option classless-routes code 249 = array of unsigned integer 8;
(RFC3442 says the code for the option is 121 but Windows XP, at
least, seems to use 249.)
Then the array which specifies the routes needs to be defined in the
appropriate scope, with the values separated by commas. [1]
The first byte in the array is interpreted as the number of bits in
the destination subnet's subnet mask. The next one, two, three or
four bytes contain the significant bits in the destination subnet's
address; i.e. the logical AND of the subnet mask with the subnet's
address, but truncated so it has only as many bits as there are 1's
in the subnet mask [2]. The next four bytes give the IP address of
the router to which packets should be sent in order to reach the
destination subnet.
So if the destination subnet is 10.1.0.0/16 and the IP address of the
router which will forward packets to it is 10.3.0.253 the routes
would be specified like this:
option classless-routes 32, 0,0,0,0, 10,3,0,253,
16, 10,1, 10,3,0,253;
(RFC3442 says the default route must be included in the list of
static routes and I think 32, 0,0,0,0 is the right way to do that.)
Ray
Questions for the list...
[1] The one time I've tried this I used decimal numbers to specify the byte
values, but perhaps hex or octal encoding could also be used if you
really wanted to. What would the syntax be?
[2] If the destination subnet was 10.1.0.0/24 I guess it might be necessary
to write 24, 10,1,0, 10,3,0,253 i.e. the last 0 in the second group is
required, depending on the situation?
More information about the dhcp-users
mailing list