Lilly
1
Hi,
OpenVPN has a limit up to 64 remote servers in ovpn file.
This limit can by bypassed by re-compilling Openvpn as per info here
https://serverfault.com/questions/983886/how-to-use-more-than-64-remote-options-for-a-random-remote-openvpn-connection
So you could change the #define CONNECTION_LIST_SIZE 64
line in options.h
to #define CONNECTION_LIST_SIZE 256
Otherwise, just to double check, we can upload unlimited number of ovpn files and do with the script, right?
killall openvpn 2>/dev/null
ovpn=$( find /etc/openvpn/ovpn0/ -type f -name "*.ovpn" -print0 | shuf -z -n 1 )
/usr/sbin/openvpn "$ovpn" &
(sleep 1; /etc/init.d/network reload) &
Lilly
2
Correct working script is here
#!/bin/sh
killall openvpn 2>/dev/null
sleep 4
killall openvpn 2>/dev/null
ovpn=$( find /etc/openvpn/ovpn0/ -type f -name "*.ovpn" -print0 | shuf -z -n 1 )
/usr/sbin/openvpn --config $ovpn &
(sleep 5; /etc/init.d/network reload) &
it order to work properly it needs to kill openvpn 2 times
shuf package should be installed from luci
1 Like