Using DHCP to Assign Static Routes
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).
Click Add Route…, then enter the static route you wish to configure.
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.
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).”
Thanks for brining that to my attention. It’s correct now.
Is it possible to assign a metric to the route?
Not to my knowledge. There certainly isn’t anything in the GUI that lets you specify the metric.
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 😉
Thanks for the tip, Kris!