Documenting the adventure of installing KVM virtual guests on two physical hosts, running RHEL6.
Installation of Virtualization Packages
Subscribe to RHEL Server 6 x86_64 channel via the RedHat subscriptions management page. This requires an add-on subscription. There’s a command-line way to do this as well, either “rhn-register” or “subscription-manager.”
Install the virtualization tools and X Window tools for Virt-Manager:
yum groupinstall "Virtualization" ; yum groupinstall "X Window System"
Configuration of Bridged Networking
Edit /etc/sysconfig/network-scripts/ifcfg-eth1:
Add BRIDGE, and disable NetworkManager for this device. Remove all specific IP information, since it will go in another file.
service NetworkManager stop ; chkconfig NetworkManager off
/etc/sysconfig/network-scripts/ifcfg-eth1:
DEVICE=eth1
ONBOOT=yes
TYPE=Ethernet
NM_CONTROLLED=no
IPV6_INIT=no
BRIDGE=br0
HWADDR=XX:XX:XX:XX:XX
Create the bridge script /etc/sysconfig/network-scripts/ifcfg-br0:
DEVICE=br0
TYPE=Bridge
BOOTPROTO=static
ONBOOT=yes
NM_CONTROLLED=no
IPADDR=192.168.1.5
NETMASK=255.255.255.0
NETWORK=192.168.1.0
DELAY=0
service network restart ; service libvirtd reload brctl show
If firewall is running, enable bridging:
iptables -I FORWARD -m physdev --physdev-is-bridged -j ACCEPT
service iptables save
service iptables restart
service libvirt reload
openssl rand -hex
6
| sed
's/\(..\)/\1:/g; s/.$//'
virt-install --name=testvm1 --hvm --conect qemu:///system --network=bridge:br0 --disk path=/storage/testvm1.img,size=40 \ --graphics vnc,keymap=en-us --vcpus=2 --ram=8192 --os-type=linux --os-variant=rhel6 --mac=XX:XX:XX:XX:XX:XX \ --extra-args="ks=http://192.168.1.10/kickstart/testvm1.cfg" --location=http://192.168.1.10/rhel-6.1-x86_64/
To connect to the console via command line and watch the boot process:
virsh console testvm1
To view a graphical console for the newly created virtual machine, you may use virt-manager’s console.
virt-manager allows creation of virtual machines, and it will create a random MAC address during the VM install process. You will need to add the random MAC address into your DHCP configuration in order to grab the OS install source.
Happy virtualizing.