0

I'm running ubuntu linux on which I try to connect to openvpn server. I tried network gui and also connect from command line, but I always get this error:

/sbin/ip route add 10.0.8.9/32 via 192.168.8.0
Error: Nexthop has invalid gateway.

I'm using client.ovpn config:

proto tcp-client

remote example.com 1194
dev tun

nobind
persist-key
ca ca.crt
cert client.crt
key client.key

tls-client
remote-cert-tls client

ping 10

verb 3

cipher AES-256-CBC
auth SHA1
pull

auth-user-pass
auth-nocache

route 10.0.8.9 255.255.255.255 192.168.8.0

I can successfully connect on windows machine. How to fix this error on linux?

Iwaneez
  • 63
  • 1
  • 8

1 Answers1

1

I'm guessing that the 192.168.8.0/24 network is given to the VPN clients by the server. In this case the last line in your config should be

route 10.0.8.9 255.255.255.255

In this case, the route will be added using the peer address allocated to your client. Usually you don't need to worry about specifying the gateway, your client will guess it from the connection parameters.

Lacek
  • 7,233
  • 24
  • 28
  • At least network manager needs to specify the gateway in order to add valid connection. But I figured out that omitting the route makes the config work and I successfully connected. But still don't know why is this possible. – Iwaneez Jul 07 '20 at 06:36