If you managed to get through my previous post, then you should have your virtual environment up and running. Please make sure you got all the ISOs mentioned at the end of my previous post, since we’re going to deploy a VM that will be our first R77.30 instance!
Now, before we start it’s worth to see what kind of network our VM will be connected to.
LibVirt gives us few options when it comes to creating new networks:
- Isolated – Only Internal communication between guests (VMs) and the host allowed. This means, we will be able to communicate with VMs, VMs will be able to communicate with each other but any external device won’t be able to talk to VMs, nor will VMs be able to talk to anything beyond host.
- Forwarding to physical networks – Three modes are available when forwarding to physical networks:
- NAT means all the traffic from VMs will be hidden behind host’s IP address, allowing for external communication. In this mode, however, accessing VMs externally might be difficult as port forwarding will be required.
- Routed means network can be accessed externally as long as necessary routing is provided.
- I’ve no idea what Open does as I’ve never used it. Looks like libvirt’s documentation doesn’t cover that option either.
If you aren’t familiar with above concepts, NAT will be the best option for now. As you get more familiar with networking (and as our lab gets bigger), I will try to explain why routed network is my preferred way of handling networking in lab.
Creating a new virtual network
To see all virtual networks available, in Virt-Manager go to Edit -> Connection Details:
You should see something similar to screenshot posted below. You will probably only see Network1 as it’s a default network created by LibVirt when first installed. If it’s not there, there’s nothing to be afraid of. I’m going to explain how to create it once we cover all the available networking options.
When you press + button (1 on the screenshot above), you should be taken to a “Create a new network” wizard. Think of a name for your new network (I went with TecDenExample) and click Forward:
Now, you will be asked if you want to define a network space. If you’re pretty new with networking, this might sound confusing but trust me, it’s not! It’s quite easy to explain. Let’s have a look at the configuration window:
I’ve defined a 192.168.30.0/24 network (192.168.30.0 with mask 255.255.255.0). Below the Network field, you can see a couple of things:
- Gateway: 192.168.30.1 – This means that after we create a virtual network, a network interface (NIC) will be created on our host to provide connectivity with VMs within that address space. The concept still seems stray? Let’s say we have two virtual machines with interfaces configured as 192.168.30.10 and 192.168.30.11. Our host, to be able to communicate with them, has to have a way to reach their network. Since the network is isolated, it must have a network interface directly connected to that network (basically an interface in this specific network). In this scenario, new interface has the IP address of 192.168.30.1 and allows us to connect to any virtual machines in this network. Doesn’t matter if it’s a routed or NATed network, if you want host to communicate with guests on that network, address space must be defined.
- Type: Private – This tells us that we’ve picked a network from a private IP address space.
I’ve also disabled DHCP because it won’t be needed.
Now press Forward button twice. Creator should take you to the last step. Since for now we will be sticking to NAT, select Forwarding to physical network option and in Destination field, pick your host’s physical interface (in my case its enp3s0). In Mode, select NAT from the dropdown list and press Finish.
That’s it! Your Connection Details window should now show your new network:
New device was created to allow connectivity to the network. As you can see, it’s virbr8. We can see the interface configuration with ip addr show device. In my case, it’s ip addr show virbr8:
Deploying our first VM
Close the Connection Details window (if you still have it open) and focus on the main window now. To add a new VM:
Now, select Local install media (ISO image or CDROM) and click Forward. You will be asked to choose the ISO image that will be used for the installation. From the storage pool we’ve created in my previous post, select R77.30 ISO image:
When you finish selecting the ISO image, clear the Automatically detect operating system based on install media box and in OS type select Linux and in Version select Red Hat Enterprise Linux 5.11. Then click Forward.
Assign the VM resources it can use. Since this VM will be serving as both firewall and a management server, assign it at least 2GB of RAM and two cores. I’m not sure if two cores are required in R77.30, but R80.20 would fail during initial configuration due to insufficient resources available. Also, don’t worry about overprovisioning your CPU. Generally the tasks we will be carrying out aren’t very CPU intensive.
In the next step, either allow virt-manager to create storage automatically (assign it at least 30 GBs) or you can create a volume yourself. To create the volume yourself, follow screenshots below. Change name (4) of the volume to something like TD-FW-001. Change Max Capacity (5) to 30 GB.
After volume was created and selected, press Forward and in the final window choose a name for your new VM. I usually name them exactly the same as the volume. Therefore, my new VM is called TD-FW-001. Select Customize configuration before install option and expand the Network selection section. Make sure the TecDenExample network is selected:
Now press Finish. If you’ve selected the Customize configuration before install option, you should see a new window with VMs properties. Go to NIC section and change Device model to e1000:
Press Apply. Now go to VirtIO Disk 1, expand Advanced options section and then expand Performance options section. Change Cache mode to none. Change IO mode to native. Press Apply and hit Begin Installation. Machine should start:
Select Install Gaia on this system and hit Enter. Drivers should start loading. Now we play the waiting game!
When asked if you want to proceed with installation, hit Enter. Select US language. Do it, seriously. For some reason, any other language I select always crashes the installer. When you’re asked to configure partitions, do it as follows:
This is to ensure we get as much space for system-root and logs partition. Press OK. Now, pick an admin password, retype it and press OK.
When asked to configure network interface, configure it so it’s in the same subnet as our virbr8 interface. If you created a 192.168.30.0/24 network, you can configure it as follows:
After you’re done. Press OK. You should now be warned that the installer will wipe your hard drive. Press OK and proceed with installation.
Once the installation is finished, press Enter to reboot. That’s it! Your first VM was deployed successfully.
In the next article I will be covering first time configuration, SmartDashboard and we will be expanding our network by additional gateway!
Stay tuned 🙂