Skip to content

Instantly share code, notes, and snippets.

@pldubouilh
Last active July 31, 2016 16:47
Show Gist options
  • Select an option

  • Save pldubouilh/73b67e439c5fcfcbca68551ddd11469e to your computer and use it in GitHub Desktop.

Select an option

Save pldubouilh/73b67e439c5fcfcbca68551ddd11469e to your computer and use it in GitHub Desktop.
Multi protocol/port openvpn

Prep conf files

cp server.conf udp.conf
cp udp.conf tcp.conf

Amend udp.conf

proto udp
port 1194
server 10.8.0.0 255.255.255.0
[...]

Amend tcp.conf

proto tcp
port 995
server 10.9.0.0 255.255.255.0
[...]

NAT

iptables -t nat -A POSTROUTING -s 10.9.0.0/24 -j SNAT --to PUBLIC_IP_SERVER
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to PUBLIC_IP_SERVER

TCP 80 > 995 (server)

iptables -t nat -A PREROUTING -p tcp -d PUBLIC_IP_SERVER --dport 80 -j REDIRECT --to-ports 995

UDP 53 > 1194 (serveR)

iptables -t nat -A PREROUTING -p udp -d PUBLIC_IP_SERVER --dport 53 -j REDIRECT --to-ports 1194

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment