Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I need to add a static route on a windows server toward a web server with a service; I need to add a static route with this command on a Windows command prompt:


Is there a way to do a static route toward a DNS address instead of a IP Address ? How ?

For example:

share|improve this question
Can you elaborate on why you think you need this? Perhaps there is a better way. –  Zoredache May 23 '10 at 20:17

2 Answers 2

The syntax of the route add command is

route add destination mask subnetmask gateway metric costmetric if interface

Where destination is either an IP address or host name for the network or host.


route add webservices.example.com mask

See this Microsoft article: To add a static IP route

You have to keep in mind that the entry will be resolved to an IP address, so if the DNS for the host name changes, there will still be the original IP address in the routing table.

share|improve this answer
Even with the issue about DNS changing, it would be great to use a host name in the route add command. When I use the syntax in your example on Windows 8, I consistently get The route addition failed: The parameter is incorrect. –  zacharydl Dec 16 '14 at 20:14

No, not on the network layer. You could perhaps achieve your goal using something like a proxy. You could also emulate the behavior using a script but it would likely be fallible.

To be clear, my point was that you cannot dynamically route based on hostname. I am not contesting what splattne said.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.