Issue with 802.1q VLAN on guests with vmnet

My environment is a router with OpenWRT, a laptop connected to the router via patch cable and an untagged VLAN with VID 5 configured on that port in the router, and a MacBook M1 Pro connected via Wi-Fi to the router.

On the macbook, I created a VLAN interface by specifying en0 (AirPort) as the parent interface, then created a VM using QEMU with hvf accelerator or lima/UTM with VZ and I observe a strange situation: using arping, packets from the laptop sometimes reach the VM connected to the VLAN interface on the macbook, but arping running on the VM only sends requests but does not receive replies from the laptop. If I assign an IP address to the VLAN interface in macOS, packets are transmitted over either protocol without any problems. The problem is delivering packets to the virtual machine.

With tcpdump on the laptop I can see that it reply to arp requests, I can also see on the router that replies to arp requests passed through the Wi-Fi interface, but I don't see them in tcpdump on en0 on the macbook, which is also strange. But as I wrote before, if I assign an address from the same network on the macbook's VLAN interface, any packets are delivered between the laptop and macbook.

Laptop: 192.168.24.50

MacBook: 192.168.24.20 (vlan5 interface).

VM: 192.168.24.10

With lima-vm I use socket_vmnet in bridge mode. With QEMU I use vmnet-bridged.

➜  ~ ifconfig vlan5
vlan5: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1496
	options=6063<RXCSUM,TXCSUM,TSO4,TSO6,PARTIAL_CSUM,ZEROINVERT_CSUM>
	ether f0:2f:4b:xx:xx:xx
	inet 192.168.24.20 netmask 0xffffff00 broadcast 192.168.24.255
	vlan: 5 parent interface: en0
	media: autoselect
	status: active

➜  ~ ping 192.168.24.50 -c2
PING 192.168.24.50 (192.168.24.50): 56 data bytes
64 bytes from 192.168.24.50: icmp_seq=0 ttl=64 time=5.241 ms
64 bytes from 192.168.24.50: icmp_seq=1 ttl=64 time=5.429 ms

--- 192.168.24.50 ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 5.241/5.335/5.429/0.094 ms

➜  ~ sudo arping -c 5 -i vlan5 192.168.24.50
ARPING 192.168.24.50
60 bytes from 10:e7:c6:xx:xx:xx (192.168.24.50): index=0 time=6.061 msec
60 bytes from 10:e7:c6:xx:xx:xx (192.168.24.50): index=1 time=6.084 msec
60 bytes from 10:e7:c6:xx:xx:xx (192.168.24.50): index=2 time=5.945 msec
60 bytes from 10:e7:c6:xx:xx:xx (192.168.24.50): index=3 time=3.092 msec
60 bytes from 10:e7:c6:xx:xx:xx (192.168.24.50): index=4 time=3.848 msec

--- 192.168.24.50 statistics ---
5 packets transmitted, 5 packets received,   0% unanswered (0 extra)
rtt min/avg/max/std-dev = 3.092/5.006/6.084/1.278 ms

➜  ~ ifconfig bridge100
bridge100: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1496
	options=3<RXCSUM,TXCSUM>
	ether f2:2f:4b:xx:xx:xx
	Configuration:
		id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
		maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
		root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
		ipfilter disabled flags 0x0
	member: vlan5 flags=3<LEARNING,DISCOVER>
	        ifmaxaddr 0 port 22 priority 0 path cost 0
	member: vmenet0 flags=3<LEARNING,DISCOVER>
	        ifmaxaddr 0 port 23 priority 0 path cost 0
	Address cache:
		10:e7:c6:xx:xx:xx Vlan1 vlan5 326 flags=0<>
		52:55:55:ae:36:b4 Vlan1 vmenet0 1172 flags=0<>
	nd6 options=201<PERFORMNUD,DAD>
	media: autoselect
	status: active
[root@VM1 ~]# arping 192.168.24.50 -c5
ARPING 192.168.24.50 from 192.168.24.10 lima0
Sent 5 probes (5 broadcast(s))
Received 0 response(s)
[root@VM1 ~]#
[root@laptop ~]# arping 192.168.24.10 -c5
ARPING 192.168.24.15 from 192.168.24.10 lima0
Unicast reply from 192.168.24.10 [52:55:55:AE:36:B4]  2.492ms
Unicast reply from 192.168.24.10 [52:55:55:AE:36:B4]  1.791ms
Unicast reply from 192.168.24.10 [52:55:55:AE:36:B4]  3.059ms
Sent 5 probes (1 broadcast(s))
Received 3 response(s)
[root@laptop ~]#

What could be the reason for this behavior?

  • The last listing is not quite correct.

    The correct one would be this:

    [root@laptop ~]# arping 192.168.24.10 -c5 ARPING 192.168.24.10 from 192.168.24.50 eth0 Unicast reply from 192.168.24.10 [52:55:55:AE:36:B4] 2.492ms Unicast reply from 192.168.24.10 [52:55:55:AE:36:B4] 1.791ms Unicast reply from 192.168.24.10 [52:55:55:AE:36:B4] 3.059ms Sent 5 probes (1 broadcast(s)) Received 3 response(s) [root@laptop ~]#

Add a Comment

Replies

Unfortunately, VLAN aren't supported with Wi-Fi interfaces.

The kernel allows some configuration for debugging but the interface isn't functional for the bridging done here.

  • Even if I create a bridge between the Wi-Fi interface and the VM interface without VLAN and add a VLAN label already inside the VM?

    This moment is not completely transparent. VLAN is just 4 bytes in the frame header. And as I wrote before, if you add an IP address to the VLAN interface, everything works fine. Is the issue in the bridge or in vmnet?

Add a Comment