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've added a few static routes, for the most part the following has worked fine:

route add 123.123.123.123 mask 255.255.255.255 100.100.100.100 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 example.com 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):

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/sag_tcpip_pro_addstaticroute.mspx?mfr=true

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. serverfault.com/questions/49765 –  quux Aug 17 '11 at 10:51
2  
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
    

2 Answers 2

up vote 3 down vote accepted

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

route add 192.0.2.0 mask 255.255.255.0 <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
1  
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
1  
@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

 
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.