Background: I want to check the speed of the various servers of my VPN provider and wrote a script which runs iperf3 for each of the servers. The script does not modify the networking setup in any way.The problem: while a plain openvpn command brings in a functional tunnel, adding the script breaks the communication.Please also see my EDIT at the end of the question which may an indication of what is going on. I also modified the title of the question for that reasonCase 0: no openvpn - networking OKThe routing table is default via 10.0.3.1 dev eth010.0.3.0/24 dev eth0  proto kernel  scope link  src 10.0.3.46Case 1: plain openvpn - networking OKThe command# openvpn --config at3.nordvpn.com.tcp443.ovpn --auth-user-pass auth.txt(...)Sat Mar  5 19:06:17 2016 /sbin/ip link set dev tun0 up mtu 1500Sat Mar  5 19:06:17 2016 /sbin/ip addr add dev tun0 local 10.7.7.210 peer 10.7.7.209Sat Mar  5 19:06:17 2016 /sbin/ip route add 37.252.190.165/32 via 10.0.3.1Sat Mar  5 19:06:17 2016 /sbin/ip route add 0.0.0.0/1 via 10.7.7.209Sat Mar  5 19:06:17 2016 /sbin/ip route add 128.0.0.0/1 via 10.7.7.209Sat Mar  5 19:06:17 2016 /sbin/ip route add 10.7.7.1/32 via 10.7.7.209Sat Mar  5 19:06:17 2016 Initialization Sequence Completedbrings in a tunnel with the associated routes0.0.0.0/1 via 10.7.7.209 dev tun0default via 10.0.3.1 dev eth010.0.3.0/24 dev eth0  proto kernel  scope link  src 10.0.3.4610.7.7.1 via 10.7.7.209 dev tun010.7.7.209 dev tun0  proto kernel  scope link  src 10.7.7.21037.252.190.165 via 10.0.3.1 dev eth0128.0.0.0/1 via 10.7.7.209 dev tun0Traceroute to www.google.com is OK# traceroute 66.102.1.103traceroute to 66.102.1.103 (66.102.1.103), 30 hops max, 60 byte packets 1  10.7.7.1 (10.7.7.1)  32.933 ms  65.328 ms  65.332 ms 2  37-252-190-129.rev.ipax.at (37.252.190.129)  65.341 ms  65.337 ms  65.335 ms(...)Case 2: openvpn with a script - networking failsOpenVPN started with# openvpn --config at3.nordvpn.com.tcp443.ovpn --auth-user-pass auth.txt --script-security 2 --route-delay 5 --route-up ./testlink.sh at3.nordvpn.com.tcp443.ovpn(...)Sat Mar  5 19:11:20 2016 /sbin/ip link set dev tun0 up mtu 1500Sat Mar  5 19:11:20 2016 /sbin/ip addr add dev tun0 local 10.7.7.210 peer 10.7.7.209Sat Mar  5 19:11:25 2016 /sbin/ip route add 37.252.190.165/32 via 10.0.3.1Sat Mar  5 19:11:25 2016 /sbin/ip route add 0.0.0.0/1 via 10.7.7.209Sat Mar  5 19:11:25 2016 /sbin/ip route add 128.0.0.0/1 via 10.7.7.209Sat Mar  5 19:11:25 2016 /sbin/ip route add 10.7.7.1/32 via 10.7.7.209+ server=at3.nordvpn.com.tcp443.ovpn+ iperf3 -J -c ping.online.netThe last two lines are the beginning of my script. iperf3 hangs as it cannot reach the iperf3 server.The routing table looks good (= it is the same as the previous one with plain openvpn, I even did a diff on the outputs to be sure):0.0.0.0/1 via 10.7.7.209 dev tun0default via 10.0.3.1 dev eth010.0.3.0/24 dev eth0  proto kernel  scope link  src 10.0.3.4610.7.7.1 via 10.7.7.209 dev tun010.7.7.209 dev tun0  proto kernel  scope link  src 10.7.7.21037.252.190.165 via 10.0.3.1 dev eth0128.0.0.0/1 via 10.7.7.209 dev tun0But the same traceroute to www.google.com fails:# traceroute 66.102.1.103traceroute to 66.102.1.103 (66.102.1.103), 30 hops max, 60 byte packets 1  * * * 2  * * * (...)Why? EDITI did one more test: to have a simple, non-blocking script which echoes hello and exits.To my surprise, the traceroute now works, after the Initialization Sequence Completed line was logged.It looks like there are further initialization steps being done between the script launch and this log entry. How in that case can I run a blocking script? (blocking in the sense that it does some actions dependent on the network being up), or in other words - after the initialization is complete?
How to run a script after OpenVPN initialization is completed?
networking;openvpn