Home > Networking > Using DHCP to Assign Static Routes

Using DHCP to Assign Static Routes

January 8, 2009

In order to facilitate testing in a lab environment, I make extensive use of virtual machine technology. Today I employ a combination of VMWare Workstation and VMWare ESX Server in order to simulate distributing computing environments. Included with these technologies is virtual networking, which is tremendously useful when creating complex routed networks in my lab.

There are times when I will add static routes (host routes or network routes) to my local workstation in order to conduct testing. Occasionally there will be times when I forget the ‘-p’ switch to make the route persistent, then I find myself wondering why my connectivity to my test environment isn’t working. Another common scenario is when I grab another system (a laptop or another VM perhaps) and I end up having to manually add more routes before testing can resume.

Recently I decided to make my life easier and use DHCP to add these routes to all of my workstations. Configuring static routes using DHCP is quick and simple. You can add a static route by configuring a DHCP option 249 on Windows Server 2003 DHCP servers, or option 121 on Windows Server 2008 DHCP servers. You can configure the option at the server level, but it is more likely that you will configure the option at the scope level, or as I often do, on a specific reservation.

For demonstration purposes here we’ll make this change at the scope level. To begin, right-click Scope Options and choose Configure Options…. On Windows Server 2003 DHCP servers, select option 249 Classless Static Routes (Option 121 on Windows Server 2008 DHCP servers).

dhcp_route_01

Click Add Route…, then enter the static route you wish to configure.

dhcp_route_02

Now, regardless of which system I log on to, I am assured that I will have connectivity to all of my virtual environments.

Note: DHCP Option 121 is ignored by DHCP clients prior to Windows Server 2008 and Windows Vista. This may not work if you are using a Windows Server 2008 DHCP server to assign networking configuration to these clients. Windows Vista and Windows Server 2008 DHCP clients use both Option 121 and Option 249.

Categories: Networking
  1. Alex
    January 26, 2011 at 4:56 am

    hi!
    You weren’t mistaken? May be DHCP instead of DNS:
    “This may not work if you are using a Windows Server 2008 DNS server to assign networking configuration to these clients.”
    “On Windows Server 2003 DNS servers, select option 249 ‘Classless Static Routes’ (Option 121 on Windows Server 2008 DNS servers).”

  2. January 27, 2011 at 8:05 am

    Thanks for brining that to my attention. It’s correct now.

  3. January 15, 2013 at 4:24 am

    Is it possible to assign a metric to the route?

  4. January 18, 2013 at 12:52 pm

    Not to my knowledge. There certainly isn’t anything in the GUI that lets you specify the metric.

  5. KEB
    March 4, 2013 at 2:32 am

    By the way:
    If you specify the classless routes via dhcp you have to specify all routes for the clients.
    The default route “003” is ignored by some clients (e.g. android devices).

    Rfc says; if you are using classless static routes, you have to define alle routes including default gateway.

    Most of the time you will not notice. But if you have some devices which are not acting as expected, you should have a look 😉

  6. March 4, 2013 at 9:06 am

    Thanks for the tip, Kris!

  1. September 12, 2011 at 1:52 pm
  2. August 12, 2015 at 7:25 am
Comments are closed.