View previous topic :: View next topic |
Author |
Message |
dagobert2000 n00b
Joined: 26 Jan 2006 Posts: 17
|
Posted: Wed Jun 27, 2007 1:44 pm Post subject: IP forwarding ppp -> lan |
|
|
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 |
|
|
SiberianSniper Guru
Joined: 06 Apr 2006 Posts: 381 Location: Dayton, OH, USA
|
Posted: Wed Jun 27, 2007 1:53 pm Post subject: |
|
|
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 |
|
|
dagobert2000 n00b
Joined: 26 Jan 2006 Posts: 17
|
Posted: Tue Jul 03, 2007 7:43 am Post subject: |
|
|
Hi Sniper!
Thanks for your help, but unfortunately your solution doesn't work either...
any other ideas? |
|
Back to top |
|
|
mudrii l33t
Joined: 26 Jun 2003 Posts: 789 Location: Singapore
|
Posted: Tue Jul 03, 2007 8:00 am Post subject: |
|
|
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 |
|
|
dagobert2000 n00b
Joined: 26 Jan 2006 Posts: 17
|
Posted: Fri Nov 02, 2007 9:57 am Post subject: Solved! |
|
|
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 |
|
|
dagobert2000 n00b
Joined: 26 Jan 2006 Posts: 17
|
Posted: Fri Nov 02, 2007 11:08 am Post subject: Solved! |
|
|
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 |
|
|
|