You are not logged in.

#1 2016-09-17 02:49:32

jdevelop
Member
Registered: 2014-04-18
Posts: 48

OpenVPN - can not assign IP address to tun device sometimes

Hello!

From time to time I observe that VPN client can't connect to the server (sometimes it works just fine though). With verb=4 I can see the following:

Fri Sep 16 22:41:01 2016 us=776437 ROUTE_GATEWAY 192.168.1.1/255.255.255.0 IFACE=wlan0 HWADDR=cc:3d:82:6f:99:ce
Fri Sep 16 22:41:01 2016 us=777033 TUN/TAP device tun0 opened
Fri Sep 16 22:41:01 2016 us=777069 TUN/TAP TX queue length set to 100
Fri Sep 16 22:41:01 2016 us=777096 do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0
Fri Sep 16 22:41:01 2016 us=777143 /usr/bin/ip link set dev tun0 up mtu 1500
Fri Sep 16 22:41:01 2016 us=779401 /usr/bin/ip addr add dev tun0 172.24.4.3/24 broadcast 172.24.4.255
Fri Sep 16 22:41:01 2016 us=781126 /usr/bin/ip route add 172.24.0.0/16 via 172.24.4.1
RTNETLINK answers: Network is unreachable
Fri Sep 16 22:41:01 2016 us=782457 ERROR: Linux route add command failed: external program exited with error status: 2
Fri Sep 16 22:41:01 2016 us=782522 /usr/bin/ip route add 172.20.0.0/16 via 172.24.4.1
RTNETLINK answers: Network is unreachable
Fri Sep 16 22:41:01 2016 us=783979 ERROR: Linux route add command failed: external program exited with error status: 2
Fri Sep 16 22:41:01 2016 us=784039 /usr/bin/ip route add 172.21.0.0/16 via 172.24.4.1
RTNETLINK answers: Network is unreachable
Fri Sep 16 22:41:01 2016 us=785470 ERROR: Linux route add command failed: external program exited with error status: 2
Fri Sep 16 22:41:01 2016 us=785521 /usr/bin/ip route add 172.23.0.0/16 via 172.24.4.1
RTNETLINK answers: Network is unreachable
Fri Sep 16 22:41:01 2016 us=786588 ERROR: Linux route add command failed: external program exited with error status: 2
Fri Sep 16 22:41:01 2016 us=786625 /usr/bin/ip route add 172.27.0.0/16 via 172.24.4.1
RTNETLINK answers: Network is unreachable
Fri Sep 16 22:41:01 2016 us=787746 ERROR: Linux route add command failed: external program exited with error status: 2
Fri Sep 16 22:41:01 2016 us=787794 /usr/bin/ip route add 192.168.2.0/24 via 172.24.4.1
RTNETLINK answers: Network is unreachable
Fri Sep 16 22:41:01 2016 us=788939 ERROR: Linux route add command failed: external program exited with error status: 2
Fri Sep 16 22:41:01 2016 us=788975 /usr/bin/ip route add 172.18.0.0/16 via 172.24.4.1
RTNETLINK answers: Network is unreachable
Fri Sep 16 22:41:01 2016 us=790101 ERROR: Linux route add command failed: external program exited with error status: 2
Fri Sep 16 22:41:01 2016 us=790159 /usr/bin/ip route add 192.168.43.0/24 via 172.24.4.1
RTNETLINK answers: Network is unreachable
Fri Sep 16 22:41:01 2016 us=791295 ERROR: Linux route add command failed: external program exited with error status: 2
Fri Sep 16 22:41:01 2016 us=791350 /usr/bin/ip route add 192.168.48.0/24 via 172.24.4.1
RTNETLINK answers: Network is unreachable
Fri Sep 16 22:41:01 2016 us=792473 ERROR: Linux route add command failed: external program exited with error status: 2
Fri Sep 16 22:41:01 2016 us=792519 Initialization Sequence Completed

the client config file is:

client
dev tun
proto udp
remote openvpn.******** 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca /etc/openvpn/server_ca.crt
comp-lzo
verb 1
script-security 2
route-delay
auth-user-pass /etc/openvpn/server.passwd

this works fine though from another host with exactly the same configuration. If I restart VPN client several times, eventually it picks up the IP address. Am I missing something in the config?

I tried using --up-delay, but still no luck.

Linux devbox 4.7.2-1-ARCH #1 SMP PREEMPT Sat Aug 20 23:02:56 CEST 2016 x86_64 GNU/Linux

Last edited by jdevelop (2016-09-17 02:51:57)

Offline

#2 2016-09-21 18:36:37

jethronsun7
Member
Registered: 2016-04-29
Posts: 44
Website

Re: OpenVPN - can not assign IP address to tun device sometimes

Not sure the question can be answered by the Arch community, maybe you can try to post a question on OpenVPN community.

What I have got from the error log is that sometime it shows `network unreachable`, which means even let client ping server will fail, I assume it would be a good place to start with. Some network config on this machine is not stable or what.

Offline

Board footer

Powered by FluxBB