I have an OpenVPN config file which works great from the terminal:
sudo openvpn --config openvpn.conf
After connecting via the terminal, my routing table is as follows:
[van@d2:Desktop]$ ip route
0.0.0.0/1 via 255.255.255.0 dev tun0
default via 192.168.0.1 dev wlp3s0 proto static metric 600
10.9.0.1 via 255.255.255.0 dev tun0
<vpn_server_ip_addr> via 192.168.0.1 dev wlp3s0
128.0.0.0/1 via 255.255.255.0 dev tun0
169.254.0.0/16 dev wlp3s0 scope link metric 1000
192.168.0.0/24 dev wlp3s0 proto kernel scope link src 192.168.0.5 metric 600
255.255.255.0 dev tun0 proto kernel scope link src 10.9.0.4
I wanted to try and get things working from the Network Manager, so I installed network-manager-openvpn
and then imported the VPN connection from the working config file. However, when I connect using the Network Manager, traffic is not routed via the OpenVPN server. The routing table (after connecting using the Network Manager entry) is as follows:
[van@d2:Desktop]$ ip route
default via 192.168.0.1 dev wlp3s0 proto static metric 600
10.9.0.0/24 dev tun0 proto kernel scope link src 10.9.0.4 metric 50
<vpn_server_ip_addr> via 192.168.0.1 dev wlp3s0 proto static metric 600
169.254.0.0/16 dev wlp3s0 scope link metric 1000
192.168.0.0/24 dev wlp3s0 proto kernel scope link src 192.168.0.5 metric 600
192.168.0.1 dev wlp3s0 proto static scope link metric 600
I have tried to add the 0.0.0.0 entry (from the working routing table), but it is rejected:
[van@d2:Desktop]$ sudo ip route add 0.0.0.0/1 via 255.255.255.0 dev tun0
RTNETLINK answers: Network is unreachable
I have also tried removing:
10.9.0.0/24 dev tun0 proto kernel scope link src 10.9.0.4 metric 50
and replacing it with:
10.9.0.1 via 255.255.255.0 dev tun0
but this also fails with a similar error message (the removal worked).
My question is: how can I connect to an OpenVPN server via the Network Manager and force all traffic to be routed via the VPN tunnel?
"IPv4 Settings tab > Routes > Use this connection only for resources on its network"
in the network manager connection?sudo openvpn --config client.ovpn
).