需求配置: PVE的主机ip管理网段为192.168.199.0/24,vlan标签199 虚拟机ip网段为192.168.193.0/24,vlan标签193
首先交换机上配置trunk口 interface GigabitEthernet1/0/6 port link-mode bridge description test port link-type trunk undo port trunk permit vlan 1 port trunk permit vlan 2 to 252 255 to 4094
根据官方文档,配置PVE网卡接口:
nano /etc/network/interfaces
auto lo iface lo inet loopback
iface enp2s0 inet manual
auto vmbr0.199 ##默认网桥vmbr0,".199"代表主机的vlan标签为199 iface vmbr0.199 inet static ###PVE管理地址 address 192.168.199.55 netmask 255.255.255.0 gateway 192.168.199.254
auto vmbr0 iface vmbr0 inet manual bridge_ports enp2s0 ###桥接enp2s0这个网口 bridge_stp off bridge_fd 0 bridge_vlan_aware yes ###开启vlan感知