Total Pageviews

Showing posts with label ddns. Show all posts
Showing posts with label ddns. Show all posts

Saturday, 31 August 2024

ddns-by-liulilittle

 DDNS based on web-api implementation. 

Example

ddns.exe 10 "https://freemyip.com/update?token=799860a8a521350297219037&domain=ppp-nat-cdyd-1.freemyip.com"

Effect: ddns-sync every 10 seconds, domain name: "ppp-nat-cdyd-1.freemyip.com"
Apply for ddns: https://freemyip.com/ This is the free DDNS provider, or Google search yourself.

from https://github.com/liulilittle/ddns 

------------

a ddns script based on DNSPod and Cloudflare API.

简介

动态DNS更新脚本,目前支持DnsPod和CloudFlare

功能模块

  • 获取本机的公网地址
  • 更新DNS记录
  • 依靠systemd的timer运行,如公网地址没变则不发起更新请求

配置介绍

通过环境变量配置脚本:

  • PROVIDER: DNS服务商,目前支持dnspodcloudflare
  • TOKEN_ID: ID,对于DNSPod来说是token_id,对于CloudFlare说是用户邮箱
  • TOKEN_KEY: 验证密钥,对于DNSPod来说是token, 对于CloudFlare来说是api_key
  • DOMAIN: 域名,比如xdays.me
  • RECORD: 记录,比如www.xdays.me
  • IP_TYPE: 使用公网地址还是私网地址, 对应为publicprivate

安装

git clone git@github.com:xdays/ddns.git /opt/ddns

准备配置文件 /opt/ddns/.env

PROVIDER=cloudflare
TOKEN_ID=token_id
TOKEN_KEY=token_key
DOMAIN=example.com
RECORD=v.example.com
IP_TYPE=public

集成systemd

cd systemd
./install.sh 
from https://github.com/xdays/ddns 

 

 

Monday, 17 May 2021

收集的一些DDNS的工具


利用shell获得本机局域网IP

ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:"

GO语言版

package main

import (
	"fmt"
	"net"
	"strings"
)

func main() {
	conn, err := net.Dial("udp", "google.com:80")
	if err != nil {
		fmt.Println(err.Error())
		return
	}
	defer conn.Close()
	fmt.Println(strings.Split(conn.LocalAddr().String(), ":")[0])
}

获取外网IP

新浪IP地址库

可以直接script标签引入

直接script引入 http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js

也支持 json 和文本格式

json 格式 http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=json

文本格式 http://int.dpool.sina.com.cn/iplookup/iplookup.php

curl ip.cn 直接给出IP和运营商,浏览器访问不一样 类似于 curl myip.ipip.net

后面还可以跟一个IP地址,查询IP的位置. curl ip.cn/8.8.8.8 , 其网站还提供大陆IP列表,较快的DNS等等

curl ipinfo.io JSON格式,信息较全,可跨域,同样也可以查询指定IPcurl ipinfo.io/8.8.8.8,浏览器访问还会给出地图和网络运营商, http://speedsmart.net 可以测速

curl -i -H "Accept:application/json, text/javascript, */*; q=0.01" https://ipinfo.io

https://freegeoip.net 也提供json,xml,jsonp的详细信息 可用http 也可用https

curl ifconfig.me 速度较慢,浏览器访问不一样,直接给出IP

curl http://httpbin.org/get 直接给出所有请求头,JSON格式.

curl httpbin.org/ip 返回JSON包含IP

curl ip.gs 包含运行商,国家地区

curl cip.cc 包含运营商和地址

直接给出IP

curl ip.6655.com/ip.aspx
curl members.3322.org/dyndns/getip
curl icanhazip.com
curl whatismyip.akamai.com
curl myip.dnsomatic.com
curl ifconfig.co
curl https://api.ipify.org/
curl http://greak.net/ip

curl ipecho.net/plain

http://ip.chinaz.com/getip.aspx 比较详细的地理位置

淘宝的地址库

http://ip.taobao.com/service/getIpInfo2.php?ip=myip

https://jsonip.com/ 返回json数据IP,可以跨域

http://freegeoip.net/json/ 返回当前IP或者指定IP的地址位置和经纬度,支持json和jsonp?callback=fun

域名动态解析

花生壳接口

http://username:password@ddns.oray.com/ph/update?hostname=yourdomain 访问这个地址,会把域名绑定到访问这个地址的外网 ip 上。一般这个 ip 都是你路由器的 ip ,路由器再转发到树莓派上,用域名就可以直接访问树莓派了。 可以用计划任务一段时间更新一次

3322org接口

lynx -mime_header -auth=su:123 "http://members.3322.net/dyndns/update?system=dyndns&hostname=domain"

DNSPOD 接口

网友提供的操作库

https://github.com/xdtianyu/scripts/tree/master/ddns

https://github.com/lijyigithub/ddnspod/blob/master/ddnspod.py

https://github.com/anrip/ArDNSPod/blob/master/ddnspod.sh