Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've added a few static routes, for the most part the following has worked fine:

route add mask metric 10 -p

However, one URL resolves to more that one IP address / it isn't static. Is there any way to change the command above to include an entire octet, i.e. 123.123.123.*

If not, can I make a static route based on the host name? So anything matching would use the route?

I know, from a networking / purist perspective that routing tables don't really relate to host names / DNS - but M$'s documentation seems to indicate that 'feature' is present (rightly or wrongly):

share|improve this question
Can anyone explain the downvote? I don't understand what is wrong with my question? – Mikaveli Aug 17 '11 at 10:14
You might want to read up on how subnetting works. – quux Aug 17 '11 at 10:51
The downvote isn't very nice. You should explain to the OP why he is wrong instead of just punishing him. – Antoine Benkemoun Aug 17 '11 at 12:23
up vote 3 down vote accepted

You can "wildcard" IP addresses by just changing the netmask:

route add mask <router>

There's no way to route to a hostname, because names are handled at a higher level of the network stack.

share|improve this answer
Microsoft's docs (the link in the question) states: "Destination - Specifies either an IP address or host name for the network or host."? – Mikaveli Aug 17 '11 at 10:13
@Mikaveli Yeah, by changing the netmask, you're specifying the route for the network. – MDMarra Aug 17 '11 at 11:56
@MarkM My point was that the M$ doc says you can specify a host name, but womble's answer says you can't. – Mikaveli Aug 17 '11 at 12:39
@womble Thank you, your answer works for me. :) – Mikaveli Aug 17 '11 at 13:55
I never said you couldn't specify a hostname, just that you can't route to one. If you specify a hostname, then it gets resolved to an IP address, and when that address changes (as you state it will), then the route will be out-of-date and your routing will fail. – womble Aug 17 '11 at 21:49

It sounds like you're trying to solve a problem that you are having in a different manner than you really should. What problem are you actually trying to solve? routes have nothing do with names, you can't really mix the two. The names are looked up at the time the route is entered and translated to an IP address at that time.

share|improve this answer
After lookup, the remote server's IP address often changes - so a single static route isn't suitable. – Mikaveli Aug 17 '11 at 11:19
So, then, you're trying to solve a different problem. - what problem is that? It sounds like you need to look into an application proxy of some sort. – Aaron Aug 17 '11 at 11:24
I'm trying to test an app (not mine) in an environment with a proxy - the app doesn't support them. All the other remote calls work with this approach because their IP addresses remain static. If there's a better approach to doing a 'quick test', I'd be grateful of any suggestion. :) – Mikaveli Aug 17 '11 at 12:26

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.