Showing posts with label Virtualization. Show all posts
Showing posts with label Virtualization. Show all posts

Sunday, 4 March 2012

Rescan NICs in CentOS 6.2

Our virtualization environment runs on ESX 4 and Vcenter 4, which means that it is not possible to customize 64bit Linux distros or at least Red Hat distros, following cloning. This is annoying as CentOS does not seem to be able to pick up the new NICs in a clone, even after the ifcfg files have been edited to amend the new MAC addresses.

It turns out there is a very easy solution to this problem:

rm -f /etc/udev/rules.d/70-persistent-net.rules; init 6

This will delete the file containing NIC information and rescan after a reboot.

Do note that the second time I tried this, it created new NIC names, i.e. eth4,eth5 and eth6 for my multiple nic clone.

If you encounter this issue, you could edit the file /etc/udev/rules.d/70-persistent-net.rules or rename the ifcfg files, either should work.

Hopefully, we will move to ESXi 5 soon.

Thursday, 9 June 2011

Configure systems to launch virtual machines at boot

I guess this one is up there with this objective in the easiest objectives category.
virsh autostart domainname
where domainname is the name of the virtual machine.

So for the vm I just created in the previous post, the command would be
virsh autostart testvm
 which has the following result:
Domain testvm marked as autostarted

Install Red Hat Enterprise Linux systems as virtual guests

You can use virt-manager to do this task, see this link, and perhaps this is the way Red Hat intended this objective to be accomplished, but as a Linux system admin you should aim to do everything via the console, therefore let's get started with the command line.
Provided that you have just installed the virtualization packages, make sure that the libvirt daemon is running and
issue the following command:
virt-install --prompt
This should prompt you for every detail needed  to create a new virtual machine.
Alternatively, you could provide the details required, like this command:
virt-install -n test -r 1024 --vcpu=1 -l nfs:10.168.20.227:/distro --os-type='linux' --os-variant='rhel6' --network network:default --file=/var/lib/libvirt/images/test.img --file-size=6 -x console=ttyS0
This will allow you to install Red Hat with a terminal user interface and will allow you to access the console of this machine from a terminal as discussed on here.


and so on, same as a normal installer but through the terminal, how cool is that :)?
Until it finishes. To exit this console, just press CTRL + ]

Configure a physical machine to host virtual guests

This is one of the easiest objectives for this exam, just issue the following commands to install the necessary packages:
yum groupinstall "Virtualization"
yum groupinstall "Virtualization Client"
There are a further two package groups related to virtualization, Virtualization Tools and Virtualization Platform, I don't think they are really needed, as they install libguestfs, which is a library for accessing and modifying guest disk images and libvirt,which is a C toolkit to interact with the virtualization capabilities of recent versions of Linux (and other OSes).

Strictly speaking the Virtualization Client group is not needed. You will need it in a server to create virtual machines and manage them, but it does not need to be installed in every server.