OpenVPN Configuration - Multiple Ports
I currently have my OpenVPN connection setup to accept connections from: TCP 443, TCP 8080, and UDP 1194. Is there a way that I can have all three of these server configurations assign from just one IP pool? (For ex. 10.7.0.x)
Right now they all assign on their own IP pools:
TCP 443 - 10.7.0.1
TCP 8080 - 10.8.0.1
UDP 1194 - 10.9.0.1
Thank you in advance!
You can run just one OpenVPN server for all TCP ports, and just one OpenVPN server for all UDP ports, and give each server its own IP address pool. Then you can use iptables to redirect ports. Unfortunately it's not possible to combine the TCP and UDP servers because TCP and UDP are very different protocols.
If you want to do this with your TCP servers, choose just one of the ports to run OpenVPN on (let's say 443), and then set up the following iptables rule for the other port (8080):
iptables -t nat -A PREROUTING -d X.X.X.X -p tcp --dport 443 -j DNAT --to-destination :8080
(replace X.X.X.X with your server's IP address)
However, I have now run into the problem where if I connect via TCP 443, there is no set route to 10.8.0.1 and it causes it to try to connect to the local wireless AP I am connected to, which causes my connection to fail.
Is there a solution to this problem? Thanks!
push "route 10.7.0.0 255.255.255.0" push "route 10.8.0.0 255.255.255.0" push "route 10.9.0.0 255.255.255.0"
Now when VPN clients connect they should get routes to your mail server at 10.8.0.1 regardless of which VPN server they connected to.