1

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

4

2 Answers 2

4

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.

4
  • 1
    Microsoft's docs (the link in the question) states: "Destination - Specifies either an IP address or host name for the network or host."?
    – Michael
    Aug 17, 2011 at 10:13
  • @Mikaveli Yeah, by changing the netmask, you're specifying the route for the network.
    – MDMarra
    Aug 17, 2011 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.
    – Michael
    Aug 17, 2011 at 12:39
  • 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, 2011 at 21:49
1

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.

3
  • After lookup, the remote server's IP address often changes - so a single static route isn't suitable.
    – Michael
    Aug 17, 2011 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, 2011 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. :)
    – Michael
    Aug 17, 2011 at 12:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .