Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revisionBoth sides next revision
tutorials:mdns-tutorial [2011/04/30 14:42] – created clemenstutorials:mdns-tutorial [2012/01/15 22:31] – Relocate sdf-eu=zdns note to the top of the page memnon
Line 1: Line 1:
 ==== WAN IP Retrieval and Dynamic DNS (mdns) ==== ==== WAN IP Retrieval and Dynamic DNS (mdns) ====
 +**Note** that on **SDF-EU**, the command to set the dynamic address is [[faq:basics11|"zdns"]], not mdns.
  
 There are a myriad of ways to automatically keep your **mdns** updated on SDF. Below are a couple: There are a myriad of ways to automatically keep your **mdns** updated on SDF. Below are a couple:
Line 30: Line 31:
  
   #!/bin/ksh   #!/bin/ksh
-  ssh me@remote.host '~/bin/ip' >/dev/null+  ssh me@remote.host '~/bin/ip' >/dev/null
  
 </code> </code>
Line 38: Line 39:
 <code bash> <code bash>
   #!/bin/ksh   #!/bin/ksh
-  ssh me@remote.host '~/bin/ip' &gt;&gt;$HOME/logs/ip_update+  ssh me@remote.host '~/bin/ip' >>$HOME/logs/ip_update
  
 </code> </code>
Line 68: Line 69:
 "wget http://yourlogin.freeshell.org/setmdns.cgi?keyword"\\ "wget http://yourlogin.freeshell.org/setmdns.cgi?keyword"\\
  
-where you set appropriate paths and replace the keyword according to your choice (it is currently set to 'setmdns'). Note also that on SDF-EU, the command to set the dynamic address is "zdns", not mdns.+where you set appropriate paths and replace the keyword according to your choice (it is currently set to 'setmdns'). 
  
 If everything is ok, the script will respond with the output of the mdns command; otherwise, it will simply echo your query. All calls are logged, including the IP of the calling host and the submitted query string. The script keeps track of the IP and runs the mdns command only if the IP has changed since the last call. If everything is ok, the script will respond with the output of the mdns command; otherwise, it will simply echo your query. All calls are logged, including the IP of the calling host and the submitted query string. The script keeps track of the IP and runs the mdns command only if the IP has changed since the last call.
Line 89: Line 90:
   HOME=`finger $LOGNAME|awk '/^Directory:/{print $2}'`   HOME=`finger $LOGNAME|awk '/^Directory:/{print $2}'`
   export LOGNAME HOME   export LOGNAME HOME
-  echo "`date -u +%c`     $REMOTE_ADDR    $QUERY_STRING" &gt;&gt;$LOGF+  echo "`date -u +%c`     $REMOTE_ADDR    $QUERY_STRING" >>$LOGF
   chmod 600 $LOGF   chmod 600 $LOGF
-  cat &lt;&amp;&gt;/dev/null ; then+  cat <&>/dev/null ; then
    if [ -d "$HOME" ] ; then    if [ -d "$HOME" ] ; then
     if [ "$REMOTE_ADDR" = "`cat $OLDIP`" ] ; then     if [ "$REMOTE_ADDR" = "`cat $OLDIP`" ] ; then
Line 97: Line 98:
     else     else
      $DNSCOM $REMOTE_ADDR      $DNSCOM $REMOTE_ADDR
-     echo $REMOTE_ADDR &gt;$OLDIP+     echo $REMOTE_ADDR >$OLDIP
     fi     fi
    else echo "no $DNSCOM due to bad HOME=$HOME"    else echo "no $DNSCOM due to bad HOME=$HOME"
Line 105: Line 106:
   fi   fi
 </code> </code>
 +