Ubuntu – Setting Up OpenVPN Client on Amazon EC2

amazon ec2openvpnUbuntu

I have an account with an OpenVPN service, and I'd like to get that running on my EC2 instance running Ubuntu 12.04.

I have my config file in /etc/openvpn, and it connects fine when I run sudo openvpn –config matt.ovpn. However, I then lose connectivity to the EC2 machine, and I can't SSH back to it until I reboot.

Previously I have done things like sudo ip rule add from IP_ADDRESS table 10 and then sudo ip route add default via GATEWAY_IP table 10, but that's not working on EC2.

Any ideas? My private IP address right now is 10.209.29.XXX and my gateway is 10.209.29.1.

Best Answer

Your OpenVPN configuration probably has the redirect-gateway directive, which will change the default route to point to the VPN once the VPN has started. Remove or comment out this line to prevent this from happening.

Related Topic