Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have 2 PCs (anuin and hed), both running Linux that are connected via ethernet ( and

Both PCs can ping each other.

anuin is connected to the internet via an USB-stick (device ppp0).

What I want is hed to access the internet via anuin.

That should be very easy but it seems I am being very stupid...

Here is my routing table on hed:

hed>sudo route 
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         anuin          UG    0      0        0 eth0     *        U     0      0        0 eth0

hed>ping anuin
PING anuin ( 56(84) bytes of data.
64 bytes from anuin ( icmp_req=1 ttl=64 time=0.218 ms
64 bytes from anuin ( icmp_req=2 ttl=64 time=0.191 ms

On anuin I have flushed all iptables-rules and just added a masquerading rule:

anuin> sudo iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

anuin>  cat /proc/sys/net/ipv4/ip_forward

anuin> sudo iptables -t nat -L
target     prot opt source               destination         

target     prot opt source               destination         
MASQUERADE  all  --  anywhere             anywhere            

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination    

Unfortunately it does not work when I try:

hed> ping
PING ( 56(84) bytes of data.
From icmp_seq=1 Destination Host Unreachable
From icmp_seq=2 Destination Host Unreachable
From icmp_seq=3 Destination Host Unreachable

hed> traceroute anuin
traceroute to anuin (, 30 hops max, 60 byte packets
 1  anuin (  0.203 ms  0.119 ms  0.450 ms

hed> traceroute
traceroute to (, 30 hops max, 60 byte packets
 1 (  3003.607 ms !H  3003.600 ms !H  3003.592 ms !H

This is what I don't get: Even when the masquerading does not work - should I not at least see the one hop to the default gateway (anuin).

Can someone help me here?

share|improve this question

What does ip route get say? If it's the wrong answer, there might be old forwading information cached from prior connection attempts. ip route flush cache should be the remedy in that case.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .