Advertisement
pablopc

Wireguard IPTables Configuration

Feb 4th, 2024
882
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.76 KB | Cybersecurity | 0 0
  1. # Interfaces
  2. # LAN enp0s3
  3. # TUN wg0
  4.  
  5. *nat
  6. -P POSTROUTING ACCEPT
  7. -P PREROUTING ACCEPT
  8. # NAT the VPN client traffic to LAN
  9. -A POSTROUTING -s 10.10.10.0/24 -o enp0s3 -j MASQUERADE
  10.  
  11. COMMIT
  12.  
  13. *filter
  14. # Default Politics
  15. -P INPUT DROP
  16. -P FORWARD DROP
  17. -P OUTPUT ACCEPT
  18.  
  19. # Allow traffic between TUN & LAN
  20. -A FORWARD -i wg+ -o enp0s3 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
  21. -A FORWARD -i enp0s3 -o wg+ -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
  22.  
  23. # Allow apt update/upgrade
  24. -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
  25. # Allowed Services
  26. -A INPUT -p udp --dport 51820 -j ACCEPT
  27. -A INPUT -p tcp --dport 22 -j ACCEPT
  28. -A INPUT -p icmp -s 10.10.10.0/24 -j ACCEPT
  29.  
  30. -A INPUT -j DROP
  31. -A FORWARD -j DROP
  32. -A OUTPUT -j ACCEPT
  33.  
  34. COMMIT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement