Guest User

Untitled

a guest
Jan 17th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. # $net_iface is eth1 in this case
  2. # $L2TP_NET is 192.168.80.0/24
  3. # $XAUTH_NET is 192.168.81.0/24
  4.  
  5. iptables -I INPUT 1 -p udp --dport 1701 -m policy --dir in --pol none -j DROP
  6. iptables -I INPUT 2 -m conntrack --ctstate INVALID -j DROP
  7. iptables -I INPUT 3 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
  8. iptables -I INPUT 4 -p udp -m multiport --dports 500,4500 -j ACCEPT
  9. iptables -I INPUT 5 -p udp --dport 1701 -m policy --dir in --pol ipsec -j ACCEPT
  10. iptables -I INPUT 6 -p udp --dport 1701 -j DROP
  11. iptables -I FORWARD 1 -m conntrack --ctstate INVALID -j DROP
  12. iptables -I FORWARD 2 -i "$net_iface" -o ppp+ -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
  13. iptables -I FORWARD 3 -i ppp+ -o "$net_iface" -j ACCEPT
  14. iptables -I FORWARD 4 -i ppp+ -o ppp+ -s "$L2TP_NET" -d "$L2TP_NET" -j ACCEPT
  15. iptables -I FORWARD 5 -i "$net_iface" -d "$XAUTH_NET" -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
  16. iptables -I FORWARD 6 -s "$XAUTH_NET" -o "$net_iface" -j ACCEPT
  17. # Uncomment if you wish to disallow traffic between VPN clients themselves
  18. # iptables -I FORWARD 2 -i ppp+ -o ppp+ -s "$L2TP_NET" -d "$L2TP_NET" -j DROP
  19. # iptables -I FORWARD 3 -s "$XAUTH_NET" -d "$XAUTH_NET" -j DROP
  20. iptables -A FORWARD -j DROP
  21. iptables -t nat -I POSTROUTING -s "$XAUTH_NET" -o "$net_iface" -m policy --dir out --pol none -j MASQUERADE
  22. iptables -t nat -I POSTROUTING -s "$L2TP_NET" -o "$net_iface" -j MASQUERADE
Add Comment
Please, Sign In to add comment