I have a configured OpenVPN connection which works fine when connecting from command line

openvpn --config myconfig.conf

Now, I'd like to establish this OpenVPN connection automatically when connecting through a certain WiFi network. Network Manager provides this option but of course requires that the OpenVPN connection is configured through Network Manager.

It works fine. Local connections to the network bridged with the VPN are available, even IPv6 works. However, Network Manager does not set the appropriate gateway which means I cannot reach the Internet over IPv4 through this OpenVPN server.

In paritcular, when I connect using the command line,

nmcli device show tap0



but when I connect using the Network Manager GUI, it returns


Why does that happen? How can I fix it? My config does not contain the gateway address explicitly.

dev tap
resolv-retry infinite
keepalive 1 7

remote 1194 udp


ca ca.crt
cert cert.crt
key key.key
remote-cert-tls server
tls-auth ta.key 1

1 Answer 1


You can modify the gateway for network manager connections from the command line. So while I cannot find this option in the GUI, you can list the connections

nmcli con show

find yours

NAME                     UUID                                  TYPE             DEVICE 
thenameyougaveit         some-id-ksadbf019-aksb821           vpn              wlan1  

change the address (it will be discarded afaict but you cannot change the gateway address without setting it)

nmcli con mod some-id-ksadbf019-aksb821 ipv4.addresses

and then set the desired ip4 gateway

nmcli con mod some-id-ksadbf019-aksb821 ipv4.gateway

And now it works from the GUI. Of course, if anything changes on the other end, it will stop working.

  • Thank you! Just a quick note: I'm on Kubuntu 17.10, and I didn't have to add an ipv4.addresses for my OpenVPN tunnel (name "tun0"). I applied the gateway to tun0 instead of the NM connection name. Sep 7, 2017 at 8:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .