Advertisement
lifeboy

iptables

Jul 28th, 2013
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.93 KB | None | 0 0
  1. iptables -t nat -A POSTROUTING -j MASQUERADE
  2. iptables -t nat -A POSTROUTING -s 172.16.1.0/24 -o br0 -j MASQUERADE
  3. iptables -t nat -A POSTROUTING -s 172.16.0.0/24 -o br0 -j MASQUERADE
  4. iptables -A FORWARD -j ACCEPT -i br0 -s 172.16.0.0/24
  5. iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
  6. iptables -A INPUT -i lo -j ACCEPT
  7.  
  8. /sbin/sysctl -p /etc/sysctl.conf
  9. brctl setfd br0 4.0
  10.  
  11. Which results in these:
  12. $ sudo iptables -L
  13. Chain INPUT (policy ACCEPT)
  14. target     prot opt source               destination        
  15. ACCEPT     all  --  anywhere             anywhere            
  16.  
  17. Chain FORWARD (policy ACCEPT)
  18. target     prot opt source               destination        
  19. ACCEPT     all  --  172.16.0.0/24        anywhere            
  20. ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
  21.  
  22. Chain OUTPUT (policy ACCEPT)
  23. target     prot opt source               destination
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement