Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Say we have 3 Windows 7 machines, A, B, C, all on the same subnet.

A - 192.168.1.2

B - 192.168.1.3 - nobody has this ip, doesn't exist on the subnet

C - 192.168.1.4

Running tracert 192.168.1.4 on A shows that it goes directly to C.

Let's say I want to route traffic from A to C via B (the non-existent ip, to force any existing TCP connections from A to C to drop). On XP all I have to do is add a route on A like this:

route add 192.168.1.4 192.168.1.3

Once I do this, after a while my already established connection will eventually break. As expected pinging 192.168.1.4 doesn't work anymore.

This does not work on Windows 7, after adding that route, I am still able to reach 192.168.1.4 via ping and tracert shows that it goes directly from 192.168.1.2 to 192.168.1.4.

Is there a way to do this in Windows 7, like it used to work on XP?

Thanks

share|improve this question
1  
Why on earth would you do this? Might be a good idea to clarify what are you trying to archive with it. –  Marc-Andre R. Jun 15 '11 at 19:32
    
It's very useful when testing communication protocols. I can route traffic through a Linux machine on which I can apply different types of delay, data loss, bit errors, etc... –  user86000 Jun 30 '11 at 21:24

2 Answers 2

It should work exactly the same way, it does for me! Maybe when you set it you didn't check the metric valule? A route entry which has a lower metric value will take precedence over another enrty. Also your command is wrong anyway and wouldn't even work on XP.

It should be as follows:

route add 192.168.1.4 mask 255.255.255.255 192.168.1.3 metric 1

maybe you typed (on win 7 machine)

route add 192.168.1.4 mask 255.255.255.0 192.168.1.3 metric whatever

technically that destination network (192.16.1.4) because of the subnet mask being 255.255.255.0 is exactly the same as:

route add 192.168.1.0 mask 255.255.255.0 on-link metric

which as we know is a default route entry. It now has two routing entries to exactly the same destination with (possibly) the same metric value, which one should it choose? There is no way for it to choose a preffered method over the other. What happens next I am unsure of. It will either randomly choose either of the routes (load balanced so to speak) or it will choose the on-link one all the time as this entry implies that the destination is closer (directly attached). Either way this wouldn't matter as you have misconfigured the routes. The correct way would be to add the entry I first posted.

EDIT: I just tested this exact scenario you have on my Windows 7 PC and it worked.

share|improve this answer
    
I just tried it again on my Windows 7 machine and it works fine now, I used the same command as before: route add 192.168.1.4 192.168.1.3 I suspect the previously the On-link route had a lower metric value than my newly added route. –  user86000 Jun 30 '11 at 20:32

It wasn't working for me because I was adding a route to force it to go to a destination address that doesn't exist. I do this all the time on XP so that I can get connections to break for testing but on Windows 7 this doesn't work.

Adding a route such as: route add 192.168.1.4 192.168.1.3 where the destination does exist, works fine, which leads me to think that Windows 7 is smarter than XP in that it can choose a different route if the destination of the route I added doesn't exist.

On XP, once I add a route to go to a destination ip that doesn't exist, I can no longer ping the target ip. So the question should have been: On Windows 7 how do I add a bad route so that my already established connection will break.

The answer is:

In the past on XP I would just add a route to go to an IP that doesn't exist but on Windows 7 I need to add a route to go to an IP that exists but can't route and the effect should be the same.

share|improve this answer

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.