From the course: Linux System Engineer: Kernel Tuning and Remote Logging

Lab setup

- [Narrator] In order to configure and test Linux network using virtual box, we need more than one virtual machine. We will need two VM's, we want both VM's to access the other's network interfaces. We may also want to have the virtual box host or other computers on the physical network to have network connectivity with the VM guest. In order to do this, we will need to configure the VM network interfaces. In order to clone our VM, we need to make sure it's shut down. If your VM is running shut it down now using virtual box manager. Once it's shut down we can continue. To configure the network interface settings, click on the VM and then click on settings and then click on network. We want to change attached to NAT to attached to bridged adapter. In the name section, make sure you select the physical network adapter of your host machine that has access to the internet. In my case the host is running on Linux and I'm using the wireless network adapter, so I'm going to choose wlp3s0, which is the name my Linux host installation has chosen for it. If you're using Mac OS or Windows as your host choose the appropriate network interface that your host is using. Once that's done, click on okay. We also need to discard the saved state so our VM's boot up fresh for the first time. If you don't do this then all of your VM's will boot up and assume the same IP address because that is a live setting in RAM which is included in the saved state. Make sure your VM is selected and click on discard. Then click on discard again. Once we have our VM network adapter configured we want to clone the VM. In the virtual box manager window go to machine, then click on clone. A dialogue box asking for the name should appear. Let's name this rhhost1 and click on reinitialize the MAC address of all network cards. This is so all network cards have a unique MAC address so even though the rest of the VM is identical, the MAC addresses won't be. Now click on next. Now we have to choose the type of clone we want. A full clone makes a completely independent VM that can be moved without the original, but takes up an equal amount of disc space as the original. If you foresee moving one VM without the other, you may want to choose full clone here. However, for our purposes, making a linked clone is perfectly fine and uses less disc space. I'm going to choose linked clone, and then click on clone. And now I'll make sure the original VM is selected and let's make a 2nd clone. Go to machine, click on clone, and this one we're going to call rhhost2 and then click on reinitialize the MAC address of all network cards. Click next, select linked clone, and then click on clone. Now we should have two virtual machines named rhhost1 and rhhost2. Let's configure their networks. Click on rhhost1 and click on start. After your VM boots up log in when prompted. On the desktop click on the top right-hand menu click on wired, and then click on wired settings. Click the on-off slider to turn the network on. When it retrieves an IP address note that the address should be on the same network as your host computer. If it's an address that starts with 10. the network configuration settings in virtual box might not be correct, unless your physical network also starts with 10. Remember this IP address because we'll need it later to ensure connectivity. Mine is 192.168.0.19. Then click the settings gear in the bottom right-hand corner. Click on identity, and click connect automatically, and then click on apply, and close the dialogue. Before we start our 2nd VM let's create a new snapshot by pressing the host key plus T. My host key is right-control, so I'm going to press right-control-T and we're going to call this snapshot network config, and hit enter. Once this is done, press your host key again to release your mouse pointer, go back to your virtual box manager, click on rhhost2 and click on start. On the desktop go to the top right-hand menu, click on wired, wired settings, and then click on the slider button to turn the network on. Then we'll click on the settings gear, we'll click on identity, and click on connect automatically, click apply, and close the dialogue. Now we have two running virtual machines with their network interfaces on the same network. While we're still using rhhost2, let's open a terminal by going to applications, favorites terminal. I'm going to make mine full screen and bump my font size. And to ensure connectivity with rhhost1, let's ping it by typing in ping space followed by the IP address of rhhost1. In my case I'd type ping space 192.168.0.19. After it sends a couple ping packets press control C to cancel it. If it successfully pings rhhost1 by IP address you can continue with this course. If not, go over the steps in this video until you get it to work. Do not proceed on until these steps work otherwise the course cannot be completed. Before we end this video let's create a new snapshot of our rhhost2 VM. Close your terminal window, and then press your host key T. In my case again, my host key is right-control space T, and this snapshot we're going to call network config, and hit enter. You can now shut down both VM's by clicking the close gadget, selecting power off the machine, and making sure restore current snapshot 'network config' is selected.

Contents