Tuesday, July 20, 2010

Setting up a network bridge to enable NIC sharing between VM's in KVM

1. Configure a bridge device

Here we will setup a br1 device and have it connected to eth1 device.

a. Set up eth1

[root@nebskcc001 local]# cd /etc/sysconfig/network-scripts/
[root@nebskcc001 local]# vi ifcfg-eth1

DEVICE=eth1
BOOTPROTO=static
HWADDR=F4:CE:46:87:D1:B6 # YOUR MAC ADDRESS MAY VARY
ONBOOT=yes
TYPE=Ethernet
IPV6INIT=no
BRIDGE=br1 # Bridge name to be connected to.


b. Set up br1

[root@nebskcc001 local]# vi ifcfg-br1

DEVICE=br1
TYPE=Bridge
BOOTPROTO=static
ONBOOT=yes



c. Restart the network service

[root@nebskcc001 local]# service network restart



2. Modify KVM configuration file.

a. change kvm configuration file.



Here we add the bridge device and have it used by the VM.
[root@nebskcc008 imgs]# cd /etc/libvirt/qemu
[root@nebskcc008 qemu]# vim bpm.xml



b. start vm.

No comments: