Discover what vnet is attached to a kvm guest

Serge Hallyn serge.hallyn at canonical.com
Fri May 13 12:57:59 UTC 2011


Quoting carlopmart (carlopmart at gmail.com):
> Hi all,
> 
>  How can I see what vnet is attached to a certain kvm guest?? For
> example: I have a kvmguest1. When I launch this guest with virsh
> command, virsh creates a new vnetX interface for this guest. How can
> I extract this virtual net interface (vnet0, vnet1, vnet2 or so on)
> using a script??

# virsh list
Id Name                 State
----------------------------------
1 debian               running

# virsh dumpxml 1 

...
<interface type='network'>
<mac address='52:54:00:0f:9e:17'/>
<source network='default'/>
<target dev='vnet0'/>
<alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
...

-serge




More information about the ubuntu-server mailing list