[libvirt] Bridge network for VM using libvirt library

Shanmuga Rajan shan at binarykarma.com
Mon Oct 20 09:24:51 UTC 2008


Hi

              I trying to create an application to manage virtual
machines using libvirt library.
Currently i am focusing with KVM hypervisor and bridge networking.


I face two issues which i cant find a solution....

First issue:

When i tried to reboot a virtual machine (using virDomain's reboot fn).
I got exception message that there was no support in the hypervisor
for reboot. is it true that we cant reboot a KVM based VM?


Second issue:


When i tried to setup a bridge network for KVM based VM.

I got error message  like this ..

"QEMU quit during console startup
bind() failed"

I have listed below my steps which i tried setup bridge network.

On Dom0
===========

<<<<

brctl addbr br0
ifconfig eth0 0.0.0.0
brctl addif br0 eth0
ifconfig br0 192.168.1.82 netmask 255.255.255.0 up
route add -net 192.168.1.0 netmask 255.255.255.0 br0
route add default gw 192.168.1.1 br0

<<<<
** dom0 IP 192.168.1.82

after that i checked the network connection of the Dom0.. it was fine.
ifconfig  was fine.


then i created tun/tap device like given in the following link
http://wiki.centos.org/HowTos/KVM#head-c02a0b33e7949b0bc3b151ac6e0bdfb91b6bbd1c


<<<<<
sudo tunctl -b -u john
sudo ifconfig tap1 up
sudo brctl addif br0 tap1
export SDL_VIDEO_X11_DGAMOUSE=0
sudo iptables -I INPUT -i br0 -j ACCEPT
<<<<<

then i started to define vm like this...

<domain type="kvm">
<name>test82</name>
<uuid>e5520db4-ad8a-38c3-b9d9-4e3c7a1052dc</uuid>
<memory>131072</memory>
<vcpu>1</vcpu>
<on_poweroff>destroy</on_poweroff>
<os><type arch="i686">hvm</type>
<boot dev="hd"/>
</os>
<clock sync="localtime"/>
<features>
<pae/>
<acpi/>
<apic/>
</features>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type="file" device="disk">
<source file="/dev/FluidVM_grp/Windows_NT_2003_121560222596"/>
<target dev="hda"/>
</disk>


<interface type="bridge">
<source bridge="br0"/>
</interface>

<interface type="bridge">
<source bridge="br0"/>
<target dev="tap1"/>
<mac address="00:16:3e:8f:ca:4b" />
</interface>


<graphics type="vnc" port="5900" listen="0.0.0.0"/>
</devices>
</domain>



is anything i am missing in setting up the bridge network?


Thanks and Regards,
-- Shan




More information about the libvir-list mailing list