0
I have 2 PCs (anuin and hed), both running Linux that are connected via ethernet (192.168.1.1 and 192.168.1.3).
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 0.0.0.0 UG 0 0 0 eth0
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
hed>ping anuin
PING anuin (192.168.1.1) 56(84) bytes of data.
64 bytes from anuin (192.168.1.1): icmp_req=1 ttl=64 time=0.218 ms
64 bytes from anuin (192.168.1.1): icmp_req=2 ttl=64 time=0.191 ms
^C
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
1
anuin> sudo iptables -t nat -L
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
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 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
From 8.8.8.8 icmp_seq=1 Destination Host Unreachable
From 8.8.8.8 icmp_seq=2 Destination Host Unreachable
From 8.8.8.8 icmp_seq=3 Destination Host Unreachable
^C
hed> traceroute anuin
traceroute to anuin (192.168.1.1), 30 hops max, 60 byte packets
1 anuin (192.168.1.1) 0.203 ms 0.119 ms 0.450 ms
hed> traceroute 8.8.8.8
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets
1 8.8.8.8 (8.8.8.8) 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?