登录PVE主机,使用nano /etc/network/interfaces 命令编辑网卡信息:
一、添加物理接口子接口:
auto eno3.200
iface eno3.200 inet manual
auto eno3.100
iface eno3.100 inet manual
auto vmbr0
iface vmbr0 inet static
address 11.161.172.19/26
bridge-ports eno2
bridge-stp off
bridge-fd 0
二、创建桥接网口
auto vmbr1
iface vmbr1 inet manual
bridge-ports eno3 #eno3 为五里网卡
bridge-stp off
bridge-fd 0
三、创建子桥接网卡,子桥接网卡绑定五里子接口并配置对应vlan IP地址
auto vmbr1.200
iface vmbr1.200 inet static
address 172.16.1.27/24
gateway 172.16.1.1
bridge_ports eno3.200
bridge_stp off
auto vmbr1.100
iface vmbr1.100 inet static
address 192.168.1.20/24
gateway 192.168.1.2
bridge_ports eno3.100
bridge_stp off
四、在虚拟机硬件网络设备 桥接vmbr1 vlan 标签打对应VLAN
创建两台虚拟机,分别配置对应VLA你的IP,然后桥接对应的VLAN
五、将交换机对应网卡配置为TRUNK,允许对应VLAN通过或者允许所有VLAN通过