Ask Your Question

libvirt does not show all interfaces

asked 2012-06-17 07:42:17 -0500

epsilon2 gravatar image

Hi I'm trying to use libvirt with python and when I use libvirt.listInterfaces() it only shows eth0 and lo but I have other interfaces such as virbr0, macvtap0 and wlan0. Here is my code

import libvirt

libConnect ='qemu:///system')
print libConnect.listInterfaces

How do I list all the interfaces in my system?

edit retag flag offensive close merge delete


Those are bridges/networks - not interfaces. Try listNetworks and/or listDevices

bit4man gravatar imagebit4man ( 2015-06-01 21:44:52 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2015-06-11 21:29:02 -0500

mhayden gravatar image

updated 2015-06-11 21:29:35 -0500

I get similar results as my normal user and as root (but I adjusted listInterfaces to be listInterfaces()):

[major@hydrogen ~]$ ./ 
['enp4s0', 'enp5s0', 'lo']
[major@hydrogen ~]$ sudo ./
[sudo] password for major: 
['enp4s0', 'enp5s0', 'lo']

From what I've read on various mailing list posts, libvirt will only show you network devices that it has created and manages. However, if you're using something like virt-manager or virt-install to create your VM's, you can manually specify the network device for the VM.

edit flag offensive delete link more

Question Tools



Asked: 2012-06-17 07:42:17 -0500

Seen: 238 times

Last updated: Jun 11 '15