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
returns
IP4.ADDRESS[1]: 192.168.1.100/24
IP4.GATEWAY: 192.168.1.1
but when I connect using the Network Manager GUI, it returns
IP4.ADDRESS[1]: 192.168.1.100/24
IP4.GATEWAY: 0.0.0.0
Why does that happen? How can I fix it? My config does not contain the gateway address explicitly.
client
dev tap
resolv-retry infinite
nobind
persist-key
persist-tun
comp-lzo
keepalive 1 7
remote 1.1.1.1 1194 udp
redirect-gateway
ca ca.crt
cert cert.crt
key key.key
remote-cert-tls server
tls-auth ta.key 1
Best Answer
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
find yours
change the address (it will be discarded afaict but you cannot change the gateway address without setting it)
and then set the desired ip4 gateway
And now it works from the GUI. Of course, if anything changes on the other end, it will stop working.