美文网首页
如何使用linode实现动态DNS

如何使用linode实现动态DNS

作者: 飞翔晴空 | 来源:发表于2014-04-08 11:06 被阅读0次

    <?php

    echo $_SERVER['REMOTE_ADDR'];
    ?>

    bin/sh

    LINODE_API_KEY=your linode key
    DOMAIN_ID=your domain id
    RESOURCE_ID=your resource id

    # Ask your linode what your current home/remote WAN IP is
    WAN_IP=`wget -O - -q http://www.yourlinode.com/MyIP.php`

    # Get your old WAN IP
    OLD_WAN_IP=`cat /var/CURRENT_WAN_IP.txt`

    # See if the new IP is the same as the old IP.
    if [ "$WAN_IP" = "$OLD_WAN_IP" ]; then
    echo "IP Unchanged"
    # Don't do anything if th eIP didn't change
    else
    # The IP changed. Update Linode's DNS to show the new IP
    echo $WAN_IP > /var/CURRENT_WAN_IP.txt
    wget -qO- https://api.linode.com/?api_key="$LINODE_API_KEY"\&api_action=domain.resource.update\&DomainID="$DOMAIN_ID"\&ResourceID="$RESOURCE_ID"\&Target="$WAN_IP"

    fi

    相关文章

      网友评论

          本文标题:如何使用linode实现动态DNS

          本文链接:https://www.haomeiwen.com/subject/dmnktttx.html