I have an individual network with a single machine having IP Address Another machine (Gateway Machine) has two NICs: eth0 and eth1. eth1 ( is connected to the internal network machine and has no direct connection with the outside world. eth0 ( is connected to the external physical adapter.

Now, I want to communicate with the external network machine having IP Address I have added the default gateway in the internal network machine as:

$ route add default gw

(The default gateway for the external network is I've also added the default gateway in the Gateway machine as:

$ route add default gw 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 netmask gw

The Gateway machine can also directly communicate with the external machine ( using iperf etc.

Now the problem I am facing is that when I ping the external machine( through the internal network machine(; 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 ( can also successfully ping and (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 ( 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.



did you allow ip forwarding?

echo 1 > /proc/sys/net/ipv4/ip_forward

btw - try ip command instead of route.

  • Hi pQd, indeed it was a problem with ip forwarding. I used the command and it worked perfectly fine. Also I had to add some entries in the iptables but ip forwarding was a pre-requisite. Thanks alot.
    – Abdullah
    Aug 3 '12 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.