Advertisement
Guest User

Untitled

a guest
May 26th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. #! /bin/sh
  2.  
  3. # enable IP forwarding
  4. echo 1 > /proc/sys/net/ipv4/conf/all/forwarding
  5. echo 1 > /proc/sys/net/ipv4/conf/default/forwarding
  6. echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
  7. echo 1 > /proc/sys/net/ipv6/conf/default/forwarding
  8. echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter
  9. echo 0 > /proc/sys/net/ipv4/conf/default/rp_filter
  10.  
  11.  
  12. iptables -F
  13. iptables -t nat -F
  14.  
  15. iptables -P INPUT ACCEPT
  16. iptables -P OUTPUT ACCEPT
  17. iptables -P FORWARD ACCEPT
  18.  
  19.  
  20. iptables -A FORWARD -i eth0 -s 172.31.54.0/255.255.255.0 -j ACCEPT
  21. iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
  22.  
  23. iptables -A INPUT -p icmp --icmp-type 8 -j DROP
  24. ip6tables -A INPUT -p ipv6-icmp --icmpv6-type 8 -j DROP
  25.  
  26.  
  27. iptables -A INPUT -p tcp --destination-port 53 -j ACCEPT
  28. iptables -A INPUT -p udp --destination-port 53 -j ACCEPT
  29. iptables -A INPUT -p tcp --destination-port 80 -j ACCEPT
  30. iptables -A INPUT -p udp --destination-port 80 -j ACCEPT
  31.  
  32. ip6tables -A INPUT -p tcp --destination-port 53 -j ACCEPT
  33. ip6tables -A INPUT -p udp --destination-port 53 -j ACCEPT
  34. ip6tables -A INPUT -p tcp --destination-port 80 -j ACCEPT
  35. ip6tables -A INPUT -p udp --destination-port 80 -j ACCEPT
  36.  
  37. iptables -A INPUT -p tcp --destination-port 1:65535 -j DROP
  38. iptables -A INPUT -p udp --destination-port 1:65535 -j DROP
  39.  
  40. ip6tables -A INPUT -p tcp --destination-port 1:65535 -j DROP
  41. ip6tables -A INPUT -p udp --destination-port 1:65535 -j DROP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement