Here i would like to set up two private network lets call network 192.168.3.x and 192.168.56.x, Later we will try to access a machine staying at 192.168.56.x from 192.168.3.x.
Lets assume we have machine powered by Ubuntu 14.04, connected to the network 192.168.3.X. We are assuming that the IP is 192.168.3.27. Lets call this machine as M27.
We will add two virtual machines in (Using virtualbox) M27 . Lets call them VM1 and VM2. In VM1 we will add two network interface.
Both the VM have installed Cent Os.
Interface 1: eth0 : connected to 192.168.3.x network.
Interface 2: eth1 : Connected to a host-only network. (192.168.56.x)
config of eth0
IP Address-192.168.3.29
Gateway - 192.168.3.1(like other machine in 192.168.3.x network)
config of eth1
IP Address-192.168.56.199
Now we will enable the ip forward from sysctl.conf file.
All done for VM1.
Now VM2 will be added consisting of one network interface which is only host only type assigning IP 192.168.56.103.
Now we will add a static rule in 192.168.3.x network router. In my case it is a sonicwall router.
So here is the picture how can you add a static rule in this particular router.
After adding this you will be able to access this protected VM from any machines in your 3.x network.
*Comment if need more helps regarding this..