Difference between revisions of "Network sharing"

From MyWiki
Jump to: navigation, search
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
  '''Configure iptables for NAT translation so that packets can be correctly routed through the Ubuntu gateway'''
 
  '''Configure iptables for NAT translation so that packets can be correctly routed through the Ubuntu gateway'''
 
  https://help.ubuntu.com/community/Internet/ConnectionSharing
 
  https://help.ubuntu.com/community/Internet/ConnectionSharing
  sudo iptables -A FORWARD -o eth0 -i eth1 -s 192.168.32.0/24 -m conntrack --ctstate NEW -j ACCEPT
+
  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 -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
 
  sudo iptables -t nat -F POSTROUTING
 
  sudo iptables -t nat -F POSTROUTING
  sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
+
  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
 +
 
 +
Work Fedora 20:
 +
iptables --table nat --append POSTROUTING -o em1 -j MASQUERADE
 +
iptables --append FORWARD -i enp0s26u1u2  -j ACCEPT
 +
 
 +
 
 +
Configure access for natted virtual machine
 +
  iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 5903 -j DNAT  --to-destination 10.0.3.197:5901

Latest revision as of 15:41, 27 January 2015

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
Work Fedora 20:
iptables --table nat --append POSTROUTING -o em1 -j MASQUERADE
iptables --append FORWARD -i enp0s26u1u2  -j ACCEPT


Configure access for natted virtual machine
 iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 5903 -j DNAT  --to-destination 10.0.3.197:5901