Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have configured Ubuntu 12.04 as Gateway machine.its having two interfaces

 eth0 with ip and 

 eth1 connected to modem with ip address DHCP).

ip-forwarding is enabled in router box.

Client machine is configured as:

ip address and gateway

Client machines can ping router box( when pinged reply is not reaching Client machines but in the tcpdump output on gateway i can see echo request for but never echo reply.Is this because of 122.5 not forwarding request to 2.0 network.Can u please help me in fixing this.


This machine is running as XEN HVM.

Router machine:two interfaces eth0: ip) eth1: on router

  iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE 

 iptables -A FORWARD -i eth0 -j ACCEPT

 iptables -A FORWARD -i eth1 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT

ptables -A FORWARD -i eth0 -o eth1 -j ACCEPT

On the client machine


on the gateway tcpdump result

tcpdump -v -i eth0 is the virtual bridge

tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes

14:17:26.352383 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto ICMP (1), length 84) > ICMP echo request, id 1541, seq 8395, length 64

14:17:26.938156 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto ICMP (1), length 84) > ICMP echo request, id 1513, seq 10735, length 64

tracepath from Client machine:


1: 0.046ms pmtu 1500

1: 0.259ms

1: 0.188ms

2: no reply

3: no reply

share|improve this question
What is the source IP address of the echo request coming out of the gateway? If it's not, that's your problem. NAT/masquerading is not set up correctly. The replies will never get back to the machine since only the gateway machine knows to send them there. – David Schwartz Oct 10 '12 at 11:21

1 Answer 1

up vote 2 down vote accepted

Your modem doesn't know how to reach network. You have to do NAT on your router or you have to tell your modem that should be routed through

For NAT try with these rules:

iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE   
iptables -A FORWARD -i eth0 -j ACCEPT
iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT

Restart your firewall to flush old rules.

share|improve this answer
Actually i am not able to ping i make a rqst to in the tcpdump out of gateway machine i can see echo request but no reply.So doesnt that mean 122 network is not forwarding request to 2.0 network? can u help me please guide me :) – Kevin Parker Oct 10 '12 at 9:20
Your gateway forwards requests from 122. The problem is with replies. Your modem does not know where 192.168.122 network is. So if it got a reply from when trying to sent it to 192.168.122 network it will forward it to its gateway and not to your gateway. If you can set a static route in your modem you could set it to route network via – Laurentiu Roescu Oct 10 '12 at 12:25
I did this on router route add -net netmask gw dev eth1>but still the same.. :( – Kevin Parker Oct 10 '12 at 12:35
This route should be applied on modem, not on router. NAT is a solution too. But the last line has '-i eth1 -o eth1' which is not correct. I suggest you to remove this part or to correct it to -o eth0. – Laurentiu Roescu Oct 10 '12 at 13:20
If NAT ing is an option,then why am i not able to ping public networks. Is anything wrong with the NATing... – Kevin Parker Oct 10 '12 at 13:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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