36 lines
997 B
Markdown
36 lines
997 B
Markdown
---
|
||
title: Ubuntu配置阿里云ddns
|
||
createTime: 2021/09/29
|
||
tags:
|
||
- Ubuntu
|
||
categories:
|
||
- 随记
|
||
---
|
||
|
||
1. 生成阿里云 access key **注意:不能使用 ram 子用户**
|
||
|
||
2. 下载并配置 ddns
|
||
```bash
|
||
curl https://github.com/NewFuture/DDNS/releases/download/v2.10.2/ddns -#SLo ddns && chmod 777 ddns
|
||
# 自动生成config.json
|
||
./ddns -h
|
||
# 配置config.json
|
||
vi config.json
|
||
```
|
||
3. 使用 ddns 配置
|
||
```bash
|
||
./ddns -c config.json
|
||
```
|
||
~~我自己在配置时发现,如果同时解析 ipv4 和 ipv6 时,阿里云的 ipv6 优先级要高于 ipv4,但是截至 CST+8 21.09.30 ipv6 连接体验仍然不尽如人意,所以可以只解析 ipv4~~
|
||
4. 用 crontab 设置每小时自动更新 ddns
|
||
|
||
````bash
|
||
crontab -e
|
||
# 设置每小时的30min自动更新
|
||
30 \* \* \* \* date >> path/to/ddns.log
|
||
30 \* \* \* \* path/to/./ddns -c path/to/config.json >> path/to/ddns.log
|
||
# 查看crontab设置
|
||
crontab -l
|
||
```
|
||
````
|