Question about KVM internal network stack

voidindigo

Active Member
Sep 18, 2018
19
2
43
56
This might be a little deep, but I'm curious about how the network stack actually works between KVM VMs and the host layer.

I believe I read once (and I can't find it now) that the VM kernel is aware that it's virtualized, and the host has interface(s) available for the guests to connect to specifically for networking. Basically, a kernel device driver interface for the network layer that knows how to talk directly to an equivalent interface on the host.

So, if you create a virtual bridge between VMs, the data flow is effectively `VM guest app` -> `VM kernel network layer` directly to -> `HOST kernel network layer` rather than going through the VM kernel network stack (building ethernet frames, sending what it believes are packets, etc).

Is that correct?
 
Last edited:
We use tap devices [1] as virtual network devices - it basically hands a file descriptor to QEMU where it can write/read raw ethernet frames. The packet goes through the whole guest network stack - it has to - since otherwise you couldn't use basic functionality like IP routing or firewalling. When the packet pops out of the guest and it is part of a bridge, then it additionally traverses the host network stack.

[1] https://en.wikipedia.org/wiki/TUN/TAP
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!