openvpn from linux failing on /sbin/ip route add

Need help configuring your VPN? Just post here and you'll get that help.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Post Reply
stephen328
OpenVpn Newbie
Posts: 3
Joined: Wed Mar 22, 2017 7:10 pm

openvpn from linux failing on /sbin/ip route add

Post by stephen328 » Wed Mar 22, 2017 7:28 pm

Hello,

I'm attempting to vpn into a Netgear Nighthawk x6 R8000 (which apparently supports openvpn out of the box). I've downloaded the necessary configuration files and keys from the router - here's my configuration file, client2.conf:

Code: Select all

client
dev tap
proto udp
remote XXX.XXX.XXX.XXX XXXXX
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
cert client.crt
key client.key
cipher AES-128-CBC
comp-lzo
verb 5
Unfortunately, when attempting to vpn,

Code: Select all

sudo openvpn cleint2.conf


I get the following error:

Code: Select all

Wed Mar 22 14:59:42 2017 us=196899 OpenVPN ROUTE: OpenVPN needs a gateway parameter for a --route option and no default was specified by either --route-gateway or --ifconfig options
Wed Mar 22 14:59:42 2017 us=196908 OpenVPN ROUTE: failed to parse/resolve route for host/network: 192.168.1.1
Wed Mar 22 14:59:42 2017 us=197273 TUN/TAP device tap0 opened
Wed Mar 22 14:59:42 2017 us=197300 TUN/TAP TX queue length set to 100
Wed Mar 22 14:59:42 2017 us=197320 do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Wed Mar 22 14:59:42 2017 us=197351 /sbin/ip link set dev tap0 up mtu 1500
Wed Mar 22 14:59:42 2017 us=200684 /sbin/ip addr add dev tap0 192.168.1.5/24 broadcast 192.168.1.255
Wed Mar 22 14:59:42 2017 us=202702 /sbin/ip route add 192.168.1.1/24 via 192.168.1.1
RTNETLINK answers: Invalid argument
Wed Mar 22 14:59:42 2017 us=204134 ERROR: Linux route add command failed: external program exited with error status: 2
Wed Mar 22 14:59:42 2017 us=204189 Initialization Sequence Completed
I've also tried:

Code: Select all

sudo openvpn --config client2.conf --route 192.168.1.1 255.255.255.0
Which seems to lead me to the same error:

Code: Select all

WWRRWRWed Mar 22 15:24:42 2017 us=977952 PUSH: Received control message: 'PUSH_REPLY,route 192.168.1.1 255.255.255.0 192.168.1.1,route-gateway dhcp,ping 10,ping-restart 120'
Wed Mar 22 15:24:42 2017 us=978047 OPTIONS IMPORT: timers and/or timeouts modified
Wed Mar 22 15:24:42 2017 us=978061 OPTIONS IMPORT: route options modified
Wed Mar 22 15:24:42 2017 us=978071 OPTIONS IMPORT: route-related options modified
Wed Mar 22 15:24:42 2017 us=978240 ROUTE_GATEWAY 108.214.92.1/255.255.252.0 IFACE=eth0 HWADDR=34:97:f6:5c:02:ba
Wed Mar 22 15:24:42 2017 us=978613 TUN/TAP device tap0 opened
Wed Mar 22 15:24:42 2017 us=978640 TUN/TAP TX queue length set to 100
Wed Mar 22 15:24:42 2017 us=978694 /sbin/ip route add 192.168.1.1/24 via 192.168.1.1
RTNETLINK answers: Invalid argument
Wed Mar 22 15:24:42 2017 us=980583 ERROR: Linux route add command failed: external program exited with error status: 2
Wed Mar 22 15:24:42 2017 us=980638 Initialization Sequence Completed
Any help is much appreciated - thank you!

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: openvpn from linux failing on /sbin/ip route add

Post by TinCanTech » Wed Mar 22, 2017 8:26 pm

I can not help you with your router.

But ..
stephen328 wrote:I've also tried:

Code: Select all

sudo openvpn --config client2.conf --route 192.168.1.1 255.255.255.0
Try ..

Code: Select all

192.168.1.0 255.255.255.0

stephen328
OpenVpn Newbie
Posts: 3
Joined: Wed Mar 22, 2017 7:10 pm

Re: openvpn from linux failing on /sbin/ip route add

Post by stephen328 » Thu Mar 23, 2017 2:27 pm

Thanks for the response!

Code: Select all

sudo openvpn --config client2.conf --route 192.168.1.0 255.255.255.0
results in the same error unfortunately.

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: openvpn from linux failing on /sbin/ip route add

Post by TinCanTech » Thu Mar 23, 2017 2:33 pm

Are your server and client on the same network ?
IE: Are you at home trying to connect to your router which is also at home ?

stephen328
OpenVpn Newbie
Posts: 3
Joined: Wed Mar 22, 2017 7:10 pm

Re: openvpn from linux failing on /sbin/ip route add

Post by stephen328 » Thu Mar 23, 2017 5:39 pm

Nope different networks, this is for remote access. What's really driving me crazy is the fact that VPNing with tunnelblick using the same configuration files works fine on my mac - but I'm running into these issues on my Ubuntu machine.

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: openvpn from linux failing on /sbin/ip route add

Post by TinCanTech » Thu Mar 23, 2017 5:54 pm

So,
  • NOTE: your local LAN uses the extremely common subnet address 192.168.0.x or 192.168.1.x. Be aware that this might create routing conflicts if you connect to the VPN server from public locations such as internet cafes that use the same subnet.
:arrow: Never use 192.168.0.0/24 or 192.168.1.0/24 (or other common subnets) for your OpenVPN Server LAN :!:
  • You are advised to change your server LAN to a more unique RFC1918 compliant subnet.
    For example: 192.168.143.0/24

Please see:
HOWTO: Request Help !

TiTex
OpenVPN Super User
Posts: 310
Joined: Tue Apr 12, 2011 6:22 am

Re: openvpn from linux failing on /sbin/ip route add

Post by TiTex » Mon Mar 27, 2017 8:22 am

As TinCanTech pointed out , it looks like you are using the same subnet in your LAN and also in the VPN Tunnel
192.168.1.0/24 , ip addr show eth0 | egrep 'inet\b' in your client machine what does the eth0 address say ? , also post your server config

Post Reply