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
DEVICE=kvmlan1
TYPE=Bridge
ONBOOT=yes
IPADDR=x.y.z.1 <<--- replace with the host IP
NETMASK=255.255.255.0
GATEWAY=YOUR GATEWAY
DELAY=0
STP=no
Save it .
Now select the Phsicial Interface to tie to the above bridge . In our case we used eth0
#vi ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
HWADDR=00:21:70:EA:E1:CF
BRIDGE=kvmlan1
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:
Post a Comment