Skip to content

Instantly share code, notes, and snippets.

@danielholmstrom
Last active August 29, 2015 14:00
Show Gist options
  • Save danielholmstrom/11372057 to your computer and use it in GitHub Desktop.
Save danielholmstrom/11372057 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Setup iptables and save them
iptables --flush
iptables --flush -t nat
# Forward all ports to openvpn server
iptables -t nat -A PREROUTING -d {{ public_openvpn_ip }} -p udp --match multiport --dport 2:1193 -j DNAT --to-destination :1194
iptables -t nat -A PREROUTING -d {{ public_openvpn_ip }} -p udp --match multiport --dport 1195:65535 -j DNAT --to-destination :1194
# Save rules
iptables-save > /etc/iptables.up.rules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment