KVM Host Setup

From Newroco Tech Docs
Revision as of 07:52, 14 July 2017 by Emilian.mitocariu (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Basic install

If your machine was built with a package set to support virtualisation this step may not be necessary.

apt-get install kvm libvirt-bin bridge-utils vlan python-vm-builder

Networking

If need interface level vlan support do

 sudo modprobe 8021q

We use bridging for the network interfaces. There can be several interfaces: e.g. a "main" interface, one for a storage network and/or dedicated connection, one for guests on an SSN. Adapt IP addressing and interface definitions as necessary. Different setups will have very different requirements.

  • Edit /etc/network/interfaces as needed, bridging interfaces to suit:
 # Main interface
 auto br0
 iface br0 inet static
 address 10.0.0.162
 netmask 255.255.0.0
 gateway 10.0.0.153
 bridge_ports eth0   [CHECK what your particular interface is called - it may be eth0, but may be em1 for instance]
 bridge_fd 9
 bridge_hello 2
 bridge_maxage 12
 bridge_stp off


 # SAN
 auto br1
 iface br1 inet static
 address 192.168.20.49
 netmask 255.255.255.224
 bridge_ports eth1
 bridge_fd 9
 bridge_hello 2
 bridge_maxage 12
 bridge_stp off

 # SSN
 auto eth0.98
 iface eth0.98 inet manual

 auto extbr98
 iface extbr98 inet manual
 bridge_ports eth0.98
 bridge_fd 9
 bridge_hello 2
 bridge_maxage 12
 bridge_stp off


The interfaces should have the same name on all hosts, so that we can move VMs from one host to the other without having to change the configuration every time.

Modifying default virtual bridge

By default libvirt creates a virtual bridge named virbr0 (can be checked with ifconfig command). If you want to modify this interface for another subnet you can do this by first shutting down the interface:

virsh net-destroy default

Modify the interface

virsh net-edit default

And start it again

virsh net-start default

See also

KVM_performance