Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
IP forwarding ppp -> lan
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
dagobert2000
n00b
n00b


Joined: 26 Jan 2006
Posts: 17

PostPosted: Wed Jun 27, 2007 1:44 pm    Post subject: IP forwarding ppp -> lan Reply with quote

Hi!

Following problem:
***************
I have 2 pc's that are connected via ppp - only one of them has got an internet-connection via eth0.
Now i would like to use the internet-connection of the 2nd computer over ppp! Therefore i tried to setup ip forwarding (ppp0 -> eth0).
Security issues are negligible.... the forwarding for the internet-access shall just work for some testing!

After having read the gentoo-wiki how-to and several other sites about how to do that with iptables i came to the following solution:

Code:

iptables -P INPUT ACCEPT           
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT

iptables -A FORWARD -i ppp0 -o eth0
iptables -A FORWARD -i eth0 -o ppp0

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


Then i saved and (re)started iptables....
On the other pc i set the 2nd pc as the default gateway.

pc1: ppp0 = 192.168.0.2/32
pc2: ppp0 =192.168.0.1/32
ppp0:1=192.168.0.1/24 I have no idea what this 2nd entry means???
eth0 = 10.41.1.1/24


Well, and that way doesn't work. ;-)

Any idea what i have forgotten to do? Or what's wrong?

Thanks a lot!
greez,
dagobert
Back to top
View user's profile Send private message
SiberianSniper
Guru
Guru


Joined: 06 Apr 2006
Posts: 381
Location: Dayton, OH, USA

PostPosted: Wed Jun 27, 2007 1:53 pm    Post subject: Reply with quote

You probably need to set up postrouting/masquerading... I have it all in a couple scripts on my router so I don't have to actually remember anything.

Try something like this:
Code:
iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain
iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
iptables --append FORWARD --in-interface ppp0 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward
/etc/init.d/iptables save
Back to top
View user's profile Send private message
dagobert2000
n00b
n00b


Joined: 26 Jan 2006
Posts: 17

PostPosted: Tue Jul 03, 2007 7:43 am    Post subject: Reply with quote

Hi Sniper!

Thanks for your help, but unfortunately your solution doesn't work either...

any other ideas?
Back to top
View user's profile Send private message
mudrii
l33t
l33t


Joined: 26 Jun 2003
Posts: 789
Location: Singapore

PostPosted: Tue Jul 03, 2007 8:00 am    Post subject: Reply with quote

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -F
iptables -t nat -F
iptables -X
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
iptables -A INPUT -j ACCEPT -m state --state ESTABLISHED,RELATED
iptables -A OUTPUT -j ACCEPT -m state --state ESTABLISHED,RELATED,NEW
_________________
www.gentoo.ro
Back to top
View user's profile Send private message
dagobert2000
n00b
n00b


Joined: 26 Jan 2006
Posts: 17

PostPosted: Fri Nov 02, 2007 9:57 am    Post subject: Solved! Reply with quote

Hi there,

Thanks mudrii for your help, but your solution didn't work either.
Finally I found a way that works fine now! Here's what i got...

---

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

---

Hope some of you can help this too,

bye,
dd
Back to top
View user's profile Send private message
dagobert2000
n00b
n00b


Joined: 26 Jan 2006
Posts: 17

PostPosted: Fri Nov 02, 2007 11:08 am    Post subject: Solved! Reply with quote

Hi there,

Thanks mudrii for your help, but your solution didn't work either.
Finally I found a way that works fine now! Here's what i got...

---

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

---

Hope some of you can help this too,

bye,
dd
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum