Page 1 of 1

Random select host

Posted: Mon Mar 14, 2016 1:06 pm
by ookonek
Hi!

I am looking for script which automatically change VPN host from list.

For example:

I have some vpn hosts:

VPNLIST=(01.vpn.host.pl 02.vpn.host.pl 03.vpn.host.pl 04.vpn.host.pl)

(in bash could be)
RANDOM=$$$(date +%s)
selectVPNLIST=${VPNLIST[$RANDOM % ${#VPNLIST[@]} ]}
echo $selectVPNLIST

..and I would random select only one host and add it to pptp-client...

/interface pptp-client add name=Somename connect-to=$selectVPNLIST ...

I don't know how to prepare script in mikrotik which automatically change vpn host every 24 hours.
Could anybody help me?

Re: Random select host

Posted: Mon Mar 14, 2016 1:19 pm
by patrikg
Why not just use the dns with round robin ??
Make a cname with many entries.

Re: Random select host

Posted: Mon Mar 14, 2016 1:30 pm
by ookonek
I would make script which turn off vpn interface, select new host and add one more time interface with new hostname.

I don't think its good idea to use DNS for me.

I need "only" random function to select hostname from list. :P

Re: Random select host

Posted: Thu Mar 17, 2016 11:53 pm
by ookonek
Nobody hasn't any idea? Help me! :)


If I will use dns with round robin how can I do it?