Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c26dd2569 | ||
|
|
ae963404b7 | ||
|
|
96f89812de | ||
|
|
968d0637dd | ||
|
|
1166516576 | ||
|
|
f664975bcc | ||
|
|
26fa0b0c10 | ||
|
|
ac2740f888 | ||
|
|
aa1a12757b | ||
|
|
ccef3195ff | ||
|
|
dd3bda21f5 | ||
|
|
547389c182 | ||
|
|
ace58ce24d | ||
|
|
adaeb4a650 | ||
|
|
fa29b0d633 | ||
|
|
94273ae2b6 | ||
|
|
2d32561415 | ||
|
|
0dcfa86d11 | ||
|
|
557ae16217 | ||
|
|
49083bf184 | ||
|
|
9634a10686 | ||
|
|
6f7c78b749 | ||
|
|
04fc40c8e1 | ||
|
|
05ba8586ae | ||
|
|
e8cb9b14f4 | ||
|
|
7b794c11e4 | ||
|
|
d4673a204a | ||
|
|
95913b4d0d | ||
|
|
964fc699e3 | ||
|
|
b3b147ab37 | ||
|
|
cdcc71462b | ||
|
|
999a06f938 | ||
|
|
4bf1e1d523 | ||
|
|
ddc60fd6f1 | ||
|
|
c94872a931 | ||
|
|
d09bd30a25 | ||
|
|
cc5ec05502 | ||
|
|
e0894f3e13 | ||
|
|
360d5b6cab | ||
|
|
8d2cab7155 | ||
|
|
afb5a5859c | ||
|
|
53c3fe877a | ||
|
|
835cbf9b43 | ||
|
|
1b97935413 | ||
|
|
fc67f6f575 | ||
|
|
bc5ea890ad | ||
|
|
fefcd16f82 | ||
|
|
10050fa7ff | ||
|
|
20086c63f7 | ||
|
|
619b96a6fc | ||
|
|
4fbb729d85 | ||
|
|
78fd87188c | ||
|
|
8a737cfb34 | ||
|
|
fcfd177593 | ||
|
|
1336af517e | ||
|
|
b0beb5177f | ||
|
|
921bd8bb31 | ||
|
|
ff1a1a43a7 | ||
|
|
9a9173df92 | ||
|
|
e9ca2b5cda | ||
|
|
0695f8b6b9 | ||
|
|
1657411b7e | ||
|
|
14007e78b8 | ||
|
|
7318726847 | ||
|
|
374c55cbb3 | ||
|
|
7df6ea76b7 | ||
|
|
5e0a8aac54 | ||
|
|
8dd1f08f27 | ||
|
|
9873dd74d1 | ||
|
|
ffaa26a050 | ||
|
|
b17ef026ad | ||
|
|
808094ae3c | ||
|
|
609fcf579b | ||
|
|
022da7d3f9 | ||
|
|
afb2678f68 | ||
|
|
4ed96a4d38 | ||
|
|
f7ff85a805 | ||
|
|
101fc96feb | ||
|
|
01f39562ff | ||
|
|
933bdca053 | ||
|
|
748faac28b | ||
|
|
fe8fbff04c | ||
|
|
50f49ed956 | ||
|
|
b809ecd035 | ||
|
|
eda1d36130 | ||
|
|
c9bf9ae2fd | ||
|
|
38ac1f9702 | ||
|
|
f493c774ab | ||
|
|
09a35e9c31 | ||
|
|
a1e992c956 | ||
|
|
360542f9d4 | ||
|
|
e5a8d8b491 | ||
|
|
3ce5fdba6a | ||
|
|
5ec78ce639 | ||
|
|
b597af908d | ||
|
|
6f085030b3 | ||
|
|
82497488ed |
@@ -6,7 +6,7 @@ PVE 系统正式安装之前,需要准备 PVE 的安装镜像和一些必要
|
|||||||
|
|
||||||
PVE 下载地址:[Proxmox Virtual Environment](https://www.proxmox.com/en/downloads/proxmox-virtual-environment/iso)
|
PVE 下载地址:[Proxmox Virtual Environment](https://www.proxmox.com/en/downloads/proxmox-virtual-environment/iso)
|
||||||
|
|
||||||
页面中有多个 PVE 相关文件,本文以目前最新的 `Proxmox VE 8.1-1 ISO Installer` 作为演示。
|
页面中有多个 PVE 相关文件,本文以目前最新的 `Proxmox VE 8.3-1 ISO Installer` 作为演示。
|
||||||
|
|
||||||
点击 `Proxmox VE 8.x ISO Installer` 链接,进入 PVE 下载页面。
|
点击 `Proxmox VE 8.x ISO Installer` 链接,进入 PVE 下载页面。
|
||||||
|
|
||||||
@@ -50,25 +50,31 @@ PVE 下载地址:[Proxmox Virtual Environment](https://www.proxmox.com/en/down
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 0.3. SSH 工具
|
### 0.3.终端工具
|
||||||
|
|
||||||
考虑到配置 PVE 服务器、路由器、DNS 服务器时,需要在 CLI 中输入命令,因此这里推荐几个常用的 SSH 工具。
|
考虑到配置 PVE 服务器、路由器、DNS 服务器时,需要在 CLI 中输入命令,因此这里推荐几个常用的终端工具。
|
||||||
|
|
||||||
#### Tabby
|
#### Windows Terminal
|
||||||
|
|
||||||
官方网站地址:https://tabby.sh
|
官方网站地址:https://aka.ms/terminal
|
||||||
|
|
||||||
基于 Electron 开发的开源跨平台终端工具,内部集成了 SFTP ,可以在 Github 平台上进行下载。
|
Microsoft 官方终端工具,可以在 Github 平台或 Microsoft 应用商店中进行下载。
|
||||||
|
|
||||||
支持 Windows 、macOS 、Linux 。
|

|
||||||
|
|
||||||

|
#### Termius
|
||||||
|
|
||||||
|
官方地址:https://termius.com/
|
||||||
|
|
||||||
|
企业级终端工具,支持 Windows、macOS、Linux 系统以及移动端系统。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
#### MobaXterm
|
#### MobaXterm
|
||||||
|
|
||||||
官方地址:https://mobaxterm.mobatek.net
|
官方地址:https://mobaxterm.mobatek.net
|
||||||
|
|
||||||
功能强大的 SSH 工具,仅支持 Windows 。
|
功能强大的终端工具,仅支持 Windows 系统。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
### 1.1.系统软件源
|
### 1.1.系统软件源
|
||||||
|
|
||||||
使用 SSH 工具登录到 PVE 服务器,首先对现有的软件源配置进行备份。
|
使用终端工具登录到 PVE 服务器,首先对现有的软件源配置进行备份。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 进入系统软件源配置文件目录
|
## 进入系统软件源配置文件目录
|
||||||
@@ -64,27 +64,37 @@ deb https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main contrib
|
|||||||
|
|
||||||
默认情况下,PVE 额外启用了 2 个官方源,且为订阅收费制,因此需要替换为免费源。
|
默认情况下,PVE 额外启用了 2 个官方源,且为订阅收费制,因此需要替换为免费源。
|
||||||
|
|
||||||
删除 PVE 官方付费软件源,执行以下命令。
|
首先创建 PVE 免费软件源,执行以下命令。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## 创建 PVE 免费软件源
|
||||||
|
|
||||||
|
$ source /etc/os-release
|
||||||
|
|
||||||
|
$ echo "deb https://mirrors.ustc.edu.cn/proxmox/debian/pve $VERSION_CODENAME pve-no-subscription" > /etc/apt/sources.list.d/pve-no-subscription.list
|
||||||
|
```
|
||||||
|
|
||||||
|
对于 Proxmox Backup Server 和 Proxmox Mail Gateway,请将以上命令中的 `pve` 分别替换为 `pbs` 和 `pmg` 。
|
||||||
|
|
||||||
|
进一步创建 PVE Ceph 免费软件源,Ceph 软件源为 PVE 8 之后默认安装,执行以下命令。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## 创建 PVE Ceph 免费软件源脚本
|
||||||
|
|
||||||
|
if [ -f /etc/apt/sources.list.d/ceph.list ]; then
|
||||||
|
CEPH_CODENAME=`ceph -v | grep ceph | awk '{print $(NF-1)}'`
|
||||||
|
source /etc/os-release
|
||||||
|
echo "deb https://mirrors.ustc.edu.cn/proxmox/debian/ceph-$CEPH_CODENAME $VERSION_CODENAME no-subscription" > /etc/apt/sources.list.d/ceph-no-subscription.list
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
|
最后,删除 PVE 官方付费软件源,执行以下命令。
|
||||||
|
|
||||||
**注意:rm 为高风险命令,请正确使用,请勿手抖,请勿手抖。**
|
**注意:rm 为高风险命令,请正确使用,请勿手抖,请勿手抖。**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 删除付费软件源
|
## 删除付费软件源
|
||||||
$ rm -rvf /etc/apt/sources.list.d/*.list
|
$ rm -rvf /etc/apt/sources.list.d/pve-enterprise.list /etc/apt/sources.list.d/ceph.list
|
||||||
```
|
|
||||||
|
|
||||||
创建 PVE 免费软件源。
|
|
||||||
|
|
||||||
**注意:该命令为三行,在输入时请逐行输入并回车执行。**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
## 创建 PVE 免费源
|
|
||||||
|
|
||||||
$ source /etc/os-release
|
|
||||||
|
|
||||||
$ echo "deb https://mirrors.ustc.edu.cn/proxmox/debian/ceph-quincy $VERSION_CODENAME no-subscription" > /etc/apt/sources.list.d/ceph-no-subscription.list
|
|
||||||
|
|
||||||
$ echo "deb https://mirrors.ustc.edu.cn/proxmox/debian/pve $VERSION_CODENAME pve-no-subscription" > /etc/apt/sources.list.d/pve-no-subscription.list
|
|
||||||
```
|
```
|
||||||
|
|
||||||
创建完成后对其进行检查。
|
创建完成后对其进行检查。
|
||||||
@@ -92,9 +102,9 @@ $ echo "deb https://mirrors.ustc.edu.cn/proxmox/debian/pve $VERSION_CODENAME pve
|
|||||||
```bash
|
```bash
|
||||||
## 检查 PVE 免费源
|
## 检查 PVE 免费源
|
||||||
|
|
||||||
$ cat /etc/apt/sources.list.d/ceph-no-subscription.list
|
|
||||||
|
|
||||||
$ cat /etc/apt/sources.list.d/pve-no-subscription.list
|
$ cat /etc/apt/sources.list.d/pve-no-subscription.list
|
||||||
|
|
||||||
|
$ cat /etc/apt/sources.list.d/ceph-no-subscription.list
|
||||||
```
|
```
|
||||||
|
|
||||||
如果输出结果中有 USTC 的镜像地址,则表示命令已经正确执行。
|
如果输出结果中有 USTC 的镜像地址,则表示命令已经正确执行。
|
||||||
@@ -102,11 +112,11 @@ $ cat /etc/apt/sources.list.d/pve-no-subscription.list
|
|||||||
```bash
|
```bash
|
||||||
#### PVE 免费软件源示例输出
|
#### PVE 免费软件源示例输出
|
||||||
|
|
||||||
#### Ceph
|
|
||||||
deb https://mirrors.ustc.edu.cn/proxmox/debian/ceph-quincy bookworm no-subscription
|
|
||||||
|
|
||||||
#### PVE
|
#### PVE
|
||||||
deb https://mirrors.ustc.edu.cn/proxmox/debian/pve bookworm pve-no-subscription
|
deb https://mirrors.ustc.edu.cn/proxmox/debian/pve bookworm pve-no-subscription
|
||||||
|
|
||||||
|
#### Ceph
|
||||||
|
deb https://mirrors.ustc.edu.cn/proxmox/debian/ceph-quincy bookworm no-subscription
|
||||||
```
|
```
|
||||||
|
|
||||||
### 1.3. PVE CT 源
|
### 1.3. PVE CT 源
|
||||||
@@ -143,7 +153,7 @@ $ apt clean && apt autoclean && apt autoremove --purge
|
|||||||
$ apt update
|
$ apt update
|
||||||
|
|
||||||
## 更新系统
|
## 更新系统
|
||||||
$ apt dist-upgrade
|
$ apt full-upgrade
|
||||||
```
|
```
|
||||||
|
|
||||||
## 2.安装必要软件
|
## 2.安装必要软件
|
||||||
@@ -161,10 +171,10 @@ $ apt dist-upgrade
|
|||||||
$ apt update
|
$ apt update
|
||||||
|
|
||||||
## 安装系统软件
|
## 安装系统软件
|
||||||
$ apt install htop lm-sensors unzip neovim tmux unattended-upgrades powermgmt-base
|
$ apt install btop lm-sensors unzip neovim tmux unattended-upgrades powermgmt-base
|
||||||
|
|
||||||
## 安装网络工具
|
## 安装网络工具
|
||||||
$ apt install iperf iperf3 iftop openvswitch-switch
|
$ apt install iperf iperf3 iftop sshguard openvswitch-switch
|
||||||
|
|
||||||
## 安装 CPU 调度调整工具
|
## 安装 CPU 调度调整工具
|
||||||
$ apt install linux-cpupower
|
$ apt install linux-cpupower
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
$ apt update
|
$ apt update
|
||||||
|
|
||||||
## 安装系统软件
|
## 安装系统软件
|
||||||
$ apt install htop lm-sensors unzip neovim tmux unattended-upgrades powermgmt-base
|
$ apt install btop lm-sensors unzip neovim tmux unattended-upgrades powermgmt-base
|
||||||
|
|
||||||
## 安装网络工具
|
## 安装网络工具
|
||||||
$ apt install iperf iperf3 iftop openvswitch-switch
|
$ apt install iperf iperf3 iftop sshguard openvswitch-switch
|
||||||
|
|
||||||
## 安装 CPU 调度调整工具
|
## 安装 CPU 调度调整工具
|
||||||
$ apt install linux-cpupower
|
$ apt install linux-cpupower
|
||||||
@@ -59,8 +59,9 @@ $ nano /etc/chrony/chrony.conf
|
|||||||
# pool 2.debian.pool.ntp.org iburst ## 在这行前面增加注释符 # 来注释
|
# pool 2.debian.pool.ntp.org iburst ## 在这行前面增加注释符 # 来注释
|
||||||
|
|
||||||
# Use Custom vendor zone.
|
# Use Custom vendor zone.
|
||||||
pool ntp.tencent.com iburst
|
|
||||||
pool ntp.aliyun.com iburst
|
pool ntp.aliyun.com iburst
|
||||||
|
pool ntp.tencent.com iburst
|
||||||
|
pool cn.pool.ntp.org iburst
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -76,8 +77,12 @@ $ chronyc sources -V
|
|||||||
#### 系统 NTP 服务器示例输出
|
#### 系统 NTP 服务器示例输出
|
||||||
MS Name/IP address Stratum Poll Reach LastRx Last sample
|
MS Name/IP address Stratum Poll Reach LastRx Last sample
|
||||||
===============================================================================
|
===============================================================================
|
||||||
^+ 106.55.184.199 2 6 17 11 +752us[ +273us] +/- 40ms
|
^- 203.107.6.88 2 6 7 2 +987us[+1251us] +/- 23ms
|
||||||
^* 203.107.6.88 2 6 17 11 -1868us[-2348us] +/- 17ms
|
^? 106.55.184.199 2 6 11 1 -501us[ -501us] +/- 60ms
|
||||||
|
^- electrode.felixc.at 2 6 7 2 +3532us[ +663us] +/- 121ms
|
||||||
|
^* 119.28.206.193 2 6 15 1 +184us[-2686us] +/- 53ms
|
||||||
|
^- 119.28.183.184 2 6 7 2 +512us[-2358us] +/- 47ms
|
||||||
|
^+ time.cloudflare.com 3 6 13 1 -85us[-2955us] +/- 106ms
|
||||||
```
|
```
|
||||||
|
|
||||||
## 2. CPU 调度器
|
## 2. CPU 调度器
|
||||||
@@ -432,7 +437,7 @@ Aug 01 13:37:41 node01 systemd[1]: Started apt-daily-upgrade.timer - Daily apt u
|
|||||||
|
|
||||||
参考官方文档 [qm_pci_passthrough](https://pve.proxmox.com/pve-docs/pve-admin-guide.html#qm_pci_passthrough) 和 [Pci passthrough](https://pve.proxmox.com/wiki/Pci_passthrough) 开启 PVE 硬件直通功能。
|
参考官方文档 [qm_pci_passthrough](https://pve.proxmox.com/pve-docs/pve-admin-guide.html#qm_pci_passthrough) 和 [Pci passthrough](https://pve.proxmox.com/wiki/Pci_passthrough) 开启 PVE 硬件直通功能。
|
||||||
|
|
||||||
使用 SSH 工具登录到 PVE 服务器,编辑系统 `Grub` 的配置文件 `/etc/default/grub` 。
|
使用终端工具登录到 PVE 服务器,编辑系统 `Grub` 的配置文件 `/etc/default/grub` 。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 编辑 Grub 配置文件
|
## 编辑 Grub 配置文件
|
||||||
@@ -493,7 +498,7 @@ $ update-initramfs -u -k all
|
|||||||
|
|
||||||
### 5.3.检查硬件直通
|
### 5.3.检查硬件直通
|
||||||
|
|
||||||
PVE 服务器重启完成后,再次使用 SSH 工具登录,并执行以下命令检查硬件直通状态。
|
PVE 服务器重启完成后,再次使用终端工具登录,并执行以下命令检查硬件直通状态。
|
||||||
|
|
||||||
主要查看 `IOMMU` 、 `Directed I/O` 或 `Interrupt Remapping` 的启用状态。
|
主要查看 `IOMMU` 、 `Directed I/O` 或 `Interrupt Remapping` 的启用状态。
|
||||||
|
|
||||||
@@ -565,7 +570,64 @@ $ find /sys/kernel/iommu_groups/ -type l
|
|||||||
/sys/kernel/iommu_groups/9/devices/0000:00:1c.6
|
/sys/kernel/iommu_groups/9/devices/0000:00:1c.6
|
||||||
```
|
```
|
||||||
|
|
||||||
## 6.系统清理
|
## 6. BTRFS 调整
|
||||||
|
|
||||||
|
**额外说明:**
|
||||||
|
|
||||||
|
1. 本节专为 `BTRFS` 单盘 `RAID0`(条带模式)安装的 PVE 系统设计,使用其他安装模式时,请跳过此节。
|
||||||
|
|
||||||
|
2. `BTRFS` 文件系统当前仍为技术预览状态,请谨慎操作。
|
||||||
|
|
||||||
|
3. 有关在 PVE 中使用 `BTRFS` 的详情,请参阅 [Proxmox VE - BTRFS](https://pve.proxmox.com/wiki/BTRFS) 。
|
||||||
|
|
||||||
|
安装 PVE 时,若使用了 `BTRFS` 单盘 `RAID0` 的安装模式,系统默认未启用 swap 和 zstd 压缩,需要手动开启。
|
||||||
|
|
||||||
|
通常情况下,内存与 swap 的 **推荐** 比例为 `1:1` 。本机具有 `16GB` 内存,因此设置 `16GB` swap 空间。
|
||||||
|
|
||||||
|
执行以下命令,在 `BTRFS` 文件系统中创建子卷,并配置激活 swapfile 。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## 创建用于存放交换文件的子卷
|
||||||
|
$ btrfs subvolume create /swap
|
||||||
|
|
||||||
|
## 在子卷中创建 16GB 的交换文件
|
||||||
|
$ btrfs filesystem mkswapfile --size 16g --uuid clear /swap/swapfile
|
||||||
|
|
||||||
|
## 激活交换文件
|
||||||
|
$ swapon /swap/swapfile
|
||||||
|
```
|
||||||
|
|
||||||
|
此时还需进一步修改系统的 `fstab` 配置文件,以启用 `BTRFS` 的 zstd 压缩功能并确保 swap 在系统启动时自动激活。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## 编辑 fstab 配置文件
|
||||||
|
$ nano /etc/fstab
|
||||||
|
```
|
||||||
|
|
||||||
|
`fstab` 为系统关键配置文件,直接影响系统启动,修改此文件时,请注意以下几点:
|
||||||
|
|
||||||
|
- 仅修改根目录 `/` 对应的挂载选项,添加 `compress=zstd` 参数。
|
||||||
|
|
||||||
|
- 在文件末尾新增一行,添加 swap 的自动挂载。
|
||||||
|
|
||||||
|
- 请 **不要** 修改其余配置参数,尤其是设备的唯一标识符( `UUID` ),切勿修改。
|
||||||
|
|
||||||
|
修改完成后,示例如下。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#### 系统 fstab 示例配置
|
||||||
|
|
||||||
|
# <file system> <mount point> <type> <options> <dump> <pass>
|
||||||
|
|
||||||
|
UUID=<DO-NOT-EDIT-YOUR-UUID> / btrfs defaults,compress=zstd 0 1
|
||||||
|
|
||||||
|
UUID=<YOUR-UUID> /boot/efi vfat defaults 0 1
|
||||||
|
proc /proc proc defaults 0 0
|
||||||
|
|
||||||
|
/swap/swapfile none swap defaults 0 0
|
||||||
|
```
|
||||||
|
|
||||||
|
## 7.系统清理
|
||||||
|
|
||||||
PVE 系统配置完成后,可执行以下命令,对系统进行清理。
|
PVE 系统配置完成后,可执行以下命令,对系统进行清理。
|
||||||
|
|
||||||
|
|||||||
@@ -4,11 +4,11 @@
|
|||||||
|
|
||||||
该虚拟机模板主要用作内网 DNS 服务器,由 `Adguard Home` 或 `SmartDNS` 提供 DNS 解析服务。
|
该虚拟机模板主要用作内网 DNS 服务器,由 `Adguard Home` 或 `SmartDNS` 提供 DNS 解析服务。
|
||||||
|
|
||||||
本文将使用 Debian 的云镜像 `debian-12-genericcloud-amd64.qcow2` 作为模板虚拟机的镜像。
|
本文将使用 Debian 的云镜像 `debian-12-generic-amd64.qcow2` 作为模板虚拟机的镜像。
|
||||||
|
|
||||||
访问 [Debian Official Cloud Images](https://cloud.debian.org/images/cloud/) 官方网站,下载最新版 `Bookworm` 云镜像以及对应的校验文件。
|
访问 [Debian Official Cloud Images](https://cloud.debian.org/images/cloud/) 官方网站,下载最新版 `Bookworm` 云镜像以及对应的校验文件。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## 1.创建虚拟机
|
## 1.创建虚拟机
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ CPU `类别` 选择 `host` ,`插槽` 与 `核心` 数根据物理 CPU 核心
|
|||||||
|
|
||||||
### 2.2.导入镜像文件
|
### 2.2.导入镜像文件
|
||||||
|
|
||||||
使用 SSH 工具登录 PVE 服务器,并进入 `tmp` 目录,执行以下命令创建一个目录。
|
使用终端工具登录 PVE 服务器,并进入 `/tmp` 目录,执行以下命令创建一个目录。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 创建存放 Debian 云镜像的临时目录
|
## 创建存放 Debian 云镜像的临时目录
|
||||||
@@ -107,7 +107,7 @@ $ cd /tmp/Debian
|
|||||||
$ wget https://cloud.debian.org/images/cloud/bookworm/latest/SHA512SUMS
|
$ wget https://cloud.debian.org/images/cloud/bookworm/latest/SHA512SUMS
|
||||||
|
|
||||||
## 下载云镜像
|
## 下载云镜像
|
||||||
$ wget https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-genericcloud-amd64.qcow2
|
$ wget https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2
|
||||||
|
|
||||||
## 检查文件是否存在
|
## 检查文件是否存在
|
||||||
$ ls -lah
|
$ ls -lah
|
||||||
@@ -116,14 +116,14 @@ $ ls -lah
|
|||||||
$ cat SHA512SUMS
|
$ cat SHA512SUMS
|
||||||
|
|
||||||
## 计算文件 hash
|
## 计算文件 hash
|
||||||
$ sha512sum debian-12-genericcloud-amd64.qcow2
|
$ sha512sum debian-12-generic-amd64.qcow2
|
||||||
```
|
```
|
||||||
|
|
||||||
确认无误后,将镜像文件导入刚才创建的虚拟机,命令中的 `VM ID` 需要根据实际情况替换,演示为 `1001` 。
|
确认无误后,将镜像文件导入刚才创建的虚拟机,命令中的 `VM ID` 需要根据实际情况替换,演示为 `1001` 。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 将 qcow2 镜像导入虚拟机中
|
## 将 qcow2 镜像导入虚拟机中
|
||||||
$ qm importdisk 1001 debian-12-genericcloud-amd64.qcow2 local-lvm
|
$ qm importdisk 1001 debian-12-generic-amd64.qcow2 local-lvm
|
||||||
|
|
||||||
#### 镜像导入示例输出
|
#### 镜像导入示例输出
|
||||||
Successfully imported disk as 'unused0:local-lvm:vm-1001-disk-0'
|
Successfully imported disk as 'unused0:local-lvm:vm-1001-disk-0'
|
||||||
|
|||||||
@@ -21,8 +21,8 @@
|
|||||||
- 保存文件,按下键盘 `Esc` 键,退出编辑模式,再输入组合键 `:wq` 即可保存。
|
- 保存文件,按下键盘 `Esc` 键,退出编辑模式,再输入组合键 `:wq` 即可保存。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 编辑 ssh 配置文件
|
## 编辑 SSH 配置文件
|
||||||
$ sudo vim /etc/ssh/sshd_config.d/server_sshd.conf
|
$ sudo vim /etc/ssh/sshd_config.d/10-server-sshd.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
在配置文件中添加以下配置项,并保存。
|
在配置文件中添加以下配置项,并保存。
|
||||||
@@ -39,17 +39,17 @@ UseDNS no
|
|||||||
修改完成后,需要重启 SSH 服务。
|
修改完成后,需要重启 SSH 服务。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 重启 sshd
|
## 重启 ssh.service
|
||||||
$ sudo systemctl restart ssh.service
|
$ sudo systemctl restart ssh.service
|
||||||
```
|
```
|
||||||
|
|
||||||
### 1.2.配置软件源
|
### 1.2.配置软件源
|
||||||
|
|
||||||
使用 SSH 工具登录模板虚拟机,常用 SSH 工具请参阅 [01.PVE系统安装](./01.PVE系统安装.md) 。
|
使用终端工具登录模板虚拟机,常用终端工具请参阅 [01.PVE系统安装](./01.PVE系统安装.md) 。
|
||||||
|
|
||||||
首先需要对 Debian 系统软件源进行修改,这里使用 [USTC](http://mirrors.ustc.edu.cn/help/debian.html) 镜像站作为演示。
|
首先需要对 Debian 系统软件源进行修改,这里使用 [USTC](https://mirrors.ustc.edu.cn) 镜像站作为演示。
|
||||||
|
|
||||||
当系统版本发生变化时,请参考使用 snullp 大叔开发的 [配置生成器](https://mirrors.ustc.edu.cn/repogen/) 。
|
当系统版本发生变化时,请参考 USTC 镜像站的官方说明 [USTC Mirror Help - Debian](https://mirrors.ustc.edu.cn/help/debian.html) 。
|
||||||
|
|
||||||
Debian12 云镜像的软件源配置采用了 `DEB822` 格式,新版 `sources.list` 配置文件内容如下。
|
Debian12 云镜像的软件源配置采用了 `DEB822` 格式,新版 `sources.list` 配置文件内容如下。
|
||||||
|
|
||||||
@@ -89,7 +89,6 @@ $ cat /etc/apt/mirrors/debian-security.list
|
|||||||
|
|
||||||
#### 关联配置文件示例输出 (关联部分 2 )
|
#### 关联配置文件示例输出 (关联部分 2 )
|
||||||
https://deb.debian.org/debian-security
|
https://deb.debian.org/debian-security
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
因此,修改 Debian12 软件源的方式也有两种,本文将尝试使用第 `2` 种修改方案。
|
因此,修改 Debian12 软件源的方式也有两种,本文将尝试使用第 `2` 种修改方案。
|
||||||
@@ -143,20 +142,20 @@ $ lsattr /etc/apt/sources.list.d/debian.sources
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 清理不必要的包
|
## 清理不必要的包
|
||||||
$ sudo apt clean && sudo apt autoclean && sudo apt autoremove --purge
|
$ sudo bash -c 'apt clean && apt autoclean && apt autoremove --purge'
|
||||||
|
|
||||||
## 更新软件源
|
## 更新软件源
|
||||||
$ sudo apt update
|
$ sudo apt update
|
||||||
|
|
||||||
## 更新系统
|
## 更新系统
|
||||||
$ sudo apt dist-upgrade
|
$ sudo apt full-upgrade
|
||||||
```
|
```
|
||||||
|
|
||||||
接下来安装系统必要软件,安装 `iperf3` 后,系统将询问是否将其作为系统服务开机自启,选择 `no` 即可。
|
接下来安装系统必要软件,安装 `iperf3` 后,系统将询问是否将其作为系统服务开机自启,选择 `no` 即可。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 安装系统软件
|
## 安装系统软件
|
||||||
$ sudo apt install qemu-guest-agent zsh git htop tmux cron nftables sshguard neovim
|
$ sudo apt install qemu-guest-agent zsh git btop tmux cron nftables sshguard neovim
|
||||||
|
|
||||||
## 安装系统自动更新工具
|
## 安装系统自动更新工具
|
||||||
$ sudo apt install unattended-upgrades powermgmt-base python3-gi
|
$ sudo apt install unattended-upgrades powermgmt-base python3-gi
|
||||||
@@ -188,14 +187,18 @@ $ sudo nvim /etc/sysctl.d/99-sysctl.conf
|
|||||||
kernel.panic = 20
|
kernel.panic = 20
|
||||||
kernel.panic_on_oops = 1
|
kernel.panic_on_oops = 1
|
||||||
|
|
||||||
net.core.default_qdisc = fq
|
net.core.default_qdisc = fq_codel
|
||||||
net.ipv4.tcp_congestion_control = bbr
|
net.ipv4.tcp_congestion_control = cubic
|
||||||
|
|
||||||
# Other adjustable system parameters
|
# Other adjustable system parameters
|
||||||
|
|
||||||
net.core.netdev_budget = 600
|
net.core.netdev_budget = 600
|
||||||
net.core.netdev_budget_usecs = 20000
|
net.core.netdev_budget_usecs = 20000
|
||||||
|
|
||||||
|
net.core.somaxconn = 8192
|
||||||
|
net.core.rmem_max = 16777216
|
||||||
|
net.core.wmem_max = 16777216
|
||||||
|
|
||||||
net.ipv4.conf.all.log_martians = 1
|
net.ipv4.conf.all.log_martians = 1
|
||||||
|
|
||||||
net.ipv4.igmp_max_memberships = 256
|
net.ipv4.igmp_max_memberships = 256
|
||||||
@@ -203,7 +206,9 @@ net.ipv4.igmp_max_memberships = 256
|
|||||||
net.ipv4.tcp_challenge_ack_limit = 1000
|
net.ipv4.tcp_challenge_ack_limit = 1000
|
||||||
net.ipv4.tcp_fin_timeout = 30
|
net.ipv4.tcp_fin_timeout = 30
|
||||||
net.ipv4.tcp_keepalive_time = 120
|
net.ipv4.tcp_keepalive_time = 120
|
||||||
net.ipv4.tcp_syncookies = 1
|
net.ipv4.tcp_notsent_lowat = 131072
|
||||||
|
net.ipv4.tcp_rmem = 16384 262144 8388608
|
||||||
|
net.ipv4.tcp_wmem = 32768 524288 16777216
|
||||||
|
|
||||||
net.ipv6.conf.all.use_tempaddr = 0
|
net.ipv6.conf.all.use_tempaddr = 0
|
||||||
net.ipv6.conf.default.use_tempaddr = 0
|
net.ipv6.conf.default.use_tempaddr = 0
|
||||||
@@ -241,16 +246,17 @@ Debian 云镜像默认使用 `systemd-timesyncd.service` 同步时间,且需
|
|||||||
$ sudo mkdir -p /etc/systemd/timesyncd.conf.d
|
$ sudo mkdir -p /etc/systemd/timesyncd.conf.d
|
||||||
|
|
||||||
## 创建 NTP 配置文件
|
## 创建 NTP 配置文件
|
||||||
$ sudo nvim /etc/systemd/timesyncd.conf.d/server_ntp.conf
|
$ sudo nvim /etc/systemd/timesyncd.conf.d/10-server-ntp.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
在配置文件中添加以下配置项,并保存。
|
在配置文件中添加以下配置项,并保存。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## NTP 配置项
|
# This configuration file is customized by fox,
|
||||||
|
# Optimize system NTP server.
|
||||||
|
|
||||||
[Time]
|
[Time]
|
||||||
NTP=ntp.tencent.com ntp.aliyun.com
|
NTP=ntp.aliyun.com ntp.tencent.com cn.pool.ntp.org
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -270,20 +276,20 @@ $ sudo systemctl status systemd-timesyncd.service
|
|||||||
#### NTP 服务示例输出
|
#### NTP 服务示例输出
|
||||||
● systemd-timesyncd.service - Network Time Synchronization
|
● systemd-timesyncd.service - Network Time Synchronization
|
||||||
Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; preset: enabled)
|
Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; preset: enabled)
|
||||||
Active: active (running) since Mon 2023-06-26 16:16:00 CST; 16s ago
|
Active: active (running) since Mon 2024-10-07 18:06:29 CST; 9s ago
|
||||||
Docs: man:systemd-timesyncd.service(8)
|
Docs: man:systemd-timesyncd.service(8)
|
||||||
Main PID: 18829 (systemd-timesyn)
|
Main PID: 1706 (systemd-timesyn)
|
||||||
Status: "Contacted time server 106.55.184.199:123 (ntp.tencent.com)."
|
Status: "Contacted time server 203.107.6.88:123 (ntp.aliyun.com)."
|
||||||
Tasks: 2 (limit: 2355)
|
Tasks: 2 (limit: 2315)
|
||||||
Memory: 1.4M
|
Memory: 1.4M
|
||||||
CPU: 37ms
|
CPU: 113ms
|
||||||
CGroup: /system.slice/systemd-timesyncd.service
|
CGroup: /system.slice/systemd-timesyncd.service
|
||||||
└─18829 /lib/systemd/systemd-timesyncd
|
└─1706 /lib/systemd/systemd-timesyncd
|
||||||
|
|
||||||
Jun 26 16:48:00 DNST01 systemd[1]: Starting systemd-timesyncd.service - Network Time Synchronization...
|
Oct 07 18:06:29 DNS01 systemd[1]: Starting systemd-timesyncd.service - Network Time Synchronization...
|
||||||
Jun 26 16:48:00 DNST01 systemd[1]: Started systemd-timesyncd.service - Network Time Synchronization.
|
Oct 07 18:06:29 DNS01 systemd[1]: Started systemd-timesyncd.service - Network Time Synchronization.
|
||||||
Jun 26 16:48:00 DNST01 systemd-timesyncd[18829]: Contacted time server 106.55.184.199:123 (ntp.tencent.com).
|
Oct 07 18:06:29 DNS01 systemd-timesyncd[1706]: Contacted time server 203.107.6.88:123 (ntp.aliyun.com).
|
||||||
Jun 26 16:48:00 DNST01 systemd-timesyncd[18829]: Initial clock synchronization to Mon 2023-06-26 16:16:16.000000 CST.
|
Oct 07 18:06:29 DNS01 systemd-timesyncd[1706]: Initial clock synchronization to Mon 2024-10-07 18:06:29.499548 CST.
|
||||||
```
|
```
|
||||||
|
|
||||||
### 1.6.配置自动更新
|
### 1.6.配置自动更新
|
||||||
@@ -441,13 +447,13 @@ Debian 模板虚拟机已经配置完成,在将其转换为模板前需要对
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 清理系统软件包
|
## 清理系统软件包
|
||||||
$ sudo apt clean && sudo apt autoclean && sudo apt autoremove --purge
|
$ sudo bash -c 'apt clean && apt autoclean && apt autoremove --purge'
|
||||||
|
|
||||||
## 清理系统缓存
|
## 清理系统缓存
|
||||||
$ sudo rm -rvf /var/cache/apt/* /var/lib/apt/lists/* /tmp/*
|
$ sudo bash -c 'find /var/cache/apt /var/cache/smartdns /var/lib/apt/lists /tmp -type f -print -delete'
|
||||||
|
|
||||||
## 清理系统日志
|
## 清理系统日志
|
||||||
$ sudo find /var/log/ -type f | xargs sudo rm -rvf
|
$ sudo find /var/log/ -type f -print -delete
|
||||||
|
|
||||||
## 清理命令历史记录文件
|
## 清理命令历史记录文件
|
||||||
$ rm -rvf ~/.bash_history ~/.zsh_history ~/.zcompdump* && history -c
|
$ rm -rvf ~/.bash_history ~/.zsh_history ~/.zcompdump* && history -c
|
||||||
|
|||||||
@@ -65,13 +65,13 @@
|
|||||||
|
|
||||||
`启动/关机顺序` 为 `2` ,表示该虚拟机第 `2` 个启动,倒数第 `2` 个关机。
|
`启动/关机顺序` 为 `2` ,表示该虚拟机第 `2` 个启动,倒数第 `2` 个关机。
|
||||||
|
|
||||||
`启动延时` 为 `10` ,表示该虚拟机在 PVE 启动后,延迟 `10` 秒后自动启动。
|
`启动延时` 为 `10` ,表示该虚拟机启动后,延迟 `10` 秒再启动下一个虚拟机。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## 4.调整系统端口
|
## 4.调整系统端口
|
||||||
|
|
||||||
设置完成后,将该虚拟机开机,使用 SSH 工具登录,并执行以下命令检查端口占用。
|
设置完成后,将该虚拟机开机,使用终端工具登录,并执行以下命令检查端口占用。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 检查 53 端口占用
|
## 检查 53 端口占用
|
||||||
@@ -94,13 +94,14 @@ systemd-r 1797 systemd-resolve 21u IPv4 23027 0t0 TCP 127.0.0.54:domai
|
|||||||
$ sudo mkdir -p /etc/systemd/resolved.conf.d
|
$ sudo mkdir -p /etc/systemd/resolved.conf.d
|
||||||
|
|
||||||
## 创建 systemd-resolved 配置文件
|
## 创建 systemd-resolved 配置文件
|
||||||
$ sudo nvim /etc/systemd/resolved.conf.d/server_dns.conf
|
$ sudo nvim /etc/systemd/resolved.conf.d/10-server-dns.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
在配置文件中添加以下配置项,并保存。
|
在配置文件中添加以下配置项,并保存。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## systemd-resolved 配置项
|
# This configuration file is customized by fox,
|
||||||
|
# Optimize system resolve parameters for local DNS server.
|
||||||
|
|
||||||
[Resolve]
|
[Resolve]
|
||||||
DNS=127.0.0.1
|
DNS=127.0.0.1
|
||||||
@@ -215,10 +216,10 @@ $ mkdir -p /tmp/SmartDNS
|
|||||||
$ cd /tmp/SmartDNS
|
$ cd /tmp/SmartDNS
|
||||||
|
|
||||||
## 下载 SmartDNS 安装包
|
## 下载 SmartDNS 安装包
|
||||||
$ curl -LR -O https://github.com/pymumu/smartdns/releases/download/Release45/smartdns.1.2024.02.08-0828.x86_64-linux-all.tar.gz
|
$ curl -LR -O https://github.com/pymumu/smartdns/releases/download/Release46/smartdns.1.2024.06.12-2222.x86_64-linux-all.tar.gz
|
||||||
|
|
||||||
## 解压缩 SmartDNS 安装包
|
## 解压缩 SmartDNS 安装包
|
||||||
$ tar zxf smartdns.1.2024.02.08-0828.x86_64-linux-all.tar.gz
|
$ tar zxf smartdns.1.2024.06.12-2222.x86_64-linux-all.tar.gz
|
||||||
|
|
||||||
## 进入安装包目录
|
## 进入安装包目录
|
||||||
$ cd smartdns
|
$ cd smartdns
|
||||||
@@ -251,7 +252,7 @@ $ sudo systemctl enable smartdns.service
|
|||||||
$ sudo mkdir -p /etc/smartdns.d
|
$ sudo mkdir -p /etc/smartdns.d
|
||||||
|
|
||||||
## 下载广告规则配置文件
|
## 下载广告规则配置文件
|
||||||
$ sudo curl -LR -o /etc/smartdns.d/adrules.smartdns.conf https://adrules.top/smart-dns.conf
|
$ sudo curl -LR -o /etc/smartdns.d/neodevhost.smartdns.conf https://neodev.team/lite_smartdns.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
`SmartDNS` 的加速规则通过 `bash` 脚本安装,脚本生成的配置文件位于 `/etc/smartdns.d` 目录。
|
`SmartDNS` 的加速规则通过 `bash` 脚本安装,脚本生成的配置文件位于 `/etc/smartdns.d` 目录。
|
||||||
@@ -260,16 +261,16 @@ $ sudo curl -LR -o /etc/smartdns.d/adrules.smartdns.conf https://adrules.top/sma
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 下载加速规则安装脚本
|
## 下载加速规则安装脚本
|
||||||
$ sudo curl -LR -o /opt/smartdns_plugin.sh https://gitee.com/callmer/smartdns_china_list_installer/raw/main/smartdns_plugin.sh
|
$ sudo curl -LR -o /opt/smartdns-plugin.sh https://gitee.com/callmer/smartdns_china_list_installer/raw/main/smartdns_plugin.sh
|
||||||
|
|
||||||
## 设置脚本可执行权限
|
## 设置脚本可执行权限
|
||||||
$ sudo chmod +x /opt/smartdns_plugin.sh
|
$ sudo chmod +x /opt/smartdns-plugin.sh
|
||||||
|
|
||||||
## 设置脚本文件防篡改
|
## 设置脚本文件防篡改
|
||||||
$ sudo chattr +i /opt/smartdns_plugin.sh
|
$ sudo chattr +i /opt/smartdns-plugin.sh
|
||||||
|
|
||||||
## 执行脚本
|
## 执行脚本
|
||||||
$ sudo bash /opt/smartdns_plugin.sh
|
$ sudo bash /opt/smartdns-plugin.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
### 6.2. SmartDNS 主配置
|
### 6.2. SmartDNS 主配置
|
||||||
@@ -283,7 +284,7 @@ $ sudo bash /opt/smartdns_plugin.sh
|
|||||||
$ sudo systemctl stop smartdns.service
|
$ sudo systemctl stop smartdns.service
|
||||||
|
|
||||||
## 清理缓存
|
## 清理缓存
|
||||||
$ sudo rm -rvf /var/cache/smartdns
|
$ sudo rm -rvf /var/cache/smartdns*
|
||||||
|
|
||||||
## 清理进程标识文件
|
## 清理进程标识文件
|
||||||
$ sudo rm -rvf /var/run/smartdns.pid /run/smartdns.pid
|
$ sudo rm -rvf /var/run/smartdns.pid /run/smartdns.pid
|
||||||
@@ -311,8 +312,6 @@ $ sudo nvim /etc/smartdns/smartdns.conf
|
|||||||
|
|
||||||
- `SmartDNS` 端口监听参数为 `6053@lo` ,请根据实际情况进行调整
|
- `SmartDNS` 端口监听参数为 `6053@lo` ,请根据实际情况进行调整
|
||||||
|
|
||||||
- `edns-client-subnet` 为 EDNS 客户端子网,演示中 `202.103.24.68` 为湖北武汉市 DNS 服务器地址,请根据实际情况进行调整
|
|
||||||
|
|
||||||
- 检查配置文件中关于本地域名及其上游 DNS 服务器相关配置,请根据实际情况进行调整
|
- 检查配置文件中关于本地域名及其上游 DNS 服务器相关配置,请根据实际情况进行调整
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -324,50 +323,44 @@ $ sudo nvim /etc/smartdns/smartdns.conf
|
|||||||
# your network environment.
|
# your network environment.
|
||||||
#
|
#
|
||||||
# eg:
|
# eg:
|
||||||
# server 119.29.29.29
|
|
||||||
# server 223.5.5.5
|
# server 223.5.5.5
|
||||||
|
# server 180.184.1.1
|
||||||
|
# server 119.29.29.29
|
||||||
# server 114.114.114.114
|
# server 114.114.114.114
|
||||||
# server 2402:4e00::
|
# server 2402:4e00::
|
||||||
# server 2400:3200::1
|
# server 2400:3200::1
|
||||||
|
|
||||||
conf-file /etc/smartdns.d/adrules.smartdns.conf
|
conf-file /etc/smartdns.d/*.conf
|
||||||
|
|
||||||
conf-file /etc/smartdns.d/dns-group.china.smartdns.conf
|
|
||||||
conf-file /etc/smartdns.d/apple.china.smartdns.conf
|
|
||||||
conf-file /etc/smartdns.d/google.china.smartdns.conf
|
|
||||||
conf-file /etc/smartdns.d/accelerated-domains.china.smartdns.conf
|
|
||||||
conf-file /etc/smartdns.d/bogus-nxdomain.china.smartdns.conf
|
|
||||||
|
|
||||||
cache-file /tmp/smartdns.cache
|
|
||||||
|
|
||||||
log-level notice
|
log-level notice
|
||||||
|
|
||||||
bind [::]:6053@lo
|
bind [::]:6053@lo
|
||||||
bind-tcp [::]:6053@lo
|
bind-tcp [::]:6053@lo
|
||||||
|
|
||||||
serve-expired yes
|
cache-size 32768
|
||||||
serve-expired-ttl 64800
|
|
||||||
serve-expired-reply-ttl 3
|
|
||||||
prefetch-domain yes
|
|
||||||
serve-expired-prefetch-time 21600
|
|
||||||
|
|
||||||
force-qtype-SOA 65
|
|
||||||
max-query-limit 1024
|
max-query-limit 1024
|
||||||
edns-client-subnet 202.103.24.68
|
max-reply-ip-num 24
|
||||||
|
|
||||||
server-tcp 119.29.29.29 -group dnspod -exclude-default-group
|
prefetch-domain yes
|
||||||
server-tcp 2402:4e00:: -group dnspod -exclude-default-group
|
|
||||||
nameserver /doh.pub/dnspod
|
|
||||||
nameserver /dot.pub/dnspod
|
|
||||||
|
|
||||||
server-tcp 223.5.5.5 -group alidns -exclude-default-group
|
serve-expired yes
|
||||||
server-tcp 2400:3200::1 -group alidns -exclude-default-group
|
serve-expired-ttl 129600
|
||||||
nameserver /dns.alidns.com/alidns
|
serve-expired-reply-ttl 30
|
||||||
|
serve-expired-prefetch-time 28800
|
||||||
|
|
||||||
|
rr-ttl-min 60
|
||||||
|
rr-ttl-max 28800
|
||||||
|
rr-ttl-reply-max 14400
|
||||||
|
|
||||||
server 172.16.1.1 -group intranet -exclude-default-group
|
server 172.16.1.1 -group intranet -exclude-default-group
|
||||||
nameserver /fox.home.arpa/intranet
|
nameserver /fox.home.arpa/intranet
|
||||||
domain-rules /fox.home.arpa/ -speed-check-mode none -no-cache
|
domain-rules /fox.home.arpa/ -speed-check-mode none -no-cache
|
||||||
|
|
||||||
|
server-tcp 180.184.2.2 -bootstrap-dns
|
||||||
|
server-tcp 114.114.115.115 -bootstrap-dns
|
||||||
|
server-tcp 2400:3200:baba::1 -bootstrap-dns
|
||||||
|
server-tcp 2400:7fc0:849e:200::4 -bootstrap-dns
|
||||||
|
|
||||||
server-tls dot.pub
|
server-tls dot.pub
|
||||||
server-tls dns.alidns.com
|
server-tls dns.alidns.com
|
||||||
|
|
||||||
@@ -390,7 +383,7 @@ $ sudo crontab -e
|
|||||||
```bash
|
```bash
|
||||||
## 定时任务配置项
|
## 定时任务配置项
|
||||||
|
|
||||||
20 9 * * * /usr/bin/curl --retry-connrefused --retry 5 --retry-delay 5 --retry-max-time 60 -fsSLR -o /etc/smartdns.d/adrules.smartdns.conf https://adrules.top/smart-dns.conf
|
20 9 * * * /usr/bin/curl --retry-connrefused --retry 5 --retry-delay 5 --retry-max-time 60 -fsSLR -o /etc/smartdns.d/neodevhost.smartdns.conf https://neodev.team/lite_smartdns.conf
|
||||||
|
|
||||||
30 9 * * * /usr/bin/systemctl restart smartdns.service
|
30 9 * * * /usr/bin/systemctl restart smartdns.service
|
||||||
|
|
||||||
@@ -401,9 +394,9 @@ $ sudo crontab -e
|
|||||||
```bash
|
```bash
|
||||||
## 定时任务配置项
|
## 定时任务配置项
|
||||||
|
|
||||||
20 9 * * * /usr/bin/curl --retry-connrefused --retry 5 --retry-delay 5 --retry-max-time 60 -fsSLR -o /etc/smartdns.d/adrules.smartdns.conf https://adrules.top/smart-dns.conf
|
20 9 * * * /usr/bin/curl --retry-connrefused --retry 5 --retry-delay 5 --retry-max-time 60 -fsSLR -o /etc/smartdns.d/neodevhost.smartdns.conf https://neodev.team/lite_smartdns.conf
|
||||||
|
|
||||||
30 9 * * * /usr/bin/bash /opt/smartdns_plugin.sh
|
30 9 * * * /usr/bin/bash /opt/smartdns-plugin.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
### 6.4.配置 Dnsmasq
|
### 6.4.配置 Dnsmasq
|
||||||
@@ -444,15 +437,14 @@ conf-file=/etc/dnsmasq.conf
|
|||||||
log-facility=/var/log/dnsmasq.log
|
log-facility=/var/log/dnsmasq.log
|
||||||
log-async=20
|
log-async=20
|
||||||
|
|
||||||
cache-size=1024
|
cache-size=2048
|
||||||
max-cache-ttl=7200
|
max-cache-ttl=7200
|
||||||
edns-packet-max=1232
|
fast-dns-retry=1800
|
||||||
rebind-domain-ok=/fox.home.arpa/
|
rebind-domain-ok=/fox.home.arpa/
|
||||||
|
|
||||||
bind-dynamic
|
bind-dynamic
|
||||||
bogus-priv
|
bogus-priv
|
||||||
domain-needed
|
domain-needed
|
||||||
localise-queries
|
|
||||||
local-service
|
local-service
|
||||||
no-hosts
|
no-hosts
|
||||||
no-negcache
|
no-negcache
|
||||||
@@ -465,11 +457,10 @@ stop-dns-rebind
|
|||||||
|
|
||||||
server=/alt/
|
server=/alt/
|
||||||
server=/home.arpa/
|
server=/home.arpa/
|
||||||
server=/ipv4only.arpa/
|
|
||||||
server=/resolver.arpa/
|
|
||||||
server=/example/
|
server=/example/
|
||||||
server=/bind/
|
server=/bind/
|
||||||
server=/invalid/
|
server=/invalid/
|
||||||
|
server=/lan/
|
||||||
server=/local/
|
server=/local/
|
||||||
server=/localhost/
|
server=/localhost/
|
||||||
server=/onion/
|
server=/onion/
|
||||||
|
|||||||
@@ -28,8 +28,8 @@
|
|||||||
在虚拟机的命令行界面,使用 `vim` 编辑器编辑 `sshd` 服务的配置文件,执行以下命令。
|
在虚拟机的命令行界面,使用 `vim` 编辑器编辑 `sshd` 服务的配置文件,执行以下命令。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 编辑 ssh 配置文件
|
## 编辑 SSH 配置文件
|
||||||
$ sudo vim /etc/ssh/sshd_config.d/server_sshd.conf
|
$ sudo vim /etc/ssh/sshd_config.d/10-server-sshd.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
在配置文件中添加以下配置项,并保存。
|
在配置文件中添加以下配置项,并保存。
|
||||||
@@ -46,17 +46,17 @@ UseDNS no
|
|||||||
修改完成后,需要重启 SSH 服务。
|
修改完成后,需要重启 SSH 服务。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 重启 sshd
|
## 重启 ssh.service
|
||||||
$ sudo systemctl restart ssh.service
|
$ sudo systemctl restart ssh.service
|
||||||
```
|
```
|
||||||
|
|
||||||
### 1.2.配置软件源
|
### 1.2.配置软件源
|
||||||
|
|
||||||
使用 SSH 工具登录 TS 服务器,常用 SSH 工具请参阅 [01.PVE系统安装](./01.PVE系统安装.md) 。
|
使用终端工具登录 TS 服务器,常用终端工具请参阅 [01.PVE系统安装](./01.PVE系统安装.md) 。
|
||||||
|
|
||||||
首先需要对 Debian 系统软件源进行修改,这里使用 [USTC](http://mirrors.ustc.edu.cn/help/debian.html) 镜像站作为演示。
|
首先需要对 Debian 系统软件源进行修改,这里使用 [USTC](https://mirrors.ustc.edu.cn) 镜像站作为演示。
|
||||||
|
|
||||||
当系统版本发生变化时,请参考使用 snullp 大叔开发的 [配置生成器](https://mirrors.ustc.edu.cn/repogen/) 。
|
当系统版本发生变化时,请参考 USTC 镜像站的官方说明 [USTC Mirror Help - Debian](https://mirrors.ustc.edu.cn/help/debian.html) 。
|
||||||
|
|
||||||
使用 `vim` 编辑器编辑 `debian.sources` 配置文件,执行以下命令。
|
使用 `vim` 编辑器编辑 `debian.sources` 配置文件,执行以下命令。
|
||||||
|
|
||||||
@@ -113,20 +113,20 @@ $ curl -fsSL https://pkgs.tailscale.com/stable/debian/bookworm.tailscale-keyring
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 清理不必要的包
|
## 清理不必要的包
|
||||||
$ sudo apt clean && sudo apt autoclean && sudo apt autoremove --purge
|
$ sudo bash -c 'apt clean && apt autoclean && apt autoremove --purge'
|
||||||
|
|
||||||
## 更新软件源
|
## 更新软件源
|
||||||
$ sudo apt update
|
$ sudo apt update
|
||||||
|
|
||||||
## 更新系统
|
## 更新系统
|
||||||
$ sudo apt dist-upgrade
|
$ sudo apt full-upgrade
|
||||||
```
|
```
|
||||||
|
|
||||||
接下来安装系统必要软件,安装 `iperf3` 后,系统将询问是否将其作为系统服务开机自启,选择 `no` 即可。
|
接下来安装系统必要软件,安装 `iperf3` 后,系统将询问是否将其作为系统服务开机自启,选择 `no` 即可。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 安装系统软件
|
## 安装系统软件
|
||||||
$ sudo apt install qemu-guest-agent zsh git htop tmux cron nftables sshguard neovim
|
$ sudo apt install qemu-guest-agent zsh git btop tmux cron nftables sshguard neovim
|
||||||
|
|
||||||
## 安装系统自动更新工具
|
## 安装系统自动更新工具
|
||||||
$ sudo apt install unattended-upgrades powermgmt-base python3-gi
|
$ sudo apt install unattended-upgrades powermgmt-base python3-gi
|
||||||
@@ -147,7 +147,7 @@ $ sudo sync
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
## 创建 内核模块 配置文件
|
## 创建 内核模块 配置文件
|
||||||
$ sudo nvim /etc/modules-load.d/server_modules.conf
|
$ sudo nvim /etc/modules-load.d/10-server-modules.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
在配置文件中添加以下配置项,并保存。
|
在配置文件中添加以下配置项,并保存。
|
||||||
@@ -192,6 +192,9 @@ net.core.netdev_budget = 600
|
|||||||
net.core.netdev_budget_usecs = 20000
|
net.core.netdev_budget_usecs = 20000
|
||||||
|
|
||||||
net.core.rps_sock_flow_entries = 32768
|
net.core.rps_sock_flow_entries = 32768
|
||||||
|
net.core.somaxconn = 8192
|
||||||
|
net.core.rmem_max = 16777216
|
||||||
|
net.core.wmem_max = 16777216
|
||||||
|
|
||||||
net.ipv4.conf.all.accept_redirects = 0
|
net.ipv4.conf.all.accept_redirects = 0
|
||||||
net.ipv4.conf.default.accept_redirects = 0
|
net.ipv4.conf.default.accept_redirects = 0
|
||||||
@@ -218,7 +221,9 @@ net.ipv4.route.redirect_silence = 2048
|
|||||||
net.ipv4.tcp_challenge_ack_limit = 1000
|
net.ipv4.tcp_challenge_ack_limit = 1000
|
||||||
net.ipv4.tcp_fin_timeout = 30
|
net.ipv4.tcp_fin_timeout = 30
|
||||||
net.ipv4.tcp_keepalive_time = 120
|
net.ipv4.tcp_keepalive_time = 120
|
||||||
net.ipv4.tcp_syncookies = 1
|
net.ipv4.tcp_notsent_lowat = 131072
|
||||||
|
net.ipv4.tcp_rmem = 16384 262144 8388608
|
||||||
|
net.ipv4.tcp_wmem = 32768 524288 16777216
|
||||||
|
|
||||||
net.ipv6.conf.all.accept_ra = 0
|
net.ipv6.conf.all.accept_ra = 0
|
||||||
net.ipv6.conf.default.accept_ra = 0
|
net.ipv6.conf.default.accept_ra = 0
|
||||||
@@ -266,16 +271,17 @@ Debian 云镜像默认使用 `systemd-timesyncd.service` 同步时间,且需
|
|||||||
$ sudo mkdir -p /etc/systemd/timesyncd.conf.d
|
$ sudo mkdir -p /etc/systemd/timesyncd.conf.d
|
||||||
|
|
||||||
## 创建 NTP 配置文件
|
## 创建 NTP 配置文件
|
||||||
$ sudo nvim /etc/systemd/timesyncd.conf.d/server_ntp.conf
|
$ sudo nvim /etc/systemd/timesyncd.conf.d/10-server-ntp.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
在配置文件中添加以下配置项,并保存。
|
在配置文件中添加以下配置项,并保存。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## NTP 配置项
|
# This configuration file is customized by fox,
|
||||||
|
# Optimize system NTP server.
|
||||||
|
|
||||||
[Time]
|
[Time]
|
||||||
NTP=ntp.tencent.com ntp.aliyun.com
|
NTP=ntp.aliyun.com ntp.tencent.com cn.pool.ntp.org
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -431,13 +437,14 @@ $ sudo systemctl restart nftables.service
|
|||||||
$ sudo mkdir -p /etc/systemd/resolved.conf.d
|
$ sudo mkdir -p /etc/systemd/resolved.conf.d
|
||||||
|
|
||||||
## 创建 systemd-resolved 配置文件
|
## 创建 systemd-resolved 配置文件
|
||||||
$ sudo nvim /etc/systemd/resolved.conf.d/server_dns.conf
|
$ sudo nvim /etc/systemd/resolved.conf.d/10-server-dns.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
在配置文件中添加以下配置项,并保存。
|
在配置文件中添加以下配置项,并保存。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
## systemd-resolved 配置项
|
# This configuration file is customized by fox,
|
||||||
|
# Optimize system resolve parameters for local TS server.
|
||||||
|
|
||||||
[Resolve]
|
[Resolve]
|
||||||
DNS=127.0.0.1
|
DNS=127.0.0.1
|
||||||
@@ -511,15 +518,14 @@ conf-file=/etc/dnsmasq.conf
|
|||||||
log-facility=/var/log/dnsmasq.log
|
log-facility=/var/log/dnsmasq.log
|
||||||
log-async=20
|
log-async=20
|
||||||
|
|
||||||
cache-size=1024
|
cache-size=2048
|
||||||
max-cache-ttl=7200
|
max-cache-ttl=7200
|
||||||
edns-packet-max=1232
|
fast-dns-retry=1800
|
||||||
rebind-domain-ok=/fox.home.arpa/
|
rebind-domain-ok=/fox.home.arpa/
|
||||||
|
|
||||||
bind-dynamic
|
bind-dynamic
|
||||||
bogus-priv
|
bogus-priv
|
||||||
domain-needed
|
domain-needed
|
||||||
localise-queries
|
|
||||||
local-service
|
local-service
|
||||||
no-hosts
|
no-hosts
|
||||||
no-negcache
|
no-negcache
|
||||||
@@ -531,11 +537,10 @@ stop-dns-rebind
|
|||||||
|
|
||||||
server=/alt/
|
server=/alt/
|
||||||
server=/home.arpa/
|
server=/home.arpa/
|
||||||
server=/ipv4only.arpa/
|
|
||||||
server=/resolver.arpa/
|
|
||||||
server=/example/
|
server=/example/
|
||||||
server=/bind/
|
server=/bind/
|
||||||
server=/invalid/
|
server=/invalid/
|
||||||
|
server=/lan/
|
||||||
server=/local/
|
server=/local/
|
||||||
server=/localhost/
|
server=/localhost/
|
||||||
server=/onion/
|
server=/onion/
|
||||||
@@ -613,5 +618,15 @@ $ sudo tailscale up --advertise-exit-node --accept-routes --advertise-routes=172
|
|||||||
|
|
||||||
执行命令后,TS 将自动显示登录链接,只需根据链接进行登录操作即可。
|
执行命令后,TS 将自动显示登录链接,只需根据链接进行登录操作即可。
|
||||||
|
|
||||||
|
目前 TS 将跟随系统自动更新,若需额外开启 TS 的自动更新功能,执行以下命令。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
## TS 开启自动更新
|
||||||
|
$ sudo tailscale set --auto-update
|
||||||
|
|
||||||
|
## TS 关闭自动更新
|
||||||
|
$ sudo tailscale set --auto-update=false
|
||||||
|
```
|
||||||
|
|
||||||
至此,TS 服务器已配置完成。
|
至此,TS 服务器已配置完成。
|
||||||
|
|
||||||
|
|||||||
@@ -18,13 +18,13 @@
|
|||||||
|存储|`local`|选择存放备份文件的路径|
|
|存储|`local`|选择存放备份文件的路径|
|
||||||
|计划|`*-01,16 03:30`|`备份作业` 执行的时间计划|
|
|计划|`*-01,16 03:30`|`备份作业` 执行的时间计划|
|
||||||
|选择模式|`包括选中的VMs`|执行备份的虚拟机对象|
|
|选择模式|`包括选中的VMs`|执行备份的虚拟机对象|
|
||||||
|
|通知模式|`默认(自动)`|执行备份时的通知模式,保持默认即可|
|
||||||
|发送邮箱至|`your_email@domain.com`|`备份作业` 邮件的收件人邮箱|
|
|发送邮箱至|`your_email@domain.com`|`备份作业` 邮件的收件人邮箱|
|
||||||
|电子邮件|`始终通知`|何时发送 `备份作业` 邮件提醒|
|
|发送邮件|`总是`|发送 `备份作业` 邮件提醒的条件|
|
||||||
|压缩|`ZSTD`|选择备份文件的压缩算法|
|
|压缩|`ZSTD`|选择备份文件的压缩算法|
|
||||||
|模式|`停止`|选择备份虚拟机的方式,推荐使用 `停止` |
|
|模式|`停止`|选择备份虚拟机的方式,推荐使用 `停止` |
|
||||||
|启用|**勾选**|表示该 `备份作业` 为启用状态|
|
|启用|**勾选**|表示该 `备份作业` 为启用状态|
|
||||||
|作业评论|`Backup Your Server :)`|`备份作业` 的备注信息,使用英文输入|
|
|作业评论|`Backup Your Server :)`|`备份作业` 的备注信息,使用英文输入|
|
||||||
|重复错过|**勾选**|表示当意外错过备份执行时间后,将重试备份|
|
|
||||||
|
|
||||||
**额外说明:**
|
**额外说明:**
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 1.3.日志模板
|
### 1.3.备注模板
|
||||||
|
|
||||||
该选项将按照设置的内容,自动重命名备份文件。
|
该选项将按照设置的内容,自动重命名备份文件。
|
||||||
|
|
||||||
@@ -54,6 +54,12 @@
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
### 1.4.高级选项
|
||||||
|
|
||||||
|
该选项提供 `备份作业` 进行时的高级可调参数,仅需勾选 `重复错过` 选项即可。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
## 2.调度模拟器
|
## 2.调度模拟器
|
||||||
|
|
||||||
在创建完成 `备份作业` 后,可以使用 `调度模拟器` 来模拟 `备份作业` 的执行时间。
|
在创建完成 `备份作业` 后,可以使用 `调度模拟器` 来模拟 `备份作业` 的执行时间。
|
||||||
|
|||||||
@@ -3,13 +3,13 @@
|
|||||||
## 介绍
|
## 介绍
|
||||||
PVE 虚拟化平台的安装以及折腾手记。
|
PVE 虚拟化平台的安装以及折腾手记。
|
||||||
|
|
||||||
- PVE ISO 版本:8.1-1 (更新时间: 2023-11-23)
|
- PVE ISO 版本:8.3-1 (更新时间: 2024-11-21)
|
||||||
|
|
||||||
- 演示机:
|
- 演示机:
|
||||||
- CPU:英特尔奔腾 Silver N6005 处理器
|
- CPU:N6005
|
||||||
- 内存:16 GB
|
- 内存:16GB DDR4
|
||||||
- 网卡:英特尔以太网控制器 I226-V
|
- 网卡:I226-V
|
||||||
- 硬盘:500 GB NVMe 固态硬盘
|
- 硬盘:500GB NVMe
|
||||||
|
|
||||||
- PVE 网络:
|
- PVE 网络:
|
||||||
- IPv4 网络
|
- IPv4 网络
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 146 KiB After Width: | Height: | Size: 211 KiB |
|
Before Width: | Height: | Size: 109 KiB After Width: | Height: | Size: 280 KiB |
|
Before Width: | Height: | Size: 115 KiB After Width: | Height: | Size: 300 KiB |
|
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 292 KiB |
|
Before Width: | Height: | Size: 105 KiB After Width: | Height: | Size: 265 KiB |
|
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 186 KiB |
|
Before Width: | Height: | Size: 112 KiB After Width: | Height: | Size: 294 KiB |
|
Before Width: | Height: | Size: 156 KiB After Width: | Height: | Size: 220 KiB |
|
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 111 KiB |
|
Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 271 KiB |
|
Before Width: | Height: | Size: 599 KiB |
|
After Width: | Height: | Size: 160 KiB |
|
Before Width: | Height: | Size: 401 KiB After Width: | Height: | Size: 370 KiB |
|
After Width: | Height: | Size: 199 KiB |
|
After Width: | Height: | Size: 579 KiB |
|
Before Width: | Height: | Size: 322 KiB |
|
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 187 KiB |
|
After Width: | Height: | Size: 384 KiB |
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 127 KiB |
|
Before Width: | Height: | Size: 136 KiB After Width: | Height: | Size: 300 KiB |
|
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 151 KiB |
|
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 220 KiB |
|
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 201 KiB |
|
Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 171 KiB |
@@ -4,14 +4,18 @@
|
|||||||
kernel.panic = 20
|
kernel.panic = 20
|
||||||
kernel.panic_on_oops = 1
|
kernel.panic_on_oops = 1
|
||||||
|
|
||||||
net.core.default_qdisc = fq
|
net.core.default_qdisc = fq_codel
|
||||||
net.ipv4.tcp_congestion_control = bbr
|
net.ipv4.tcp_congestion_control = cubic
|
||||||
|
|
||||||
# Other adjustable system parameters
|
# Other adjustable system parameters
|
||||||
|
|
||||||
net.core.netdev_budget = 600
|
net.core.netdev_budget = 600
|
||||||
net.core.netdev_budget_usecs = 20000
|
net.core.netdev_budget_usecs = 20000
|
||||||
|
|
||||||
|
net.core.somaxconn = 8192
|
||||||
|
net.core.rmem_max = 16777216
|
||||||
|
net.core.wmem_max = 16777216
|
||||||
|
|
||||||
net.ipv4.conf.all.log_martians = 1
|
net.ipv4.conf.all.log_martians = 1
|
||||||
|
|
||||||
net.ipv4.igmp_max_memberships = 256
|
net.ipv4.igmp_max_memberships = 256
|
||||||
@@ -19,7 +23,9 @@ net.ipv4.igmp_max_memberships = 256
|
|||||||
net.ipv4.tcp_challenge_ack_limit = 1000
|
net.ipv4.tcp_challenge_ack_limit = 1000
|
||||||
net.ipv4.tcp_fin_timeout = 30
|
net.ipv4.tcp_fin_timeout = 30
|
||||||
net.ipv4.tcp_keepalive_time = 120
|
net.ipv4.tcp_keepalive_time = 120
|
||||||
net.ipv4.tcp_syncookies = 1
|
net.ipv4.tcp_notsent_lowat = 131072
|
||||||
|
net.ipv4.tcp_rmem = 16384 262144 8388608
|
||||||
|
net.ipv4.tcp_wmem = 32768 524288 16777216
|
||||||
|
|
||||||
net.ipv6.conf.all.use_tempaddr = 0
|
net.ipv6.conf.all.use_tempaddr = 0
|
||||||
net.ipv6.conf.default.use_tempaddr = 0
|
net.ipv6.conf.default.use_tempaddr = 0
|
||||||
|
|||||||
@@ -9,15 +9,14 @@ conf-file=/etc/dnsmasq.conf
|
|||||||
log-facility=/var/log/dnsmasq.log
|
log-facility=/var/log/dnsmasq.log
|
||||||
log-async=20
|
log-async=20
|
||||||
|
|
||||||
cache-size=1024
|
cache-size=2048
|
||||||
max-cache-ttl=7200
|
max-cache-ttl=7200
|
||||||
edns-packet-max=1232
|
fast-dns-retry=1800
|
||||||
rebind-domain-ok=/fox.home.arpa/
|
rebind-domain-ok=/fox.home.arpa/
|
||||||
|
|
||||||
bind-dynamic
|
bind-dynamic
|
||||||
bogus-priv
|
bogus-priv
|
||||||
domain-needed
|
domain-needed
|
||||||
localise-queries
|
|
||||||
local-service
|
local-service
|
||||||
no-hosts
|
no-hosts
|
||||||
no-negcache
|
no-negcache
|
||||||
@@ -30,11 +29,10 @@ stop-dns-rebind
|
|||||||
|
|
||||||
server=/alt/
|
server=/alt/
|
||||||
server=/home.arpa/
|
server=/home.arpa/
|
||||||
server=/ipv4only.arpa/
|
|
||||||
server=/resolver.arpa/
|
|
||||||
server=/example/
|
server=/example/
|
||||||
server=/bind/
|
server=/bind/
|
||||||
server=/invalid/
|
server=/invalid/
|
||||||
|
server=/lan/
|
||||||
server=/local/
|
server=/local/
|
||||||
server=/localhost/
|
server=/localhost/
|
||||||
server=/onion/
|
server=/onion/
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
## 下载加速规则安装脚本
|
## 下载加速规则安装脚本
|
||||||
$ sudo curl -LR -o /opt/dnsmasq_plugin.sh https://gitee.com/felixonmars/dnsmasq-china-list/raw/master/install.sh
|
$ sudo curl -LR -o /opt/dnsmasq-plugin.sh https://gitee.com/felixonmars/dnsmasq-china-list/raw/master/install.sh
|
||||||
|
|
||||||
## 设置脚本可执行权限
|
## 设置脚本可执行权限
|
||||||
$ sudo chmod +x /opt/dnsmasq_plugin.sh
|
$ sudo chmod +x /opt/dnsmasq-plugin.sh
|
||||||
|
|
||||||
## 设置脚本文件防篡改
|
## 设置脚本文件防篡改
|
||||||
$ sudo chattr +i /opt/dnsmasq_plugin.sh
|
$ sudo chattr +i /opt/dnsmasq-plugin.sh
|
||||||
|
|
||||||
## 执行脚本
|
## 执行脚本
|
||||||
$ sudo bash /opt/dnsmasq_plugin.sh
|
$ sudo bash /opt/dnsmasq-plugin.sh
|
||||||
|
|
||||||
## 设置 crontab
|
## 设置 crontab
|
||||||
|
|
||||||
25 9 * * * /usr/bin/curl --retry-connrefused --retry 5 --retry-delay 5 --retry-max-time 60 -fsSLR -o /etc/dnsmasq.d/anti-ad.dnsmasq.conf https://anti-ad.net/anti-ad-for-dnsmasq.conf
|
25 9 * * * /usr/bin/curl --retry-connrefused --retry 5 --retry-delay 5 --retry-max-time 60 -fsSLR -o /etc/dnsmasq.d/anti-ad.dnsmasq.conf https://anti-ad.net/anti-ad-for-dnsmasq.conf
|
||||||
|
|
||||||
35 9 * * * /usr/bin/bash /opt/dnsmasq_plugin.sh
|
35 9 * * * /usr/bin/bash /opt/dnsmasq-plugin.sh
|
||||||
|
|
||||||
|
|||||||
@@ -6,50 +6,44 @@
|
|||||||
# your network environment.
|
# your network environment.
|
||||||
#
|
#
|
||||||
# eg:
|
# eg:
|
||||||
# server 119.29.29.29
|
|
||||||
# server 223.5.5.5
|
# server 223.5.5.5
|
||||||
|
# server 180.184.1.1
|
||||||
|
# server 119.29.29.29
|
||||||
# server 114.114.114.114
|
# server 114.114.114.114
|
||||||
# server 2402:4e00::
|
# server 2402:4e00::
|
||||||
# server 2400:3200::1
|
# server 2400:3200::1
|
||||||
|
|
||||||
conf-file /etc/smartdns.d/adrules.smartdns.conf
|
conf-file /etc/smartdns.d/*.conf
|
||||||
|
|
||||||
conf-file /etc/smartdns.d/dns-group.china.smartdns.conf
|
|
||||||
conf-file /etc/smartdns.d/apple.china.smartdns.conf
|
|
||||||
conf-file /etc/smartdns.d/google.china.smartdns.conf
|
|
||||||
conf-file /etc/smartdns.d/accelerated-domains.china.smartdns.conf
|
|
||||||
conf-file /etc/smartdns.d/bogus-nxdomain.china.smartdns.conf
|
|
||||||
|
|
||||||
cache-file /tmp/smartdns.cache
|
|
||||||
|
|
||||||
log-level notice
|
log-level notice
|
||||||
|
|
||||||
bind [::]:6053@lo
|
bind [::]:6053@lo
|
||||||
bind-tcp [::]:6053@lo
|
bind-tcp [::]:6053@lo
|
||||||
|
|
||||||
serve-expired yes
|
cache-size 32768
|
||||||
serve-expired-ttl 64800
|
|
||||||
serve-expired-reply-ttl 3
|
|
||||||
prefetch-domain yes
|
|
||||||
serve-expired-prefetch-time 21600
|
|
||||||
|
|
||||||
force-qtype-SOA 65
|
|
||||||
max-query-limit 1024
|
max-query-limit 1024
|
||||||
edns-client-subnet 202.103.24.68
|
max-reply-ip-num 24
|
||||||
|
|
||||||
server-tcp 119.29.29.29 -group dnspod -exclude-default-group
|
prefetch-domain yes
|
||||||
server-tcp 2402:4e00:: -group dnspod -exclude-default-group
|
|
||||||
nameserver /doh.pub/dnspod
|
|
||||||
nameserver /dot.pub/dnspod
|
|
||||||
|
|
||||||
server-tcp 223.5.5.5 -group alidns -exclude-default-group
|
serve-expired yes
|
||||||
server-tcp 2400:3200::1 -group alidns -exclude-default-group
|
serve-expired-ttl 129600
|
||||||
nameserver /dns.alidns.com/alidns
|
serve-expired-reply-ttl 30
|
||||||
|
serve-expired-prefetch-time 28800
|
||||||
|
|
||||||
|
rr-ttl-min 60
|
||||||
|
rr-ttl-max 28800
|
||||||
|
rr-ttl-reply-max 14400
|
||||||
|
|
||||||
server 172.16.1.1 -group intranet -exclude-default-group
|
server 172.16.1.1 -group intranet -exclude-default-group
|
||||||
nameserver /fox.home.arpa/intranet
|
nameserver /fox.home.arpa/intranet
|
||||||
domain-rules /fox.home.arpa/ -speed-check-mode none -no-cache
|
domain-rules /fox.home.arpa/ -speed-check-mode none -no-cache
|
||||||
|
|
||||||
|
server-tcp 180.184.2.2 -bootstrap-dns
|
||||||
|
server-tcp 114.114.115.115 -bootstrap-dns
|
||||||
|
server-tcp 2400:3200:baba::1 -bootstrap-dns
|
||||||
|
server-tcp 2400:7fc0:849e:200::4 -bootstrap-dns
|
||||||
|
|
||||||
server-tls dot.pub
|
server-tls dot.pub
|
||||||
server-tls dns.alidns.com
|
server-tls dns.alidns.com
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
# This configuration file is customized by fox,
|
# This configuration file is customized by fox,
|
||||||
# Optimize SmartDNS crontab for local DNS server.
|
# Optimize SmartDNS crontab for local DNS server.
|
||||||
|
|
||||||
20 9 * * * /usr/bin/curl --retry-connrefused --retry 5 --retry-delay 5 --retry-max-time 60 -fsSLR -o /etc/smartdns.d/adrules.smartdns.conf https://adrules.top/smart-dns.conf
|
20 9 * * * /usr/bin/curl --retry-connrefused --retry 5 --retry-delay 5 --retry-max-time 60 -fsSLR -o /etc/smartdns.d/neodevhost.smartdns.conf https://neodev.team/lite_smartdns.conf
|
||||||
|
|
||||||
30 9 * * * /usr/bin/systemctl restart smartdns.service
|
30 9 * * * /usr/bin/systemctl restart smartdns.service
|
||||||
|
|
||||||
|
|
||||||
## Or when the smartdns plugin is installed
|
## Or when the smartdns plugin is installed
|
||||||
|
|
||||||
20 9 * * * /usr/bin/curl --retry-connrefused --retry 5 --retry-delay 5 --retry-max-time 60 -fsSLR -o /etc/smartdns.d/adrules.smartdns.conf https://adrules.top/smart-dns.conf
|
20 9 * * * /usr/bin/curl --retry-connrefused --retry 5 --retry-delay 5 --retry-max-time 60 -fsSLR -o /etc/smartdns.d/neodevhost.smartdns.conf https://neodev.team/lite_smartdns.conf
|
||||||
|
|
||||||
30 9 * * * /usr/bin/bash /opt/smartdns_plugin.sh
|
30 9 * * * /usr/bin/bash /opt/smartdns-plugin.sh
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set -e
|
|||||||
|
|
||||||
WORKDIR="$(mktemp -d)"
|
WORKDIR="$(mktemp -d)"
|
||||||
CONFDIR="/etc/smartdns.d"
|
CONFDIR="/etc/smartdns.d"
|
||||||
SERVERS=(223.5.5.5 180.184.1.1 119.29.29.29 114.114.114.114)
|
SERVERS=(223.5.5.5 180.184.1.1 119.29.29.29 114.114.114.114 2402:4e00:: 2400:3200::1)
|
||||||
GROUP=(flash)
|
GROUP=(flash)
|
||||||
# Others: 223.6.6.6 119.28.28.28
|
# Others: 223.6.6.6 119.28.28.28
|
||||||
# Not using best possible CDN pop: 1.2.4.8 210.2.4.8
|
# Not using best possible CDN pop: 1.2.4.8 210.2.4.8
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ net.core.netdev_budget = 600
|
|||||||
net.core.netdev_budget_usecs = 20000
|
net.core.netdev_budget_usecs = 20000
|
||||||
|
|
||||||
net.core.rps_sock_flow_entries = 32768
|
net.core.rps_sock_flow_entries = 32768
|
||||||
|
net.core.somaxconn = 8192
|
||||||
|
net.core.rmem_max = 16777216
|
||||||
|
net.core.wmem_max = 16777216
|
||||||
|
|
||||||
net.ipv4.conf.all.accept_redirects = 0
|
net.ipv4.conf.all.accept_redirects = 0
|
||||||
net.ipv4.conf.default.accept_redirects = 0
|
net.ipv4.conf.default.accept_redirects = 0
|
||||||
@@ -44,7 +47,9 @@ net.ipv4.route.redirect_silence = 2048
|
|||||||
net.ipv4.tcp_challenge_ack_limit = 1000
|
net.ipv4.tcp_challenge_ack_limit = 1000
|
||||||
net.ipv4.tcp_fin_timeout = 30
|
net.ipv4.tcp_fin_timeout = 30
|
||||||
net.ipv4.tcp_keepalive_time = 120
|
net.ipv4.tcp_keepalive_time = 120
|
||||||
net.ipv4.tcp_syncookies = 1
|
net.ipv4.tcp_notsent_lowat = 131072
|
||||||
|
net.ipv4.tcp_rmem = 16384 262144 8388608
|
||||||
|
net.ipv4.tcp_wmem = 32768 524288 16777216
|
||||||
|
|
||||||
net.ipv6.conf.all.accept_ra = 0
|
net.ipv6.conf.all.accept_ra = 0
|
||||||
net.ipv6.conf.default.accept_ra = 0
|
net.ipv6.conf.default.accept_ra = 0
|
||||||
|
|||||||
@@ -9,15 +9,14 @@ conf-file=/etc/dnsmasq.conf
|
|||||||
log-facility=/var/log/dnsmasq.log
|
log-facility=/var/log/dnsmasq.log
|
||||||
log-async=20
|
log-async=20
|
||||||
|
|
||||||
cache-size=1024
|
cache-size=2048
|
||||||
max-cache-ttl=7200
|
max-cache-ttl=7200
|
||||||
edns-packet-max=1232
|
fast-dns-retry=1800
|
||||||
rebind-domain-ok=/fox.home.arpa/
|
rebind-domain-ok=/fox.home.arpa/
|
||||||
|
|
||||||
bind-dynamic
|
bind-dynamic
|
||||||
bogus-priv
|
bogus-priv
|
||||||
domain-needed
|
domain-needed
|
||||||
localise-queries
|
|
||||||
local-service
|
local-service
|
||||||
no-hosts
|
no-hosts
|
||||||
no-negcache
|
no-negcache
|
||||||
@@ -29,11 +28,10 @@ stop-dns-rebind
|
|||||||
|
|
||||||
server=/alt/
|
server=/alt/
|
||||||
server=/home.arpa/
|
server=/home.arpa/
|
||||||
server=/ipv4only.arpa/
|
|
||||||
server=/resolver.arpa/
|
|
||||||
server=/example/
|
server=/example/
|
||||||
server=/bind/
|
server=/bind/
|
||||||
server=/invalid/
|
server=/invalid/
|
||||||
|
server=/lan/
|
||||||
server=/local/
|
server=/local/
|
||||||
server=/localhost/
|
server=/localhost/
|
||||||
server=/onion/
|
server=/onion/
|
||||||
|
|||||||
@@ -24,25 +24,24 @@ table inet router {
|
|||||||
|
|
||||||
chain input {
|
chain input {
|
||||||
type filter hook input priority filter; policy drop;
|
type filter hook input priority filter; policy drop;
|
||||||
|
ct state established,related accept comment "defconf: handle inbound flows"
|
||||||
iif "lo" accept comment "defconf: accept traffic from loopback"
|
iif "lo" accept comment "defconf: accept traffic from loopback"
|
||||||
ct state vmap { established : accept, related : accept } comment "defconf: handle inbound flows"
|
ct state new meta l4proto tcp jump syn_flood comment "defconf: rate limit new TCP connections"
|
||||||
tcp flags syn / fin,syn,rst,ack counter jump syn_flood comment "defconf: rate limit TCP-SYN packets"
|
|
||||||
iifname "eth0" jump input_lan comment "defconf: handle LAN IPv4 / IPv6 input traffic"
|
iifname "eth0" jump input_lan comment "defconf: handle LAN IPv4 / IPv6 input traffic"
|
||||||
iifname "tailscale0" counter jump input_tailscale comment "tsconf: handle TS IPv4 / IPv6 input traffic"
|
iifname "tailscale0" counter jump input_tailscale comment "tsconf: handle TS IPv4 / IPv6 input traffic"
|
||||||
}
|
}
|
||||||
|
|
||||||
chain forward {
|
chain forward {
|
||||||
type filter hook forward priority filter; policy drop;
|
type filter hook forward priority filter; policy drop;
|
||||||
ct state established,related flow add @ft comment "defconf: track forwarded flows"
|
ct state established,related goto handle_offload comment "defconf: handle forwarded flows"
|
||||||
ct state vmap { established : accept, related : accept } comment "defconf: handle forwarded flows"
|
|
||||||
iifname "eth0" jump forward_lan comment "defconf: handle LAN IPv4 / IPv6 forward traffic"
|
iifname "eth0" jump forward_lan comment "defconf: handle LAN IPv4 / IPv6 forward traffic"
|
||||||
iifname "tailscale0" counter jump forward_tailscale comment "tsconf: handle TS IPv4 / IPv6 forward traffic"
|
iifname "tailscale0" counter jump forward_tailscale comment "tsconf: handle TS IPv4 / IPv6 forward traffic"
|
||||||
}
|
}
|
||||||
|
|
||||||
chain output {
|
chain output {
|
||||||
type filter hook output priority filter; policy accept;
|
type filter hook output priority filter; policy accept;
|
||||||
|
ct state established,related accept comment "defconf: handle outbound flows"
|
||||||
oif "lo" accept comment "defconf: accept traffic towards loopback"
|
oif "lo" accept comment "defconf: accept traffic towards loopback"
|
||||||
ct state vmap { established : accept, related : accept } comment "defconf: handle outbound flows"
|
|
||||||
oifname "eth0" jump output_lan comment "defconf: handle LAN IPv4 / IPv6 output traffic"
|
oifname "eth0" jump output_lan comment "defconf: handle LAN IPv4 / IPv6 output traffic"
|
||||||
oifname "tailscale0" counter jump output_tailscale comment "tsconf: handle TS IPv4 / IPv6 output traffic"
|
oifname "tailscale0" counter jump output_tailscale comment "tsconf: handle TS IPv4 / IPv6 output traffic"
|
||||||
}
|
}
|
||||||
@@ -54,18 +53,23 @@ table inet router {
|
|||||||
}
|
}
|
||||||
|
|
||||||
chain syn_flood {
|
chain syn_flood {
|
||||||
limit rate 200/second burst 100 packets return comment "defconf: accept SYN packets below rate-limit"
|
limit rate 200/second burst 100 packets return comment "defconf: accept new TCP connections below rate-limit"
|
||||||
counter drop comment "defconf: drop excess packets"
|
counter drop comment "defconf: drop excess new TCP connections"
|
||||||
|
}
|
||||||
|
|
||||||
|
chain handle_offload {
|
||||||
|
flow add @ft accept comment "defconf: track forwarded flows"
|
||||||
|
accept
|
||||||
}
|
}
|
||||||
|
|
||||||
chain input_lan {
|
chain input_lan {
|
||||||
ct status dnat counter accept comment "lanconf: accept port redirect"
|
ct status dnat accept comment "lanconf: accept port redirect"
|
||||||
jump accept_from_lan
|
jump accept_from_lan
|
||||||
}
|
}
|
||||||
|
|
||||||
chain forward_lan {
|
chain forward_lan {
|
||||||
jump accept_to_tailscale comment "tsconf: accept LAN to TS forward"
|
jump accept_to_tailscale comment "tsconf: accept LAN to TS forward"
|
||||||
ct status dnat counter accept comment "lanconf: accept port forward"
|
ct status dnat accept comment "lanconf: accept port forward"
|
||||||
jump accept_to_lan
|
jump accept_to_lan
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +81,7 @@ table inet router {
|
|||||||
}
|
}
|
||||||
|
|
||||||
chain accept_from_lan {
|
chain accept_from_lan {
|
||||||
iifname "eth0" counter accept comment "defconf: accept LAN IPv4 / IPv6 traffic"
|
iifname "eth0" accept comment "defconf: accept LAN IPv4 / IPv6 traffic"
|
||||||
}
|
}
|
||||||
|
|
||||||
chain accept_to_lan {
|
chain accept_to_lan {
|
||||||
|
|||||||