понедельник, 31 августа 2009 г.

Windows. Set up NAT routing via console

Run [ services.msc ]. On the list find “Routing and Remote Access”, double click on it and set the Startup type to “Automatic” and click OK.

Now edit the following registry path:

My Computer > HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > Services > Tcpip > Parameters

Now in the list you will see something like “IPEnableRouter”.
Double click on it and turn the value from 0 to 1.

Now restart your computer.

You must know the names of your adapters you are using. For the tutorial we will use “Wireless Network Connection” for the public NIC and “Local Area Connection” for the private NIC.

Now we open the command prompt and type the following command to install NAT:
netsh routing ip nat install

Now type the next command to add the public interface:
netsh routing ip nat add interface "Wireless Network Connection" full

And the last command to add the private interface:
netsh routing ip nat add interface "Local Area Connection" private

Set an IP to the private NIC of the machine that is doing routing and the clients will use that IP as their default gateway. The client’s IP addresses must be the same subnet as the gateways. Your public NIC’s IP doesn’t need to be changed!