+---+
eth1- *.1.6| S |
=========| |
|PC1|private net --------------------
| |==============|||PC 2 with eth0 *.0.7|||
| R |eth0-*.0.6 --------------------
+---+
eth1 = interface with internet eth0 = interface private
eth1 and eth0 are two different network
I'd like to share my internet connection to my PC2. I guess it should work with some Iptables rules but doesn't work for me or I don't konw how to do it ...
here is my iptables on PC1:
Chain PREROUTING (policy ACCEPT 6 packets, 789 bytes)
pkts bytes target prot opt in out source destination
Chain INPUT (policy ACCEPT 6 packets, 789 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 3 packets, 218 bytes)
pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 1 packets, 60 bytes)
pkts bytes target prot opt in out source destination
2 158 MASQUERADE all -- * eth0 0.0.0.0/0 0.0.0.0/0
Chain INPUT (policy ACCEPT 2796 packets, 273921 bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 3217 packets, 335744 bytes)
pkts bytes target prot opt in out source destination
I used this command ( sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE ) on my PC1
I tried lot of tutorial but PC2 can't get access to internet !
What can I do ? I'm completly stuck
cat /proc/sys/net/ipv4/ip_forward
should give 1.sudo iptables -t nat -v -x -n -L
andsudo iptables -v -x -n -L
. I don't think thistarget prot opt source destination MASQUERADE all -- anywhere anywhere
is correct.