Objective
-------------
I am trying to connect a desktop(in LAN) to internet by setting its gateway on another desktop who is on a different LAN and getting internet by having its gateway configured on a DHCP server.
Scenario
---------
System A (Virtual Machine)
NIC - eth0
IP 192.168.1.2
Netmask 255.255.255.0
Gateway 192.168.1.1
Broadcast 192.168.1.255
OS Ubuntu
System B (Server, Virtual Machine)
NIC - eth0 and eth1
eth0-IP 10.1.31.5 (through DHCP, internet enabled)
Netmask 255.255.0.0
Gateway 10.1.31.254 (configured on another DHCP server)
OS Ubuntu
Configuration
---------------
I have configured the eth1 of System B as a gateway of system A with IP 192.168.1.1, netmask 255.255.255.0.
System B is able to ping System A and vice-versa but no internet on system A.
What I want to do is to get the internet on system A from system B.
What I am confused about is what I require?
- do I need to bridge eth0 and eth1 on System B and then routing packets from System A via its gateway configured on system B?
- do I need to add routing rules on system A and B that will do the following-
1. when I will type ping
www.google.com on system A, the packet will reach on eth1 of systemB.
2. eth1 of systemB will pass the packet to eth0 of systemB and it will be passed to the gateway of systemB which is configured on a DHCP server and hence connecting to the internet.
I dont know if the logic seems to be fully correct or not but I need your help guys.
I tried doing both the things but something is not working the way it should be. I need someone who can guide me to this to get it working.
Please help.