ASL-ASL VPN with dynamic IPs on both ends works

Got it running  

You need:
dyndns or no-ip account for both ends
dynip-updateclient configured and working on both ends 
(we use no-ip-client compiled with pluspack on a 3.2 ASL)
nslookup from tools.tgz
faith


configure your VPN on both ASL with actual IPs
as 'standard'. Use PSK for testing.

create a script in /usr/local/sbin

#!/bin/bash
# yes, it is really ugly :-)
cp /etc/wfe/conf/netdata /tmp/
nslookup  | grep Address | cut -d : -f 2 | cut -d \ -f 3 > /tmp/your-VPN-partner.txt
sed /127.0.0.1/d /tmp/your-VPN-partner.txt > /tmp/your-VPN-partner1.txt
newip=`cat your-VPN-partner1.txt`
#echo $newip
cat /etc/wfe/conf/netdata | grep your-VPN-partner_red | cut -d \# -f 3 > /tmp/compare.txt
sed /your-VPN-partner_red/d /tmp/netdata > /tmp/netdata1 && \
line1='X#your-VPN-partner_red#' && \
line2='#255.255.255.255#V' && \
line3=$line1$newip$line2 && \
echo $line3 >> /tmp/netdata1 && \
diff your-VPN-partner1.txt compare.txt || \
cp /tmp/netdata1 /etc/wfe/conf/netdata && \
chmod 644 /etc/wfe/conf/netdata && \
chown wwwrun.nogroup /etc/wfe/conf/netdata


don't forget to chmod it executable and call this script by cron every 5 minutes

when you touch netdata, mdw reconfigures your connections.

have fun,

Erik
  
Parents
  • could you give more explanation please. i dont got it working. ive installed tools.tgz on both astaros. both ends are dynamic. ive created a script called dynscript on both ends and put the lines below in both of the files.

    #!/bin/bash
    cp /etc/wfe/conf/netdata /tmp/
    nslookup  | grep Address | cut -d : -f 2 | cut -d \ -f 3 > /tmp/your-VPN-partner.txt
    sed /127.0.0.1/d /tmp/your-VPN-partner.txt > /tmp/your-VPN-partner1.txt
    newip=`cat your-VPN-partner1.txt`
    #echo $newip
    cat /etc/wfe/conf/netdata | grep your-VPN-partner_red | cut -d \# -f 3 > /tmp/compare.txt
    sed /your-VPN-partner_red/d /tmp/netdata > /tmp/netdata1 && \
    line1='X#your-VPN-partner_red#' && \
    line2='#255.255.255.255#V' && \
    line3=$line1$newip$line2 && \
    echo $line3 >> /tmp/netdata1 && \
    diff your-VPN-partner1.txt compare.txt || \
    cp /tmp/netdata1 /etc/wfe/conf/netdata && \
    chmod 644 /etc/wfe/conf/netdata && \
    chown wwwrun.nogroup /etc/wfe/conf/netdata

    i made both files executable. what next...  
  • Good one j!

    In response to orhan, run it interactively or try sticking

    exec 1>>log_path 
    exec 2>>log_path 

    at the top of the script; this will capture errors to a file for your review...

    Did you load it in  cron  like the man said? [click on the cron link here]

    uncue: he said the nslookup from tools; that does not mean you have to load the entirety of tools. Extract the nslookup, run it interactively to see if it needs any libraries, go back and add those; done...

    This script could be enhanced to substitute name lookups on any network definition name containing an embedded dot (such as gateway.friend.comgateway.branch-office.com, or mail-relay.isp.net). So now your firewall rules could work dynamically too. Preferable to use statics from a security standpoint, but for those situations where you have to support it. Does anybody know if the DynDNS posted at Astaro.org supports DNSSEC??
  • Re: DNSSEC; got it;

    the nslookup could be replaced with dig (I loaded it on mine from RedHat 8, +requisite libraries). ezipupdate does not appear to support DNSSEC, but nsupdate from another distro will...
      
Reply Children
No Data