方法一:在计划任务里加个脚本 有软路由就没个卵用,拿到的IP是我美国线路的IP而非真实的IP,如果没有代理是可以的,只支持IPV4; z0 I. E4 j* v% o: o$ F1 b# L
0 y; h6 J4 C+ |hostname="www.zXXX.COM"% P( i- q5 c& u/ g/ t
email="[email protected]", s+ k! ~. w; m2 c
2 A/ Z6 |+ Y2 yzone_id="50ea882c589DFDF84af7886f31e7dfb" 区域ID3 z9 f3 Z: I3 X/ @+ l! B$ z
global_api_key="c9e9DFDFd815135c5bbdf50ac48c9fc67c" ID
) Z2 Z& R Y4 ` B# t/ f+ X( ]; {- R: l
1 ^ h% {+ F/ g2 [
$ y" {$ n7 I+ m
=============以下不需要修改====================
" j% `' u! \4 L! m8 v$ i! dipAddr="`curl https://ifconfig.co`"! G5 A* R9 c. J% }) d
url="https://api.cloudflare.com/client/v4/..."
9 M/ v9 A/ b8 z: k+ N% U5 c8 i1 O" U' @! W1 @. Q2 e/ c9 V0 J
获取cloudflare记录ID, r* Q" ^% v- l( H& b
listDnsApi="${url}/${zone_id}/dns_records?type=A&name=${hostname}"
1 `0 |& t: M5 O1 f# Lres=$(curl -s -X GET "$listDnsApi" -H "X-Auth-Email email" -H "X-Auth-Key global_api_key" -H "Content-Type:application/json")
& m0 @, t: h; z$ d& A0 J0 g& g* h& V* @0 crecordId=$(echo "$res" | jq -r ".result[0].id")2 }1 T4 ?% e' ~/ h$ }" b
8 Z2 f( a, A; Z; x8 b5 M$ ?& u, `3 T更新cloudflare记录
# @7 F2 [: g# o( A3 b; NupdateDnsApi="${url}/${zone_id}/dns_records/${recordId}";% t5 F ?6 o9 G7 y8 E
data="{\"type\":\"A\",\"name\":\"${hostname}\",\"content\":\"${ipAddr}\",\"ttl\":60,\"proxied\":false}"2 W* S+ B K9 l! D, K. h* |
res=$(curl -s -X PUT "$updateDnsApi" -H "X-Auth-Email email" -H "X-Auth-Key global_api_key" -H "Content-Type:application/json" --data "$data")3 i4 o7 Q5 @6 ?! D. F) ]
. J% E. ^/ ^. @+ p- L0 Q5 E1 X- z打印结果5 p( D5 [' ~% S; ]$ J2 j
echo "$res"3 C5 W* w' C% G1 U- O
1 K1 E% Q3 p$ I. m5 M9 z
0 Q y0 I. Z2 C
方法二:DDNS-GO 能拿到真实IP,牛比哄哄的,让花生壳去死吧,一直都觉得花生壳都是小孩子过家家用的
9 a/ ~, y; A' g' I, Y. eToken:令牌ID
* b/ L) _! o' f: s; U: vIPV4:通过接口获取 域名格式:www:163.COM 是冒号,这里有些平台是@有些是:有些是.
+ L( p* T4 \) m% C% Z; a( Q
4 e% E5 y! H6 o! w' B* d0 @2 z8 E/ B% s/ }
& L C0 m2 j% j8 B1 Y' A2 l
方法三:SSH命令行,前提能科学上网才抓得下来脚本,试了没什么卵用,可能时辰不对或者是服务器摆放的方向不对* k0 i& k2 K% @6 } l/ ]
% s: ~+ v+ O* ~
7 ?/ ^" v% q X8 i% w; H
) q+ C$ a1 H" b: E/ F' y
方法四:docker里再跑一个
J6 t/ D$ k1 p' X+ x
y6 {, m) i* m
1 Y% p! u% V+ j8 e
+ u1 _3 b1 r) t* r9 D |