Advertisement
Guest User

iptables rules

a guest
Oct 11th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. sudo iptables --flush
  2. sudo iptables --delete-chain
  3. sudo iptables -t nat -F
  4. sudo iptables -t nat -A POSTROUTING -o tun+ -j MASQUERADE
  5. sudo iptables -A INPUT -i enp1s0 -p tcp --dport 22 -j ACCEPT
  6. sudo iptables -A INPUT -i lo -m comment --comment "loopback" -j ACCEPT
  7. sudo iptables -A OUTPUT -o lo -m comment --comment "loopback" -j ACCEPT
  8. sudo iptables -I INPUT -i enp1s0 -m comment --comment "In from LAN" -j ACCEPT
  9. sudo iptables -I OUTPUT -o tun+ -m comment --comment "Out to VPN" -j ACCEPT
  10. sudo iptables -A OUTPUT -o enp1s0 -p udp --dport 443 -m comment --comment "openvpn" -j ACCEPT
  11. sudo iptables -A OUTPUT -o enp1s0 -p udp --dport 123 -m comment --comment "ntp" -j ACCEPT
  12. sudo iptables -A OUTPUT -p UDP --dport 67:68 -m comment --comment "dhcp" -j ACCEPT
  13. sudo iptables -A OUTPUT -o enp1s0 -p udp --dport 53 -m comment --comment "dns" -j ACCEPT
  14. sudo iptables -A FORWARD -i tun+ -o enp1s0 -m state --state RELATED,ESTABLISHED -j ACCEPT
  15. sudo iptables -A FORWARD -i enp1s0 -o tun+ -m comment --comment "LAN out to VPN" -j ACCEPT
  16. sudo iptables -P FORWARD DROP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement