Hamachi (1) Bridging Networks Together (Windows) - Teh

advertisement

Hamachi (1) Bridging Networks Together (Windows)

This is an advanced solution; don’t do anything of this if you don’t know what you are doing.

There are some “small” versions of Windows that don’t support this “server level” routing.

READ THE WHOLE GUIDE BEFORE YOU GET STARTED

The purpose of this guide is to show you how to bridge two networks of Windows computers together using a single Windows (2000, XP, Vista or 7) machine on each network running the old version of Hamachi.

Initial Setup

First, you need to have Hamachi set up and running on a computer on each network. Ensure the status of each computer is “green”. Next, you’ll need to turn on Routed Tunneling on both computers.

To do this, create a file called Hamachi-override.ini in the C:\Users\<username>\AppData\Roaming\Hamachi

(Windows 7) and c:\Documents and Settings\<username>\Application Data\Hamachi (Windows XP)

Inside Hamachi-override.ini add the line RoutedTunneling 1 and save the file

Restart Hamachi on both computers to have this setting take effect. But you can wait till you have finished next step!

Configuring Windows for IP Routing

This is necessary for Windows to be able to send packets destined for the other location’s network through the

Hamachi virtual adapter. This will need to be done on both of the computers that will act as the VPN end points.

To do this, create (run regedit.exe):

HKEY\Local_Machine\System\CurrentControlSet\Services\Tcpip\Parameters\IPEnableRouter as a string value equal to 1 in the registry (this should be the same on each supported versions of Windows), this will require a system reboot to take effect.

Configuring Static Routes across the VPN

In order for the Hamachi computers to be able to route packets destined for the network on the other side of the connection, you’ll need to set a static route to say so.

In this scenario, we’ll use two networks, 192.168.1.x and 172.16.x.x to illustrate

(Remember to run cmd as admin on Windows Vista & 7)

On the Hamachi computer that is on the 192.168.1.x computer, you’ll use

Command Prompt>route –p add 172.16.0.0 mask 255.255.0.0 5.x.x.x (Hamachi IP of PC on 172.16.x.x network)

On the Hamachi computer that is on the 172.16.x.x network, you’ll use

Command Prompt> route –p add 192.168.1.0 mask 255.255.255.0 5.x.x.x (Hamachi IP of PC on the 192.168.1.x network)

You should now be able to ping the 172.16.x.x computer from the 192.168.1.x computer using its real IP address and vice versa. If not, check your firewall settings.

If you did something wrong or just want to delete the route again you can use “delete” instead of “-p add”

Tying It All Together

Now for the fun part; you need to tell your other machines how to cross the VPN to access computers on the opposite network.

There are two alternative here. You can either add a static route on each computer needing to cross the VPN, or you can add a static route pointing the Hamachi machine on the router acting as the default gateway for the network.

Option 1:

This requires more work, but limits configuration changes to be at the computer level.

(Remember to run cmd as admin on Windows Vista & 7)

On each computer on the 192.168.1.x network:

Command Prompt>route –p add 172.16.0.0 mask 255.255.0.0 192.168.1.x (IP of Hamachi computer on the

192.168.1.x network)

Optioinal: On each computer on the 192.168.1.x network:

Command Prompt>route –p add 5.0.0.0 mask 255.0.0.0 192.168.1.x (IP of Hamachi computer on the

192.168.1.x network)

On each computer of the 172.16.x.x network:

Command Prompt>route –p add 192.168.1.0 mask 255.255.255.0 172.16.x.x (IP of Hamachi computer on the

172.16.x.x network)

Optional: On each computer of the 172.16.x.x network:

Command Prompt>route –p add 5.0.0.0 mask 255.0.0.0 172.16.x.x (IP of Hamachi computer on the 172.16.x.x network)

I recommend that you make a .BAT file and write these commands in the .BAT file, if you have many computers to work with. (Remember to run it as admin on Windows Vista & 7)

Option 2: (not all routers support this, but it is the minimal configuration method)

On the router acting as the default gateway for 192.168.1.x network, add a static route that says any traffic destined for 172.16.0.0 network go through 192.168.1.x (IP address of Hamachi PC on 192.168.1.x network)

On the router acting as the default gateway for 172.16.x.x network, add a static route that says any traffic destined for 192.168.1.0 network go through 172.16.x.x (IP address of Hamachi PC on 172.16.x.x network)

You should also add a rule in each router the points all traffic destined for the 5.0.0.0 network to point through the local network's Hamachi machine (local network IP, not Hamachi IP). This isn't "absolutely" necessary, but will take care of any uncertainty in the routing scheme.

A couple notes

Some firewalls block ping requests even if the rules are added to allow them. That can make troubleshooting on this setup quite interesting. I recommend turning off the firewall during initial setup to save you some headaches.

Dedicate the Hamachi computers to this task only. Since you’re essentially adding these computers as dedicated VPN routers, treat them like that. Since all of this routing requires system resources, these computers will get flaky if you multipurpose them to other tasks, unless you're using servers or high-end computers. I say that for example, that if you, play games on these machines (running Hamachi), it will impact

VPN users going through these machines.

RUN HAMACHI AS A SERVICE. If you don’t know why I’m saying this, this solution may be more technical of a solution than you really need. Basically, running as a service means that the computer runs the Hamachi program as an integrated component at startup, rather than as a Startup program when you log on.

If this is not a permanent solution in your case; remember to delete all added routes (“delete” instead of “-p add”) and set \IPEnableRouter to 0 in regedit.exe

//handswork

Download