Dear list,
I am trying to create an access port on a VM to connect to VLAN (20 in my case). I am
pretty sure my router and switch are setup correctly. I can assign my host machine
(hypervisor) an IP address on either VLAN1 or VLAN20 by changing the configuration; in
other words, it is connected to the switch via a trunk port.
The host machine runs on Debian 12, has ifupdown2 installed, 8021q module is loaded at
boot and its /etc/network/interfaces file reads as follows:
auto lo
iface lo inet loopback
# bond interface
auto bond0
iface bond0 inet manual
bond-slaves enp5s0 enp6s0
bond-mode 802.3ad
bond-xmit-hash-policy layer2+3
bond-miimon 100
bond-lacp-rate 1
bond-vlan-aware yes
bond-vids 2-500
# vlan 1
auto bridge0.1
iface bridge0.1 inet static
address 192.168.1.130/24
gateway 192.168.1.1
# bridge interface
auto bridge0
iface bridge0 inet manual
bridge-ports bond0
bridge_stp on
bridge_fd 2
bridge_maxwait 0
bridge-vlan-aware yes
bridge-vids 2-500
source-directory /etc/network/interfaces.d
EOF
The host gets an IP address of 192.168.1.130 from VLAN1, as intended, by these settings.
VM1 (also Debian 12) is connected to bridge0, which is designed as a trunk bridge, and CAN
get an IP address in the 192.168.1.0/24 network (aka VLAN1), but CANNOT get an IP address
in the 192.168.20.0/24 network 9aka VLAN20). VMs network interface is named as enp1s0 and
I tried creating an interface named enp1s0.20 in its own /etc/network/interfaces file
without any change in behavior. It just does not connect to VLAN20, no matter what I
tried. What am I missing? I am very thankful for the pointers, and will be happy to
provide further information, try recommended settings and report back.
Best!
Show replies by date
Dear list admin:
I am sorry for inadvertently creating a new thread. Please feel free to delete that one. I
pasted its content to this thread, but couldn't delete that myself.
Thanks!
I was able to achieve what I wanted to do by the /etc/network/interfaces file posted below
on the host. KVM/QEMU does not accept the bridge notation with dots in it, such as
bridge0.20. Instead, one needs to create a separate vlan definition and a bridge on top of
that vlan. This would create an access port for the VMs that use that bridge. What I was
trying to do was to create a trunk port on a bridge, and by the static IP chosen for VMs,
let each VM claim their VLANs. In this working
version, the access ports claim the VLAN that the VM would belong to instead. I hope that
this would help people avoid the suffering Iendured during the last week to achieve this,
lol!
[code]
auto lo
iface lo inet loopback
# bond interface
auto bond0
iface bond0 inet manual
bond-slaves enp5s0 enp6s0
bond-mode 802.3ad
bond-xmit-hash-policy layer2+3
bond-miimon 100
bond-lacp-rate 1
# vlan 20
auto vlan20
iface vlan20 inet manual
vlan-id 20
vlan-raw-device bridge0
auto bridge20
iface bridge20 inet manual
bridge-ports vlan20
# bridge interface
auto bridge0
iface bridge0 inet manual
bridge-ports bond0
bridge_stp on
bridge_fd 2
bridge_maxwait 0
bridge-vlan-aware yes
bridge-vids 1-500
auto bridge0.1
iface bridge0.1 inet static
address 192.168.1.130/24
gateway 192.168.1.1
[/code]