Guest User

Untitled

a guest
May 21st, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. echo "Flushing iptables..."
  4. iptables -F
  5.  
  6. echo "SSH Allowed"
  7. iptables -A INPUT -p tcp --dport 22 -j ACCEPT
  8.  
  9. echo "allow from localhost"
  10. iptables -A INPUT -i lo -j ACCEPT
  11.  
  12. echo "allow from 192.168.1.1-100"
  13. iptables -I INPUT 3 -i eth0 -m iprange --src-range 192.168.1.1-192.168.1.100 -j ACCEPT
  14.  
  15. echo "allow all pings"
  16. iptables -I INPUT 5 -p icmp -j ACCEPT
  17.  
  18. # Set default policies for INPUT, FORWARD and OUTPUT chains
  19. iptables -P INPUT DROP
  20. iptables -P FORWARD DROP
  21. iptables -P OUTPUT ACCEPT
  22.  
  23. # Accept packets belonging to established and related connections
  24. iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
Add Comment
Please, Sign In to add comment