How do I use a static network device name for KVM (to graph in Cacti for example)?

To force a static (pre-defined name for a KVM Virtual Machine you will need to edit the configuration file for the VM (replace VM_NAME with the name of the domain).

vi /etc/libvirt/qemu/VM_NAME.xml

Find the section of the file starting with "<interface type='bridge'>" and then add the following (replacing DEV_NAME with the name of the network device to use on the host).

<target dev='DEV_NAME'/>

You will then need to bring in the new change and stop/start the VM for the changes to take effect.

virsh define VM_NAME.xml
virsh shutdown VM_NAME
virsh start VM_NAME

You should now be able to see the new network device name on the host by using "ifconfig". This new device can now be picked by you Cacti for example and used to graph the VM using a static network device name.

You cannot comment on this entry