Windows – Static route toward a DNS Address, it is possible

networkingroutewindows

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 

Best Answer

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.