Advertisement
Guest User

iptable rules

a guest
Nov 29th, 2013
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. # Flush all rules
  2. iptables -F
  3. iptables -X
  4.  
  5. # Allow unlimited outgoing traffic to all networks and protocols (for now)
  6. iptables -P OUTPUT ACCEPT
  7.  
  8. # Allow unlimited incoming traffic on private network for all protocols
  9. iptables -A INPUT -i lo -j ACCEPT
  10.  
  11. # Allow incoming traffic from established/related connections on public network for all protocols
  12. iptables -A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
  13.  
  14. # Allow new (incoming) SSH on public network
  15. iptables -A INPUT -i eth0 -p tcp --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPT
  16.  
  17. # Allow new (incoming) HTTP/HTTPS on public network
  18. # HTTP
  19. iptables -A INPUT -i eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
  20. # HTTPS
  21. iptables -A INPUT -i eth0 -p tcp --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT
  22.  
  23. # Drop everything elese
  24. iptables -P INPUT DROP
  25. iptables -P FORWARD DROP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement