Hi,
I follow up an old thread of jader, because I rewrote the script for easier use. It is still ugly, but there is no need of loading new commands or pluspack.
I know, that it is not wise to use ping in automated scripts for trafic reasons, but I think, I limited it to count=1 every time the cron-job is running and then it is not more traffic than nslookup as Erik suggested.
#!/bin/bash
#
# Script to keep IP-address of VPN with dyndns up-to-date
#
URL= # dyn-URL of your parnter
UG= # Name of partner's gateway in your definitions
#
# Getting actual IP-address
#
newip=`ping -c 1 $URL | sed '2,$d; s/.* (//; s/).*//'`
#
# Getting stored IP-address
#
oldip=`sed -n /$UG/p /etc/wfe/conf/netdata | sed s/.*$UG#// | sed s/#255.*//`
#
# Comparing the address. If not equal, writing new IP-address to netdata
#
if [ $newip != $oldip ]
then
sed s/$oldip/$newip/ /etc/wfe/conf/netdata >/tmp/netdata
sed 's/.*/&/' /tmp/netdata >/etc/wfe/conf/netdata
fi
exit
I hope, that VPN between dynamic adresses is still interesting, but perhaps V5.0 has it already integrated.
Comments?
cu
Walter
This thread was automatically locked due to age.