Total Pageviews

Friday, December 31, 2010

Setting up Bridge Networking on KVM Host

Guest (VM) networking in kvm

Guest (VM) networking in kvm is the same as in qemu,  Below will explain how to configure the most frequent types of network needed.

Why Public Bridge on Host?

If You want a simple way for your virtual machine to access to the host, to the internet or to resources available on your local network.

On Red Hat based distribution you can use the sysconfig script to set up the bridge networking .

Note: You need kvm up and running because we need a package called bridge-utils to set up a bridge , that will be installed  as dependency during the kvm installtion.

Your host system must be able to access the internet or the local network

In our example we are creating a bridge interface named kvmlan1 (you can use any name as per your environment) so go to

#cd /etc/sysconfig/network-scripts/

#vi ifcfg-kvmlan1

IPADDR=x.y.z.1   <<--- replace with the host IP

Save it .

Now select the Phsicial Interface to tie to the above bridge . In our case we used eth0

#vi ifcfg-eth0


Save it and Restart the Network Service

/etc/init.d/networking restart

And verify Your bridge is up

# brctl  show

bridge name    bridge id        STP enabled    interfaces
kvmlan1        8000.002170eae1cf    no        eth0
pan0        8000.000000000000    no       

 The bridge kvmlan1 should get the ip address static while the physical eth0 is left without ip address.  Now you can use this Bridge kvmlan1 , while creating a new virtual machine using virt tools like virt-manager .

No comments: