Take the 2-minute tour ×
Server Fault is a question and answer site for professional 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:

ROUTE ADD -p IPADREESS GATEWAYIP

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

For example:

ROUTE ADD -p DNSServer GATEWAYIP 
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
add comment

2 Answers

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.

Example:

route add webservices.example.com mask 255.255.255.255 10.11.12.13

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
add comment

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
add comment

Your Answer

 
discard

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.