How to setup routing on a Windows 7 machine

3

I have a machine with 2 network interfaces. The network itself looks like this

               | access point | wi-fi     |   my machine |           | 2-nd machine |
               |  192.168.1.1 | --------- | 192.168.1.37 | Ethernet  |              |
Internet ----  | 76.77.15.87  |           |  192.168.0.1 | --------- | 192.168.0.2  |

I found, how to setup routing on a Windows machine:

http://www.home-network-help.com/ip-forwarding.html

I did exactly as it said there. On my machine

1. Set HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/Tcpip/Parameters/IPEnableRouter to 1

2. Setup the blank default gateway on my machine for 192.168.0.1 interface

3. Rebooted the machine

4. Turned off the firewall (just in case)

On the 2-nd machine set 192.168.0.1 as a default gateway.

But it still doesn't work:

from the 2-nd machine ping 192.168.0.1 works. ping 192.168.1.1 doesn't work.

On my machine ping 192.168.1.1 works.

What could be wrong here? How to debug?

user4035

Posted 2014-07-07T09:36:37.683

Reputation: 821

How does the access point know to send packets bound to 192.168.0.1 to this machine? And if it has no way to know, how can the ping reply ever get back to the source? – David Schwartz – 2014-07-07T09:38:43.353

@DavidSchwartz Ahh, my machine must get a reply and redirect it back. How to do it? – user4035 – 2014-07-07T09:39:45.927

With a route, of course. Every machine has to know how to reach every subnet you're expecting it to be able to reach. (If the default router will do it, then there's nothing else you need to do. But if not, you need to add a subnet route.) – David Schwartz – 2014-07-07T09:40:33.037

@DavidSchwartz Can you give a route command? I tried about 2 times, but failed. – user4035 – 2014-07-07T09:41:38.707

It has to go on the access point, telling it to route 192.168.0.0/24 to 192.168.1.37 – David Schwartz – 2014-07-07T09:42:32.233

@DavidSchwartz Ahha, will try – user4035 – 2014-07-07T09:43:00.157

@DavidSchwartz Hurray, it worked. Many thanks. – user4035 – 2014-07-07T09:45:18.423

Answers

4

Machines can reach other machines in their same local subnet thanks to a subnet route. And machines can reach anything their gateway can reach thanks to their default route. But neither of these applies to the access point trying to reach the machine pinging it. So the ping reply has no way to get back to the source machine. You need to add a subnet route.

As a general rule of thumb, every device that is some other device's default gateway should have a route to every local subnet unless its default gateway is another local device. I assume that your access point is some other device's default gateway and its default gateway is not local, so it should have a route to every local subnet. If I'm reading your question correctly, the access point needs to know that packets bound for 192.168.0.0/24 should be sent to 192.168.1.37.

David Schwartz

Posted 2014-07-07T09:36:37.683

Reputation: 58 310