I have configured an OpenVPN server in the cloud (Digital Ocean), using this guide.

I have downloaded the client 'ovpn' file, (client is also Ubuntu), and have established a connection ok. However, when I check my public IP from my client, the IP is still showing my dynamic IP assigned by my ISP. Is there a way for my external IP to be the public IP of my VPN server?

As the IP's from my ISP are always blocked by Spamhaus (I'm setting up a home Exchange server lab), I would like a dedicated, static IP provided via my OpenVPN server.

  • What OS is your client running? What's the output of ip route when you're connected? Mar 13, 2018 at 18:04

2 Answers 2


I don't know how your specific provider is set up to work, but the VPN connection is normally set up to route all traffic through the VPN.

Check if your ISP modem is the default gateway.

$ ip route
default via dev wlo1  proto static  metric 600

where is my modem IP in this case. The VPN connection (tun0) should also be in this table if you've connected successfully.

Delete the default gateway, and if that fixes the IP issue (or if you can't connect at all), it means your traffic was being routed through your ISP.

$ sudo ip route del default via

You can add it again with

$ sudo ip route add default via
  • An ip route does indeed state that my home router is the default gateway ( Deleting the route disconnects the VPN, and I'm unable to connect again until I add it back.
    – DMK
    Mar 13, 2018 at 17:35
  • Adding... push "redirect-gateway autolocal"... into the server config file has no effect either.
    – DMK
    Mar 13, 2018 at 17:36
  • Sounds like it might not have connected properly to the VPN. Might be useful to include in your question the output of "ip route" while you're connected to the VPN.
    – Ratler
    Mar 13, 2018 at 17:48

I know this question is a little old, but it might help someone I had the same problem with my VPN client. Just add the option flag --redirect-gateway , this will unsure all outgoing traffic goes over the VPN tunnel

openvpn --config file.ovpn --redirect-gateway

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.