Difference between revisions of "Network sharing"

From MyWiki
Jump to: navigation, search
Line 6: Line 6:
 
  sudo iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE
 
  sudo iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE
  
  This might work better.
+
  This might work better. ( This one works with Desktop Ubuntu )
 
  iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE
 
  iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE
 
  iptables -A FORWARD -i net0 -o eth2 -j ACCEPT
 
  iptables -A FORWARD -i net0 -o eth2 -j ACCEPT

Revision as of 08:43, 2 October 2014

Configure iptables for NAT translation so that packets can be correctly routed through the Ubuntu gateway
https://help.ubuntu.com/community/Internet/ConnectionSharing
sudo iptables -A FORWARD -o eth2 -i eth1 -s 192.168.32.0/24 -m conntrack --ctstate NEW -j ACCEPT
sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -t nat -F POSTROUTING
sudo iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE
This might work better. ( This one works with Desktop Ubuntu )
iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE
iptables -A FORWARD -i net0 -o eth2 -j ACCEPT
iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
This may work better on Centos
[root@is411 ~]# iptables --table nat --append POSTROUTING -o em1 -j MASQUERADE
[root@is411 ~]# iptables --append FORWARD -i p2p1 -j ACCEPT