当前位置:网站首页>网络运维系列:GoDaddy Shell DDNS配置
网络运维系列:GoDaddy Shell DDNS配置
2022-08-02 14:16:00 【蒲春伟】
1. 引言
由于IP地址的稀缺性,日常办理的家用宽带出口IP地址都是动态变化的,为了能够动态的知道家用宽带的出口IP以便能够便捷的访问到家里的网络设备,如NAS、远程桌面等,参考通用做法采用DDNS方案,由于域名是在GoDaddy申请的,整体技术方案需要通过GoDaddy申请秘钥对,然后通过开放URL地址对域名的DNS解析指向进行修改,下面是具体的流程。
2. GoDaddy密钥申请
密钥Key申请:https://developer.godaddy.com/keys ,选择Production,名字自定义即可,生成密钥对后请记得及时保存,后续无法再次查看。
3. Shell脚本配置
#!/bin/bash
# This script is used to check and update your GoDaddy DNS server to the IP address of your current internet connection.
# Special thanks to mfox for his ps script
# https://github.com/markafox/GoDaddy_Powershell_DDNS
#
# First go to GoDaddy developer site to create a developer account and get your key and secret
#
# https://developer.godaddy.com/getstarted
# Be aware that there are 2 types of key and secret - one for the test server and one for the production server
# Get a key and secret for the production server
#
#Update the first 4 variables with your information
domain="your.domain.to.update" # your domain
name="name_of_host" # name of A record to update
key="key" # key for godaddy developer API
secret="secret" # secret for godaddy developer API
headers="Authorization: sso-key $key:$secret"
# echo $headers
result=$(curl -s -X GET -H "$headers" \ "https://api.godaddy.com/v1/domains/$domain/records/A/$name")
#echo $result;
dnsIp=$(echo $result | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b")
#echo "dnsIp:" $dnsIp
# Get public ip address there are several websites that can do this.
ret=$(curl -s GET "http://ipinfo.io/json")
currentIp=$(echo $ret | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b")
#echo "currentIp:" $currentIp
if [ "$dnsIp" != "$currentIp" ];
then
# echo "Ips are not equal"
request='[{"data":"'$currentIp'","ttl":3600}]'
# echo " request:" $request nresult=$(curl -i -s -X PUT \ -H "$headers" \ -H "Content-Type: application/json" \ -d $request "https://api.godaddy.com/v1/domains/$domain/records/A/$name") # echo "result:" $nresult
fi
4. 定时任务配置
sudo crontab -e
*/10 * * * * sh /config/scripts/aliddns/aliddns_erx.sh
5. 参考文档
github地址:https://github.com/markafox/GoDaddy_Powershell_DDNS
边栏推荐
- HCIE学习记录——数据封装与常用协议(TCP/UDP)
- Oauth2.0 自定义响应值以及异常处理
- Mysql锁机制与事务隔离
- Oauth2.0 authentication server adds verification code login method
- Mysql索引优化一
- 转行软件测试,从零收入到月薪过万,人生迎来新转折
- [Inter-process communication]: pipe communication/named/unnamed
- Oauth2.0 custom response values and exception handling
- Mediasoup 杂谈(待完善)
- 【软件测试】测试基础讲解
猜你喜欢

WEB自动化之多窗口操作、切换frame、弹窗处理

华为Vlan创建及原理简单说明

JVM常量池详解

CDH (computational Diffie-Hellman) problem and its differences with discrete logarithm and DDH problems

【线程安全】用户级,内核级,组合级线程|线程同步的处理(条件变量)|strtok_r(可冲入函数)

理解:野指针,空指针,失效指针。

Vert.x web 接收请求时反序列化对象 Failed to decode 如何解决?

OpenPose Basic Philosophy

MYSQL5.7详细安装步骤

移动端UI自动化相关环境配置
随机推荐
固态硬盘到底要不要分区
Mediasoup 杂谈(待完善)
Apache ShardingSphere 5.1.2 发布|全新驱动 API + 云原生部署,打造高性能数据网关...
implement tcp bbr on ns3 (在ns3上实现TCP BBR)
LAMP 环境搭建 yum源安装方式 (Apache 2.4.6 +mysql 8.0.28+php 8.1.3)
MYSQL5.7详细安装步骤
【软件测试】进阶篇
【个人向】线性表复习
Oauth2.0 认证服务器添加验证码登陆方式
Mysql开启日志并按天进行分割
Oauth2.0 security (take WeChat authorized login as an example)
Mysql-Explain与索引详解
图解MESI(缓存一致性协议)
Vmware workstation16 安装 ESXi 6.7 详细步骤
【软件测试】自动化测试selenium3
Oauth2.0 补充
分布式一致性协议-Gossip
"Array" look-up table method (leap year)
CDH(computational Diffie-Hellman)问题以及与离散对数、DDH问题的区别
Template series-union set