Openvpn – Linux client unable to connect to OpenVPN server (Nexthop has invalid gateway.)

openvpn

I have a linux client that I am trying to get to connect to my self-hosted offsite OpenVPN server. I have been banging my head against this for a while.
Windows clients connect fine and work correctly (all traffic routed, accessible via the subnet, etc) while attempting to connect with a linux client (tried ubuntu 16.04 server and a handful of openvpn client dockers) yields what appears to be a successful connection to the server followed by:

TUN/TAP device tun0 opened
TUN/TAP TX queue length set to 100
do_ifconfig, tt->did_ifconfig_ipv6_setup=0
/usr/bin/ip link set dev tun0 up mtu 1500

/usr/bin/ip addr add dev tun0 10.8.0.101/26 broadcast 10.8.0.127

/usr/bin/ip route add 0.0.0.0/1 via 10.8.0.1
Error: Nexthop has invalid gateway.
ERROR: Linux route add command failed: external program exited with error status: 2

/usr/bin/ip route add 128.0.0.0/1 via 10.8.0.1
Error: Nexthop has invalid gateway.
ERROR: Linux route add command failed: external program exited with error status: 2

Initialization Sequence Completed

which prevents traffic from going through the VPN. The ifconfig looks correct while (of course) the iptables don't look quite right (tested on a docker container):

# ip route
default via 172.17.0.1 dev eth0
10.8.0.64/26 dev tun0 proto kernel scope link src 10.8.0.101
172.17.0.0/16 dev eth0 proto kernel scope link src 172.17.0.7

Moving the client ovpn to a windows computer yield a perfect connection. I set up the server with this install script and added static IPs manually with the help of this guide yielding a server side setup of:

./server.conf

port 42069
proto udp
dev tun
user nobody
group nogroup
persist-key
persist-tun
keepalive 10 120
topology subnet
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "dhcp-option DNS 208.67.222.222"
push "dhcp-option DNS 208.67.220.220"
push "redirect-gateway def1" 
crl-verify crl.pem
ca ca.crt
cert server_fWRfyP6vszBv9CaM.crt
key server_fWRfyP6vszBv9CaM.key
tls-auth tls-auth.key 0
dh dh.pem
auth SHA256
cipher AES-128-CBC
tls-server
tls-version-min 1.2
tls-cipher TLS-DHE-RSA-WITH-AES-128-GCM-SHA256
status openvpn.log
verb 3
client-config-dir /etc/openvpn/staticclients

./staticclients/[clientname]

ifconfig-push 10.8.0.101 255.255.255.192

and a clientside config of:

[clientname].ovpn

remote *** 42069
client
proto udp
dev tun
resolv-retry infinite
nobind
persist-key
remote-cert-tls server
verify-x509-name server_fWRfyP6vszBv9CaM name
auth SHA256
auth-nocache
cipher AES-128-CBC
tls-client
tls-version-min 1.2
tls-cipher TLS-DHE-RSA-WITH-AES-128-GCM-SHA256
setenv opt block-outside-dns
verb 3
<ca>
-----BEGIN CERTIFICATE-----
...

Any help would be appreciated and I'm willing to provide more details as needed.

Best Answer

Changing the ./staticclients/[clientname] subnet from 255.255.255.192 (/26) to 255.255.255.0 (/24) resolved the issue.