Reference Manual

HOW TO connect a network behind a gateway to the Internet

Problem:

NAT32 is connecting the private network 172.16.2.0 to the Internet. On that private network, there is a gateway at 172.16.2.2 which connects to another network 172.16.5.0. Our aim is to configure NAT32 and that gateway to allow 172.16.5.x machines to reach the Internet. NAT32 is using the private IP address 172.16.2.254 in this example.

Solution:

Add the following command to your NAT32 user.txt file:

route add 172.16.5.0 255.255.255.0 172.16.2.2 15 0
The above command tells NAT32 to forward all packets for the 172.16.5.0 subnet to the gateway 172.16.2.2.

Our example gateway has two IP addresses: 172.16.2.2 and 172.16.5.1 (because it connects to both the 172.16.2.0 and the 172.16.5.0 subnets), and it must be configured to use the default route 172.16.2.254, which is the address of NAT32 on the private LAN. Note that if the gateway is a Windows machine, it too will have Internet access through NAT32. Don't forget to set its DNS address to 172.16.2.254 though!

The private machines on the 172.16.5.0 subnet must be configured to use the gateway 172.16.2.254 too, but because that gateway isn't directly reachable (it can only be reached though the 172.16.2.2 gateway) you can't just add that gateway to the Properties of the TCP/IP Protocol with Control Panel Network.

Instead, you do the following:

Note that the private machines should also use 172.16.2.254 as their DNS address.

Important:

You must use Class B private IP addresses for the above example to work.
SEE ALSO
route
Edit this page