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 am connected via Ethernet (10.1.1.1, interface 11) as well as via Wireless LAN (172.22.12.1, interface 12). I trying to route just a certain host (140.239.191.10 - which is whatismyipaddress.com for testing purposes) via the wlan instead of the Ethernet card (which has the higher metric).

Let me give you my routing details:

Network Destination | Netmask         | Gateway     | Interface     | Metric
0.0.0.0             | 0.0.0.0         | 10.1.1.1    | 10.1.10.149   | 10
0.0.0.0             | 0.0.0.0         | 172.22.12.1 | 172.22.12.110 | 20

Now I tried the following:

route add 140.239.191.10 mask 255.255.255.255 172.22.12.1 metric 1 if 12

and I get this addition to the route table

140.239.191.10      | 255.255.255.255 | 172.22.12.1 | 172.22.12.110 | 31

And here lies the problem I think: The route is automatically assigned a metric of 31 and hence the traffic is not routed via my wlan interface, but via the ethernet (because of the lower metric). When surfing to the IP I still see the public IP address of my ethernet adapter and not the public IP address of the WLAN adapter (which are entire different networks - local DSL and UMTS).

I do not want to give the wlan the lower metric because I generally want to use the ethernet interface for all network traffic (it is faster and I can access my internal network shares) - I only want to route a single IP via the WLAN adapter.

Any suggestions appreciated!

Dennis

share|improve this question
    
Windows will always use the most specific route regardless of metric (exceptions apply in certain very uncommon configurations). So the route you added, which is for one specific IP address will always be used for that IP regardless of it's metric (unless there is another route equally as specific, in which case metric is the arbitrator). If your browser held a persistent connection with the web server (which most HTTPv1.1 browser do) then the initial connection would have been on the LAN NIC, and would not switch to the WLAN when you added the new route. –  Chris S May 30 '11 at 14:54
    
The previous comment by @ChrisS is false. Windows 7 does not use the most specific route. See my upvote comment in my response to a downvote comment below. –  danorton Aug 25 '12 at 17:07
    
@danorton What evidence or reference material do you have to back that up? –  Chris S Aug 26 '12 at 3:55

3 Answers 3

Well I am doing exactly the same and Windows 8 insists in using the "LAN" gateway... instead of the "WLAN" gateway.

So, not sure is Windows is "capricious" :) or not; but I guess this command should be straight forward to use.

Tried several combinations, like not using the specific IF for WLAN or setting a lower METRIC or using a MASK for ...108.142.0. Always the same result; it apparently gets ignored.

route ADD 93.108.142.151 10.30.94.1 IF 13 (where 10.30.94.1 if the WLAN gateway)

After the command is given a route print and a tracert returns

Active Routes:
Network Destination     Netmask          Gateway       Interface       Metric
0.0.0.0                 0.0.0.0          10.30.60.1    10.30.61.140    20
0.0.0.0                 0.0.0.0          10.30.94.1    10.30.94.25     25
93.108.142.151          255.255.255.255  10.30.94.1    10.30.94.25     21

C:\Windows\system32>tracert 93.108.142.154

   1     2 ms    1 ms     1 ms  10.30.60.1
   2     1 ms    1 ms     1 ms  192.168.191.55
   3    10 ms    8 ms     8 ms  192.168.79.97

share|improve this answer
up vote 0 down vote accepted

hmm - it seems to be working now without me changing anything (I actually went to get a coffee). Maybe windows takes some time to use the new settings?

Would I have to do a ipconfig /renew or something so the settings are used immediately?

share|improve this answer
    
I'm going to guess that if you'd tried to reach the host before adding the route, ipconfig/flushdns would get rid of the cached failure? –  Kara Marfia Jan 6 '10 at 18:03
    
Yep, flushdns was the correct thing to do, thanks! –  Dennis G Jan 8 '10 at 8:32

Well, this is really weird but win 7 somehow manages to change the route for an unreachable host to another interface/gateway. so basically it screws with your routing table base on specific IPs without you knowing it. i find that really disturbing and inconvenient.

share|improve this answer
    
-1 Sorry, but if you really don't understand Windows networks at all, best not to try and interpret how it behaves. –  Chris S May 30 '11 at 14:51
    
+1 Poi is correct. Windows 7 routing is capricious. A lot of people don't understand Windows networks, and many of those people work at Microsoft and many more who don't understand Windows networking post condescending replies here. Windows 7 will often ignore the specified interface when a route is added and when it does record the specified interface, it ignores it internally. Windows 7 certainly does not choose the most specific route entry, although it well should. –  danorton Aug 25 '12 at 18:38
    
@danorton Suggesting that Windows is "capricious" or any other personification of a logical, if misunderstood, system is ignorant and irrational. If you have encountered a situation where your expected outcome does not match what you are experiencing, please detail it, and there is an explanation (better than Windows getting moody). –  Chris S Aug 26 '12 at 3:55

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.