diff --git a/06.PVE用模板克隆虚拟机.md b/06.PVE用模板克隆虚拟机.md index 39b0bf4..b30597a 100644 --- a/06.PVE用模板克隆虚拟机.md +++ b/06.PVE用模板克隆虚拟机.md @@ -63,10 +63,66 @@ ![克隆虚拟机自动启动顺序](img/p06/vm_clone_autostart_order.jpeg) -## 4.安装 Adguard Home +## 4.调整系统端口 设置完成后,将该虚拟机开机,并使用 SSH 工具登录。 +Adguard Home 需监听系统 `53` 端口来提供 DNS 服务,使用以下命令检查端口占用。 + +```bash +## 检查 53 端口占用 +$ sudo lsof -i :53 + +#### 端口占用示例输出 +COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME +systemd-r 347 systemd-resolve 17u IPv4 13445 0t0 UDP localhost:domain +systemd-r 347 systemd-resolve 18u IPv4 13446 0t0 TCP localhost:domain (LISTEN) +systemd-r 347 systemd-resolve 19u IPv4 13447 0t0 UDP localhost:domain +systemd-r 347 systemd-resolve 20u IPv4 13448 0t0 TCP localhost:domain (LISTEN) +``` + +当前系统 `53` 端口被 `systemd-resolved.service` 占用,会导致 Adguard Home 监听端口失败。 + +为了正常使用 Adguard Home ,需要对 `systemd-resolved.service` 进行配置,逐行执行以下命令。 + +```bash +## 创建 systemd-resolved 配置文件夹 +$ sudo mkdir -p /etc/systemd/resolved.conf.d + +## 创建 systemd-resolved 配置文件 +$ sudo vim /etc/systemd/resolved.conf.d/adguardhome.conf +``` + +在配置文件中添加以下配置项,并保存。 + +```bash +## systemd-resolved 配置项 + +[Resolve] +DNS = 127.0.0.1 +DNSStubListener = no + +``` + +保存该配置文件后,还需调整系统 `resolv.conf` 配置文件,逐行执行以下命令。 + +```bash +## 备份 resolv.conf 配置文件 +$ sudo mv /etc/resolv.conf /etc/resolv.conf.bak + +## 创建 resolv.conf 软链接 +$ sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf +``` + +配置完成后,需重启 `systemd-resolved.service` 服务,并再次检查系统 `53` 端口占用。 + +```bash +## 重启 systemd-resolved 服务 +$ sudo systemctl restart systemd-resolved.service +``` + +## 5.安装 Adguard Home + Adguard Home 将采用 `snap` 形式安装,逐行执行以下命令。 ```bash @@ -77,7 +133,7 @@ $ sudo apt install snapd $ sudo snap install adguard-home ``` -### 4.1. Snap 自动更新 +### 5.1. Snap 自动更新 查看 Snap 当前的更新策略,执行以下命令。 @@ -96,7 +152,7 @@ $ sudo snap set system refresh.timer=2:30-3:30,14:30-15:30 $ sudo snap set system refresh.timer=mon,2:30,,fri,2:30 ``` -### 4.2. Snap 定时任务 +### 5.2. Snap 定时任务 本步骤为可选操作,主要设置定时重启 Snap 服务。 @@ -117,7 +173,7 @@ $ sudo crontab -e ``` -## 5.配置 Adguard Home +## 6.配置 Adguard Home 关于 Adguard Home 配置相关内容,请参阅 [Adguard Home 折腾手记](https://gitee.com/callmer/agh_toss_notes) 。 diff --git a/img/p06/vm_clone_ci_slaac.jpeg b/img/p06/vm_clone_ci_slaac.jpeg index a969a43..2841bae 100644 Binary files a/img/p06/vm_clone_ci_slaac.jpeg and b/img/p06/vm_clone_ci_slaac.jpeg differ diff --git a/img/p06/vm_clone_ci_static.jpeg b/img/p06/vm_clone_ci_static.jpeg index 85882d5..3af2fec 100644 Binary files a/img/p06/vm_clone_ci_static.jpeg and b/img/p06/vm_clone_ci_static.jpeg differ