Routing or Bridging
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.
System A (Virtual Machine)
NIC - eth0
System B (Server, Virtual Machine)
NIC - eth0 and eth1
eth0-IP 10.1.31.5 (through DHCP, internet enabled)
Gateway 10.1.31.254 (configured on another DHCP server)
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 google 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.
192.168.1.0/24 has gateway 192.168.1.1
192.168.1.1 has gateway 10.1.31.254
This means for example:
tracepath from host 192.168.1.16 to 188.8.131.52 should then show something like this: