OPNsense Forum

English Forums => Tutorials and FAQs => Topic started by: BertM on January 06, 2016, 10:14:16 pm

Title: Sending Classless Static Routing to DHCP clients.
Post by: BertM on January 06, 2016, 10:14:16 pm
I am not sure if this is the right place to post it, but maybe other people can benefit from the info below.

Having a chat about classless static routing with a few former colleagues, I realized that for may people it is unclear how to configure DHCP server to send classless static routing to DHCP clients.

Here below there is a copy of a short write-up I made for them.

Sending Classless Static Routes to DHCP Clients from OPNsense.


Understanding the value string.
The string is made of the netmask and network of the destination (destination descriptor) and the address of the router that forwards traffic to the destination.
All octets are entered as their hexadecimal value.
So for example, if we want to route traffic to 192.168.10.0/24 via a router at 192.168.5.10, the string would be made as follows:

|-- Destination Descriptor --|
Netmask bits,  Network address, Forwarding router address
   24             192.168.10.0      192.168.5.10
    |             _|   |   |         |   |  |  |
    |            |   __|   |         |   |  |  |
    |            |  |   ___|         |   |  |  |
    |            |  |  |   __________|   |  |  |
    |            |  |  |  |   ___________|  |  |
    |            |  |  |  |  |   ___________|  |
    |_________   |  |  |  |  |  |   ___________|
              |  |  |  |  |  |  |  |
Hex string:  18:C0:A8:0A:C0:A8:05:0A


Note that in the example above, the last octet of the network address is omitted.
This is because, according to RFC 3442, the descriptor of the destination is in compact format.
This means that the destination descriptor starts with one octet that represents the subnet mask, followed by only the significant octets of the destination network address.
Significant octets are all octets where at least one of the corresponding netmask bits is 1.

So for example if I wanted to route the complete private class-B address range via 192.168.5.10, this would look like:

Netmask bits,  Network address, Destination router address
   12             172.16.0.0      192.168.5.10
    |             _|   |           |   |  |  |
    |            |   __|           |   |  |  |
    |            |  |   ___________|   |  |  |
    |            |  |  |   ____________|  |  |
    |            |  |  |  |   ____________|  |
    |_________   |  |  |  |  |   ____________|
              |  |  |  |  |  |  |
Hex string:  0C:AC:10:C0:A8:05:0A


Should we want to send multiple Classless Static Routing entries to the DHCP client, we can simply concatenate the two strings with a colon in between.
So for example for the above two routing entries, this would look like:

18:C0:A8:0A:C0:A8:05:0A:0C:AC:10:C0:A8:05:0A

Kind regards,
Bert