人嘛 总有些奇奇怪怪的需求
准备工作
先确认主地址并设置 host
假设ip为 192.168.2.1
主机名为 pve
那 host 内容大概为
1 2 3 4 5
| 127.0.0.1 localhost.localdomain localhost 192.168.2.1 pve ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters
|
可输入 hostname --ip-address 验证
更新软件源
trixie
清空 /etc/apt/sources.list 文件
新建以下源
/etc/apt/sources.list.d/debian.sources
1 2 3 4 5 6 7 8 9 10 11
| Types: deb URIs: http://deb.debian.org/debian/ Suites: trixie trixie-updates Components: main contrib non-free-firmware Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
Types: deb URIs: http://security.debian.org/debian-security/ Suites: trixie-security Components: main contrib non-free-firmware Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
|
/etc/apt/sources.list.d/proxmox.sources
1 2 3 4 5
| Types: deb URIs: http://download.proxmox.com/debian/pve Suites: trixie Components: pve-no-subscription Signed-By: /usr/share/keyrings/proxmox-release-trixie.gpg
|
下载pve的仓库密钥
1
| wget https://enterprise.proxmox.com/debian/proxmox-release-trixie.gpg -O /usr/share/keyrings/proxmox-release-trixie.gpg
|
开始转换
1 2
| apt update && apt full-upgrade apt install proxmox-default-kernel
|
重启
1
| apt install proxmox-ve postfix open-iscsi chrony
|
再移除 旧内核
1
| apt purge linux-image-amd64 'linux-image-6.1*'
|
后续配置
ipv4 网络启用 nat 模式
重要的在于 iptables
/etc/sysctl.conf
/etc/network/interfaces
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| auto lo iface lo inet loopback
auto enp1s0f0 iface enp1s0f0 inet static address 192.168.1.2/32 gateway 192.168.1.1 dns-nameservers 1.1.1.1 dns-nameservers 8.8.8.8
iface enp1s0f1 inet manual
auto nat iface nat inet static address 192.168.2.1/24 bridge-ports none bridge-stp off bridge-fd 0 post-up iptables -t nat -A POSTROUTING -s '192.168.2.1/24' -o enp1s0f0 -j MASQUERADE post-down iptables -t nat -D POSTROUTING -s '192.168.2.1/24' -o enp1s0f0 -j MASQUERADE
|
虚拟机配 192.168.2.1/24
ipv6 启用 ULA 模式
1 2
| iface nat inet6 static address fd10::1/64
|
虚拟机配 fd10::1/64 不填网关
ipv6 启用 手动 模式
/etc/sysctl.conf
1 2 3 4
| net.ipv6.conf.all.forwarding=1 net.ipv6.conf.all.proxy_ndp=1 net.ipv6.conf.nat.forwarding=1 net.ipv6.conf.nat.proxy_ndp=1
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| auto eth0 iface eth0 inet manual
auto eth0 iface eth0 inet6 static address 2xxx:xxxx:xxxx:xxxx::2/64 # 网关为服务商提供 gateway fe80::1 dns-nameserver 2606:4700:4700::1111 dns-nameserver 2001:4860:4860::8888 post-up ip -6 route del 2xxx:xxxx:xxxx:xxxx::/64 dev eth0 # 网关为 ::1 必写 post-up ip -6 route add 2xxx:xxxx:xxxx:xxxx::1 dev eth0
auto nat iface nat inet6 static address 2xxx:xxxx:xxxx:xxxx::3/128 bridge-ports none bridge-stp off bridge-fd 0 dns-nameserver 2606:4700:4700::1111 dns-nameserver 2001:4860:4860::8888 post-up ip -6 route add 2xxx:xxxx:xxxx:xxxx::::/64 dev nat # 此处不清楚为何重启pve后 ipv6 的转发会失效 post-up sysctl -p
|
虚拟机配 2xxx:xxxx:xxxx:xxxx::/64 网关填 2xxx:xxxx:xxxx:xxxx::3
网络不通时 可以在 pve 上通过 tcpdump -i nat -n icmp6 抓包
如果服务商给的网关为 ::1 必须要配置 ndppd
/etc/ndppd.conf
1 2 3 4 5
| proxy eth0 { rule 2xxx:xxxx:xxxx:xxxx::/64 { static } }
|
ipv6 启用 dhcp 模式
其他
如果开始的 host 设置失败 将会导致 pve 的 web 无法访问
1 2
| systemctl restart pve-cluster pvecm updatecerts --force
|
如果系统用到了 netplan 则需要先卸载
1 2
| apt purge netplan.io apt install ifupdown
|
使用 systemctl restart systemd-networkd 或 systemctl restart networking
备份与迁移
在页面上备份后 直接将 /var/lib/vz/dump/ 目录打包带走就行
修改主机名
修改 /etc/hosts
修改 /etc/hostname
修改 /etc/postfix/main.cf
重启
然后再将 /etc/pve/nodes/ 里面的 lxc 与 qemu-server 移动到新目录中
再注意 ~/.ssh/authorized_keys 这个文件
参考地址