Adding an OpenVPN Connection using an ovpn file in Ubuntu 24.04.3 LTS

by Aug 19, 2025IT Tips0 comments

Download your ovpn file to your computer

Click on the network icon on the top right and click the gear icon

In the Network area of Settings click the plus sign next to VPN

An Add VPN popup will appear. Click Import from file...

Navigate to, select and then Open your ovpn file

Select the identity tab, scroll to find the user and pass (if you are using user / pass auth) and enter those details. Click Add

You will return to the following screen. Test your VPN by clicking the toggle. The toggle will stay to the right when the connection is successful

You can also see your VPN is connected because a small "VPN" icon will appear in the top right of your screen

Expand the VPN tgn... spin control and click the toggle control to turn your OpenVPN connection off.

Configuring Use this connection only for resources on its network

If you check https://ifconfig.me/ip and find that your computer is using the VPN for all you web traffic (not just what it needs to contact on the remote network) do the following. Note: If the OpenVPN Server doesn't push the right routes you may have to add routes aswell. See Adding Manual Routes below

If you don't want all your traffic routed through the remote network go back into Network => Under VPN => Your Connection Name (e.g. tgn-UDP4-1194-rupert-config) => Click the Gear icon

In the connection properties dialog select the IPv4 tab and check the "Use this connection only for resources on its network" and Apply the change.

Use a service like https://ifconfig.me/ip to verify your current external IP address is as expected.

Adding Manual Routes

You only need to Add Manual Routes if the remote OpenVPN server doesn't push the correct remote networks to your client.

Generally leaving it Automatic is fine. You will know there is routing issue after you configure "Use this connection only for resources on its network" and you can no longer access the remote resources you could before hand.

There is a trick to adding manual routes.

To use the remote OpenVPN server as the gateway you need to specify the gateway as 0.0.0.0. If you don't specify a gateway the routes won't apply, or save.

So you need to add the routes using the format NETWORK, NETMASK, GATEWAY e.g.

10.9.10.0 255.255.255.0 0.0.0.0

After you click Apply and then reconnect the VPN the routes you set should be correctly shown as follows.

# use the following command in a terminal to see your routes
sudo ip route show

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.