Routing via a linux machine.
I am a university student and very new to networking with linux. I am trying to do some routing via linux but am stuck at a point. I'll explain my problem in detail:
I have an individual network with a single machine having IP Address 10.10.10.4. Another machine (Gateway Machine (ubuntu 11.10 )) has two NICs: eth0 and eth1. eth1 (10.10.10.10) is connected to the internal network machine and has no direct connection with the outside world. eth0 (192.168.1.171) is connected to the external physical adapter.
Now, I want to communicate with the external network machine having IP Address 192.168.1.185. I have added the default gateway in the internal network machine as:
$ route add default gw 10.10.10.10
(The default gateway for the external network is 192.168.1.1). I've also added the default gateway in the Gateway machine as:
$ route add default gw 192.168.1.171 to direct the traffic to the outside world.
For the incoming traffic I've also included the network by using the route command:
$ route add -net 10.10.10.0 netmask 255.255.255.0 gw 10.10.10.10
The Gateway machine can also directly communicate with the external machine (192.168.1.185) using iperf etc.
Now the problem I am facing is that when I ping the external machine(192.168.1.185) through the internal network machine(10.10.10.4); I'm able to see the packets destined for the external machine at the eth1 interface in Gateway Machine using wireshark.The internal network machine (10.10.10.4) can also successfully ping 10.10.10.10 and 192.168.1.171 (eth0 IP).
However the packets are unable to reach the eth0 interface. and as a consequence the internal network machine can not communicate with the outside network. I verified this using wireshark that the packets are being received on the eth1 interface which is configured as the default gateway for the internal machine (10.10.10.4). As I have also added a default route in the gateway machine I expect the packets to reach out to the external network via eth0 but this doesnt happen and the packets dont reach the eth0 interface. Can Anyone please help me in this and point out if I am missing something? All help much appreciated.