top of page
Recent Posts
Writer's pictureMunshi Hafizul Haque

How to configure the DHCP server to distribute Static IP routes

Updated: Oct 3, 2021

Sometimes, we need to push a static route from the DHCP server to the client systems. And there are two DHCP option can be configured to achieve that.

  • RFC 3442 defines DHCP Option 121: Classless Static Route Option for DHCPv4

  • Microsoft introduced DHCP Option 249: Microsoft Classless Static Route Option.


We need to do some changes to our existing DHCP server.

Step:1 Add below additional entries to the DHCP configuration file.

# vi /etc/dhcp/dhcpd.conf
::::::::::::: CUT SOME OUTPUT ::::::::::::: 
# Specify Default Gateway
#       option routers                  192.168.123.1;
# These options are used to add static routes
# Option Code 121 (0x79) - Classless Static Route Option
        option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
        option rfc3442-classless-static-routes 24,192,168,122, 192,168,122,1;
#
#  Option Code 249 (0xF9) - Microsoft Classless Static Route Option
#       option ms-classless-static-routes code 249 = array of unsigned integer 8;
#       option ms-classless-static-routes 24, 192, 168, 123, 192, 168, 123, 1;
#
# This distributes a route entry for network 192.168.123.0/24 using the gateway 192.168.123.1.
# The meaning of the bytes is (in brackets the value from the example above):
# NM, D1, D2, D3, R1, R2, R3, R4
# NM      = destination network mask width (24)
# D1..D3  = destination network address (192.168.1.*)
# R1..R4  = router address (192.168.0.4)
::::::::::::: CUT SOME OUTPUT ::::::::::::: 
Note: has put some note as well started with "#" symbol to understand more. And the default route can be disabled based on our requirements.

Step:2 To restart dhcpd service after any changes in the configuration file.

# systemctl restart dhcpd

Step:3 To verify the static route configuration from the client systems.

Troubleshooting:

Though, there is an alternative DHCP option syntax has mentioned in the red hat documents, but for me below alternative DHCP option syntax doesn't work.

 option classless-static-routes 24.192.168.123 192.168.123.1;

Hope this post will help.

54 views0 comments

Recent Posts

See All

תגובות


Log In to Connect With Members
View and follow other members, leave comments & more.
bottom of page