(91) 350-9520 support@omarine.org M-F: 7 AM - 7 PM; Weekends: 9 AM - 5 PM

Creating manageable virtual machines: Implementing

V/ IMPLEMENTING

1. Hardware requirements

Virtualization Technology (VT) support in processor is required. You can check to see if your processor supports VT by running this command:

egrep '^flags.*(vmx|svm)' /proc/cpuinfo

If you get any output then you have VT technology. In addition, you need to go into the BIOS and make sure it is enabled.

2. Software requirements

The software for creating virtual machines is QEMU already available in Omarine, and Omarine has been designed to fully support virtual machine system. The steps in this series are to set up a virtual machine system using bridge. To enforce, a configuration file needs to be added:

sudo mkdir -p /etc/qemu &&
echo allow br0 | sudo tee /etc/qemu/bridge.conf

Also, the user creating VM must belong to the kvm group, for example user emin:

sudo usermod -a -G kvm emin

3. Creating a virtual machine using dynamic IP address

Creating a virtual machine using static or dynamic IP address is only different in that we pass the MAC address parameter. If the MAC address is set in the DHCP server as a fixed IP address, we have a virtual machine with a static IP address. Otherwise, the virtual machine uses a dynamic IP address:

qemu -enable-kvm                                     \
     -m 1G                                           \
     -smp 2                                          \
     -cpu host                                       \
     -net nic,model=virtio,macaddr=12:34:56:78:9a:01 \
     -net bridge                                     \
     -soundhw ac97                                   \
     -vga virtio                                     \
     -serial mon:stdio                               \
     -drive file=disk.raw,format=raw                 \
     -name guest-1

Meaning of the command line options:

-enable-kvm: Enable KVM full virtualization support.

-m 1G: Sets guest startup RAM size to 1G.

-smp 2: Simulate an SMP system with 2 CPUs.

-cpu host: Select CPU model of KVM processor with all supported host features.

-net nic,model=virtio,macaddr=12:34:56:78:9a:01: Create a new Network Interface Card with model of virtio, the MAC address set to 12:34:56:78:9a:01.

-net bridge: Connect a TAP device to bridge br0.

-soundhw ac97: Enable audio and select soundcard model of ac97.

-vga virtio: Select Virtio VGA card.

-serial mon:stdio: Redirect the virtual serial port with the monitor is multiplexed, to the standard input/output.

-drive file=disk.raw,format=raw: Define a new drive used for the raw disk image “disk.raw”.

-name guest-1: Sets the name of the guest. This name will be displayed in the guest window caption.

4. Creating a virtual machine using static IP address

You run qemu similarly above, just replace 12:34:56:78:9a:01 with 12:34:56:78:9a:02 or 12:34:56:78:9a:03, replace guest-1 with guest-2 / guest-3 respectively. Before that, the disk image need to be unset the hostname. You can do this right on the previous virtual machine, because the disk image is persistent. Watch the video below



5. Secure remote login to / from the virtual machine using ssh

Remote login to / from the virtual machine using ssh is just like normal

Advertisements

Gửi phản hồi

Website này sử dụng Akismet để hạn chế spam. Tìm hiểu bình luận của bạn được duyệt như thế nào.

%d bloggers like this: