Results 1 to 4 of 4
Hello,
My network configuration:
1st pc.
eth0 - local area (192.168.0.1)
eth1 - internet
iptables -t nat -A POSTROUTING -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
2nd pc.
eth0 - 192.168.2.1 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 10-21-2007 #1Just Joined!
- Join Date
- Sep 2007
- Location
- Lithuania
- Posts
- 7
Network forwarding - both directions
Hello,
My network configuration:
1st pc.
eth0 - local area (192.168.0.1)
eth1 - internet
iptables -t nat -A POSTROUTING -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
2nd pc.
eth0 - 192.168.2.1 \
eth1 - 192.168.1.1 / sharing internet to local area network
eth2 - 192.168.0.2 -> getting internet from 1st pc.
iptables -t nat -A POSTROUTING -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
3rd pc.
eth0 - 192.168.1.2 -> getting internet from 2nd pc.
The problem is:
from 3rd pc I can ping all ips in network, but from 1st pc I can ping only 192.168.0.2. I don't see even "192.168.1.1"
Why I need that? I want to redirect xxx port from 1st pc to 3rd pc.
Any ideas?
- 10-22-2007 #2
>but from 1st pc I can ping only 192.168.0.2. I don't see even "192.168.1.1"
> Any ideas?
I assume that you have mask 255.255.255.0 :
1PC: 192.168.0.1\24 network 192.168.0.0
2PC: 192.168.2.1\24 network 192.168.2.0
- 192.168.1.1\24 network 192.168.1.0
My fist guess is that PC1 and PC2 are on different networks so can not sees each other.
hope this helps
- 10-23-2007 #3Just Joined!
- Join Date
- Sep 2007
- Location
- Lithuania
- Posts
- 7
Then why I see pc1 from pc3?
It looks like:
internet <- eth1-pc1-eth0 <-> eth2<-| pc2-eth1 <-> eth0-pc3
pc3 see - pc2 all eths, pc1 all eths
pc2 see - pc3 eth, pc1 all eths
pc1 see - only pc2 eth2
- 10-28-2007 #4Just Joined!
- Join Date
- Sep 2007
- Posts
- 4
this will be a very long answer

your pc1 having a default route 0/0 via eth1.
any route will be forward to that interface.
try add static route to 1.0/24 and 2.0/24 network via their respective interface.
and modify your -t nat statements (both on pc1 and pc2) to include only nat-ed interface :
ipt -t nat -I POSTROUTING -o <internet_intf> bla bla...
why?
so that your interfaces wont get nat-ed all of them.
HTH.


Reply With Quote

