KVM-Host 2 KVM-Guest: Internes Traffic Management

  • Hallo Netcupler :)


    Da die leider sehr allgemein gehaltenen kvm faq's sowie die kaum vorhandene, technische Dokumentation mir meine Fragen nicht beantworten konnte und nach dem selbst auf der kvm maillingliste keiner geantwortet hat (keine Lust, keine Zeit) stelle ich die Frage jetzt einfach mal hier. Hier gibt es ja vielleicht den einen oder anderen QEMU, KVM Experten der da mehr weiß (you never know).


    Das Szenario:
    1)Ein Datenpaket erreicht via Router das KVM-Hostsystem.
    2)Auf dem KVM-Host laufen parallel, mehrere KVM-Gastinstanzen für verschiedene Kunden.
    3)Der Host leitet das Paket an die zuständige KVM-Gastinstanz weiter (z.B Gast e1000 Intel NIC Schnittstelle).
    4)Das KVM-Gast OS beschliesst gemäss Firewallregel das Paket zu droppen.


    Frage:
    *Wo wird dieses Paket nun tatsächlich (physikalisch) verworfen? Am Host oder Gast?
    *Wie lange bleibt der allokierte (malloc) Speicher im Host/Gast-System noch reserviert`und wann erfolgt (free)?
    *Ist das gar kein KVM sondern eher eine QEMU Frage?

  • Nun hat die Fragestellung auf der KVM Mailingliste doch noch zu einem Ergebnis geführt, dass ich den anderen interessierten nicht vor enthalten möchte:


    Antwort von: Stefan Hajnoczi - Redhat KVM Entwicklerteam
    The flow is:
    1. Packet is received on physical eth0
    2. Packet is given to software bridge and the destination MAC address is used to determine the bridge port for forwarding.
    3. Packet is forwarded to the tap device on the host that is associated with the guest.
    4. vhost_net reads the packet from the tap device into guest memory and then signals the guest.
    5. Guest notices the received packet and its virtio_net driver hands the packet to the guest network stack.


    All of these components can be swapped out: software bridge vs OpenVSwitch, software bridge vs macvtap, vhost_net vs NIC emulation in QEMU, bridging vs NAT, etc. If you are just learning about this, focus on the one configuration you care about and ignore all others for now. You can use firewall rules on the host on any of the 3 network interfaces (physical eth0, software bridge interface, or tap). If the packets are dropped by the host then the guest will not see them. If the guest relies on its own firewall then packets are transferred into the guest. Once they are inside the guest the host no longer cares about them and they are in guest memory. Whether or not the guest decides to drop them makes no difference to the host.

  • Ich möchte trotz Ergebnis noch etwas klar stellen, QickEmulator ist nur eine reine Software die, die gesamte System Hardware emuliert damit hast du vor "KVM" quasi "Virtualisiert". Mit KVM hingegen benutzt du noch Intel VT-x/VT-d oder AMD-v Zusatz deines Prozessor der das ganze enorm beschleunigt und andere Features.. Kannst du alles in den Wiki-Artikeln nachlesen, sprich es ist etwas komplizierter das alles zu erklären... :)


    QuickEmulator: QEMU – Wikipedia
    Kernel-basedVirtualMachine: Kernel-based Virtual Machine – Wikipedia