Ubuntu – How to configure networking for KVM

kvmnetworkingservervirtualization

Ok, my situation is as follows. I have:

-host (Ubuntu server 14.04) on which I want to have multiple VMs (KVM). This host has 2 NICs (eth0, eth1)

-home router (dhcp, network 192.168.1.0)

-PC with virt-manager

I am stuck with network settings. What I want to have is, that each VM gets its own IP from router/DHCP and is also visible in home network (as normal physical computer). Lets say I "assign" eth0 for host and eth1 should be used by VMs.

Can someone who has experience please help me accomplish this, I am browsing web for 2 days and my head will explode of all this expressions and options…ip alias, bridge, virtual network switch, mac-vlan, macvtap, virtio, e1000. On ESXi you have vSwitch and thats it…

Update
I found a solution. Expression "bridge" for what it does is/was a little misleading for me. I would call it switch, because it can join multiple networks together not just two (that does bridge). So I created a bridge (br0) with virt-manager (but can also be done with brctl command) and added eth0 to it. Qemu-kvm than automaticaly adds vnet adapters for each VM if its connected to bridge.

Best Answer

You can set up a bridge to be automatically created on system startup by replacing the eth0 config in /etc/network/interfaces with this:

auto br0
iface br0 inet dhcp
    bridge_ports eth0
    bridge_fd 0
    bridge_stp off
    bridge_maxwait 5

Then you can set up your virtual machine to use the br0 bridge.

Related Question