Advertisement
D0cEvil

iptables - OpenVPN

Sep 23rd, 2022 (edited)
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.82 KB | Cybersecurity | 0 0
  1. #Incoming connections
  2.  
  3. iptables -A INPUT -i enp3s8 -m state --state NEW -p udp --dport 1194 -j ACCEPT
  4.  
  5. #Allow TUN interface connections to OpenVPN server
  6.  
  7. iptables -A INPUT -i tun+ -j ACCEPT
  8.  
  9. #Allow TUN interface connections to be forwarded through other interfaces
  10.  
  11. iptables -A FORWARD -i tun+ -j ACCEPT
  12. iptables -A FORWARD -i tun+ -o enp3s8 -m state --state RELATED,ESTABLISHED -j ACCEPT
  13. iptables -A FORWARD -i enp3s8 -o tun+ -m state --state RELATED,ESTABLISHED -j ACCEPT
  14.  
  15. #NAT the VPN client traffic to the Internet. change the ip address mask according to your info of tun0 result while running "ifconfig" #command.
  16.  
  17. iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o enp3s8 -j MASQUERADE
  18.  
  19. #If your default iptables OUTPUT value is not ACCEPT, you will also need a line like:
  20.  
  21. iptables -A OUTPUT -o tun+ -j ACCEPT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement