双11活动抽中家宽之后的简单配置

家宽来源 → ohno.icu
机器是15号抽中的,20号正式开通

配置如下

ACA Residential NAT (墨西哥家宽) - Small $2.99 → $1.79 / Month
1 CPU vCore (Low Priority)
256 MB DDR4 RAM
2 GB NVME SSD
1024 GB Two-way Traffic
100Mbps Shared Bandwidth
20 * IPv4 Port
  1. 装完系统先进控制台添加一条A记录和txt记录

2.登录ssh

ssh root@添加的域名 -p 50140

3.安装不可描述脚本

curl -s https://raw.githubusercontent.com/233boy/sing-box/refs/heads/main/install.sh|bash

4.使用sed替换脚本生成的IP和端口

5.下载cf_ddns.sh脚本,使用sed替换信息
image

6.添加crontab 完事手工

echo '0 */12 * * * /bin/bash /root/.ssh/cf_ddns.sh' | crontab -

cat > /root/.ssh/cf_ddns.sh << 'EOF'
#!/bin/bash
auth_token=""
zone_id=""
record_name=""

ip=$(curl -s4 ip.sb) || exit 1
[ -z "$ip" ] && exit 1

auth=("-H" "Authorization: Bearer $auth_token" "-H" "Content-Type: application/json")

record=$(curl -s "https://api.cloudflare.com/client/v4/zones/$zone_id/dns_records?name=$record_name&type=A" "${auth[@]}")
[ -z "$record" ] && exit 1

if [[ "$record" == *'"count":0'* ]]; then
  curl -s -X POST "https://api.cloudflare.com/client/v4/zones/$zone_id/dns_records" \
    "${auth[@]}" --data "{\"type\":\"A\",\"name\":\"$record_name\",\"content\":\"$ip\",\"ttl\":120,\"proxied\":false}"
  exit $?
fi

id=$(echo "$record" | sed -n 's/.*"id":"\([^"]*\)".*/\1/p')
old_ip=$(echo "$record" | sed -n 's/.*"content":"\([^"]*\)".*/\1/p')

[ "$ip" = "$old_ip" ] && exit 0

curl -s -X PUT "https://api.cloudflare.com/client/v4/zones/$zone_id/dns_records/$id" \
  "${auth[@]}" --data "{\"type\":\"A\",\"name\":\"$record_name\",\"content\":\"$ip\",\"ttl\":120,\"proxied\":false}"
EOF

chmod +x /root/.ssh/cf_ddns.sh
(crontab -l 2>/dev/null; echo "0 */12 * * * /bin/bash /root/.ssh/cf_ddns.sh") | crontab -

28 个赞

感谢佬教程

2 个赞

感谢分享教程 :folded_hands:

1 个赞

速度怎么样啊?

2 个赞

感谢分享教程

是个好东西

1 个赞

稳定不呢

速度一般吧,胜在IP足够干净,而且是动态IP

2 个赞

哇,真棒!

1 个赞

需要自备一个域名自动更新DDNS IP

4 个赞

感谢分享教程 :smiling_face_with_three_hearts:

4 个赞

感谢教程

其实最后面的ddns脚本还可以再精简一下,很简单的东西,判断解析的IP是否是机器最新IP然后更新

感谢大佬了

感谢教程

1 个赞

冲呀 大佬

1 个赞

现在好像涨回 2.99 刀了

2 个赞

感谢分享教程