I'm trying to share internet connection between two host using ethernet device and using pointopoint method but havent yet get any proper response,
Here is the chronology:

setting ip :

host a

ifconfig eth0 10.0.1.1 pointopoint 10.0.1.2 netmask 255.255.255.255

host b

ifconfig eth0 10.0.1.2 pointopoint 10.0.1.1 netmask 255.255.255.255

setting router(host A):

from host a, which host a had set ip_forward to '1' (sysctl and /proc/net/ipv4/)

iptables -A PREROUTING -t nat -j MASQUERADE

and on host b I've done on cli

route add default dev eth0

with /etc/resolv.conf contain

nameserver 8.8.8.8

when pinging google the response like this :

PING google.com (209.85.231.104) 56(84) bytes of data.
From 10.0.1.2 icmp_seq=2 Destination Host Unreachable
From 10.0.1.2 icmp_seq=3 Destination Host Unreachable

oh my? where is my exactly fault ?

thanks in advance guys :)

link|improve this question
When you ping Google which host are you pinging from? On host A, what interface is your internet connection on? – bahamat Jan 30 '11 at 19:14
the internet connection interface is ppp0.. and 'route add default gw 10.0.1.2' havent yet make this issue solves... any idea ? – capede Jan 30 '11 at 19:54
ah im pinging google.com from host B(10.0.1.2) – capede Jan 30 '11 at 20:14
Can you ping google from host A? Can host A and host B ping each other? Also, make sure you do not configure your interfaces in pointopoint mode. – bahamat Jan 31 '11 at 4:27
feedback

1 Answer

First, don't use pointopoint.

Secondly, your route on Host B should be:

route add default gw 10.0.1.2

You want to set your iptables rule to the following:

iptables -A PREROUTING -t nat -i eth0 -o ppp0 -j MASQUERADE

If you can provide more information I'll expand this answer to help you better.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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