Ask Your Question

libvirt does not show all interfaces

asked 2012-06-17 12:42:17 +0000

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 = libvirt.open('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 ( 2015-06-02 02:44:52 +0000 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-06-12 02:29:02 +0000

mhayden gravatar image

updated 2015-06-12 02:29:35 +0000

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

[major@hydrogen ~]$ ./libvirt-messaround.py 
['enp4s0', 'enp5s0', 'lo']
[major@hydrogen ~]$ sudo ./libvirt-messaround.py
[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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Use your votes!

  • Use the 30 daily voting points that you get!
  • Up-vote well framed questions that provide enough information to enable people provide answers.
  • Thank your helpers by up-voting their comments and answers. If a question you asked has been answered, accept the best answer by clicking on the checkbox on the left side of the answer.
  • Down-voting might cost you karma, but you should consider doing so for incorrect or clearly detrimental questions and answers.

Question Tools



Asked: 2012-06-17 12:42:17 +0000

Seen: 166 times

Last updated: Jun 12 '15