User Tools

Site Tools


Linux virtualization with kvm and libvirt

All the info below are somewhat Debian 6 centric (for both host and guest).


Enable serial console

To enable access to the guest via the serial emulation console:

For the getty console add in /etc/inittab:

T0:123:respawn:/sbin/getty -L ttyS0 9600 vt100

… and reload with telinit q

For the grub console append to /etc/default/grub:

### "Serial" console for libvirt
GRUB_SERIAL_COMMAND="serial --unit=0 --speed=9600 --word=8 --parity=no --stop=1"
GRUB_TERMINAL="console serial"
GRUB_CMDLINE_XEN="com1=9600,8n1 console=com1,vga"
GRUB_CMDLINE_LINUX="console=tty0 console=hvc0"

…and rebuild grub config with update-grub


Assign a static IP to a guest

Leave the guest configured to use DHCP (for better portability) and map in libvirt DHCP the guest MAC address to a static ip adding some <host> entries in the dhcp configuration.

To change the configuration (we are editing the default network in the sample below):

  • Stop network: virsh net-destroy default
  • Edit the network: virsh net-edit default
  <forward mode='nat'/>
  <bridge name='virbr0' stp='on' delay='0' />
  <ip address='' netmask=''>
      <range start='' end='' />
      <host mac='52:54:DE:AD:BE:EF' ip='' />
      <host mac='52:54:CA:FE:BA:BE' ip='' />
  • Restart the virtual network: virsh net-start default


You can use the graphical Virtual Machine Manager at

unix/kvm.txt · Last modified: 2016/11/28 10:51 by ap

Informativa sui cookie