前言
这篇博客持续更新,用于记录Virtualizor和Hetzner的各种配置和技巧
IPv4NAT+vSwitch内网跨物理机互通+IPv6配置
为了实现vSwitch下所有母鸡里面的小鸡互通,同时也支持NAT和IPv6。搞了半天时间,终于弄好了Hetzner的IPv6小鸡的设置,这里记录一下防止忘记。
母鸡网络基本构架
母鸡Proxmox-Slave
- eno1:物理网卡——空
- eno1.4000:物理网卡原生vLAN——空
- vmbr0:物理网卡桥接——公网IPv4+公网IPv6
- vmbr1:物理vLAN网卡桥接——内网IPV4+公网IPv6(无gateway)
母鸡额外网络配置
一定要加上这样一行开机运行(或者在网卡配置中写up和down),让所有的IPv6流量走vmbr1,才能将IPv6流量转发出去!!
ip -6 route add 2a01:4f8:b16:1051::/64 dev vmbr1
然后设置sysctl规则:nano /etc/sysctl.conf加上下面的内容:
root@PVE-EU-2 ~ # sysctl -p net.ipv4.ip_forward = 1 net.ipv6.conf.all.accept_dad = 1 net.ipv6.conf.all.accept_ra = 0 net.ipv6.conf.all.accept_redirects = 1 net.ipv6.conf.all.accept_source_route = 0 net.ipv6.conf.all.autoconf = 0 net.ipv6.conf.all.disable_ipv6 = 0 net.ipv6.conf.all.forwarding = 1
另外还要看看IPv6的路由表,将2a01:4f8:b16:1051::/64从vmbr0网桥中去掉:ip -6 route del 2a01:4f8:b16:1051::/64 dev vmbr0
root@PVE-EU-2 ~ # ip -6 route ::1 dev lo proto kernel metric 256 pref medium 2a01:4f8:b16:1051::/64 dev vmbr1 proto kernel metric 256 pref medium 2a01:4f8:b16:1051::/64 dev vmbr2 proto kernel metric 256 pref medium 2a01:4f8:b16:1051::/64 dev vmbr1 metric 1024 pref medium fe80::/64 dev vmbr0 proto kernel metric 256 pref medium fe80::/64 dev vmbr1 proto kernel metric 256 pref medium fe80::/64 dev vmbr2 proto kernel metric 256 pref medium default via fe80::1 dev vmbr0 metric 1024 onlink pref medium
还有如果需要,还需要额外设置inet6
ip -f inet6 neigh add proxy 2a01:4f8:xxx:xxx::vmbr0IP dev vmbr0 ip -f inet6 neigh add proxy 2a01:4f8:xxx:xxx::小鸡ip dev enp3s0 ip -f inet6 route add 2a01:4f8:xxx:xxx::小鸡ip dev vmbr0
Proxmox额外配置
注意,Virtualizor控制Proxmox部署小鸡失败可能是缺了lib,我装了HZ最新的PVE,缺了libguestfs-tools libfuse-dev zfs-utils,所以:
apt-get install libguestfs-tools libfuse-dev -y
顺便说一下,如果是Hetzner的imageinstall安装的Proxmox,还需要装zfs工具:
# vi /etc/apt/sources.list.d/buster-backports.list deb http://deb.debian.org/debian buster-backports main contrib deb-src http://deb.debian.org/debian buster-backports main contrib # vi /etc/apt/preferences.d/90_zfs Package: libnvpair1linux libuutil1linux libzfs2linux libzpool2linux spl-dkms zfs-dkms zfs-test zfsutils-linux zfsutils-linux-dev zfs-zed Pin: release n=buster-backports Pin-Priority: 990 apt-get install zfsutils-linux -y
其他设置查看这里吧:https://www.liujason.com/article/474.html
Slave端Virtualizor的配置文件
安装Virtualizor,不多说了,代码贴着备用:
wget -N http://files.virtualizor.com/install.sh chmod 0755 install.sh ./install.sh email=填virtualizor注册邮箱 kernel=proxmox
配置文件:/usr/local/virtualizor/universal.php
修改里面的bridge,设置成vmbr1
Master端Virtualizor的配置
Slave设置好之后,新建ip池两个,一个内网IPv4一个公网IPv6
内网IPv4要勾选Enable VLAN