程序代写案例-FIT3165 /
时间:2022-05-23
Setting up your laptops to run the Virtual Machine
1 Setting up Your Laptop for FIT3165 / FIT4165
We will require certain software for the lab exercises throughout the semester. We have prepared
a Virtual Machine that contains almost all the required software for the subject during the
semester. In the following steps you will be instructed to install Virtual Box, an open-source
hypervisor that allows the use of virtual machines. See the Virtualisation Explained in the last
section 4 for more information.
1.1. Download and Install VirtualBox
• Download the VirtualBox from https://www.virtualbox.org. It is available for all three
major platforms: Windows, macOS, and Linux.
• Follow the installation instructions for your operating system.
• Download the VirtualBox Oracle VM VirtualBox Extension Pack from the same web
page (the file is read by VirtualBox and is the same for all platforms).
• Install the Extension Pack after you have successfully installed the VirtualBox. To install
simply double-click it and it should open in VirtualBox dialogue and prompt for
approval.
As VirtualBox installs various system drivers it will ask for administrative privileges.
1.2 Download and Import Prepared Virtual Machine
The VM contains required software used in lab exercises and or assignments. One such tool is the
Core Network Emulator which allows to mimic complex network scenarios without the need for
accessing physical equipment. In exercises related to operating systems we can safely perform
tasks which are contained in the VM without accidentally changing the state of the operating
system that runs our physical machine. It also allows us to provide universal instructions and
exercises that would work the same way for all students as they will be run within the VM.
• Download the VM file: lu16d-coremu-v1.3.ova
– https://cloudstor.aarnet.edu.au/plus/s/vhxKjdq5Jmk8Fis
• The file is about 2.6 GB so it may take some time to download.
• There are two ways to import the file into VirtualBox:
– Simply double click on the file and a dialogue box from VirtualBox should open
that will guide you through the importing process.
– Open VirtualBox and then from the Menu Bar: File → Import Appliance →
Browse (find the file using the OS file browser) → Continue → Import.
1
1.3 Set up a Shared Folder between VM and the Host
In this step you will configure a folder on your host machine (OS running on your physical
device) to be shared with the VM (guest who runs a flavor/distribution of Linux). We can use the
shared folder to transfer files between the host and guest.
1. Open VBox and select the imported VM in Step-
2. Right click on the VM and select Settings as shown in Figure below.
VM Settings - Method 1
An alternative approach is to select the VM and then click on the settings icon in the tools
panel (Figure-shown below).
VM Settings - Method 2
3. Click on the Shared Folder icon in the settings window, then click on the folder icon with a
green plus on the right side of the window to add a new shared folder as shown in the Figure
below.
Adding a new shared folder
4. From the Folder Path in the opened window click on the drop-down icon and select other
which will open the OS file browser to select a folder on your host machine to be shared
with the VM. After selecting the folder check the Auto-mount option to make sure it will be
mounted every time the VM is booted (the shared folder is presented as a network attached
storage to the VM). Figure below shows my chosen Folder Path and Folder Name as
well as the Auto-mount option.
2
Selecting the shared folder and checking the Auto-mount option
1.4 Starting the VM
Start it by double-clicking on its icon in the VirtualBox main window, or by selecting it in the list
of VMs and then clicking on the “Start” icon. The VM runs Ubuntu version 16.04 with LXDE for
its Graphical User Interface (GUI). Once booted, it will automatically log in with the user muni
and you should see a screen as shown in Figure below.
Booted and logged in to lu16d-coremu-v1.3
The set password for this user is also muni so if you log out and are presented with a logon
prompt simply enter muni as username and password to log back in.
3
Note that the shared folder that I have created is showing on the desktop like a removable (or
network attached) device. The given name to the mapped (mounted) shared folder under VM will
start with sf_ followed by the name you have chosen for “Folder Name” in Step 4 of Section-.
For instance, I chose shared as the Folder Name and the mounted shared folder name became
sf_shared. You will learn more about Linux file system structure in the following weeks, however
it is worth knowing now that the folder is mounted under /media hence in my case the full path to
the folder is /media/sf_shared.
2 Running Your First Network Emulation (Optional)
The CORE network emulator allows us to construct complex networks and explore how they
operate, without having access to the required number of physical equipment to run the similar
scenario in a real environment. It is an excellent tool for education, testing, and research. In this
step we will try a simple scenario just to become familiar with the interface of the Core Network
Emulator. For brevity from now on I refer to this tool simply as core.
1. On your host (laptop) system go to Week 1 section of the subject Moodle page and
download the core configuration file named simple-web.imn and save it under the shared
folder directory. This is the folder on your host (laptop) system that you have selected in
Step 4 of Section-.
2. Inside the VM, open the core by double clicking on its shortcut on the desktop.
3. From the File menu of core GUI select Open, which will bring up the Open dialogue box
4. Browse to the shared folder directory on the VM (in my case this is /media/sf_shared) and
you should see the file simple-web.imn. Select the file and click on the Open button to open
the file. You should see a network diagram as shown in the Figure below.
4
simple-web.imn core configuration file opened in the emulator
5. Run the emulator by clicking on the Play Button, a green circle with a white arrowhead
within it on the left side of the core window. Once you click on the button you should see
some squares appearing around each of the devices representing the boot process of these
nodes. When the configuration is booted up the play button turns to a stop button (a red
circle with a white X within it). Whenever you wish to start and stop the emulation it is
important to let each task be completed by core. Creating the virtual nodes when starting the
emulation and removing and cleaning up the virtual nodes when stopping the emulation is a
process that may take some time especially for more complex configurations.
6. Open the Firefox web browser in the VM and type www.muni.edu in the address bar. You
should see a simple welcome page. This page is served by the node named web in the
configuration. After you enter the URL, your browser performs several tasks to
communicate with the web server to retrieve the page and show it to you in the browser
window. The VM is connected to the configuration using a virtual interface, which is why
we can request and see the page served by the web server. We will learn about the protocols
and steps involved for this to happen in the weeks ahead.
7. Open a terminal session on the laptop by double clicking on the node (when the emulation is
still running). This is shown in the Figure below.
5
Opening a terminal on the laptop in simple-web core emulation
8. In the terminal run the following command:
lynx www.muni.edu
lynx is a text-based web browser and like Firefox we have given the URL to the web site
we wish to visit. As the virtual nodes in core have no graphical capability, we will use the
terminal to issue commands. For higher layer protocols such as browsing web pages we
will use text-based tools.
9. After you are done with all the tasks, stop the emulation by clicking on the stop button on
the left-side panel of the core GUI. Wait for all the nodes to stop. This is shown by red
squares appearing around each node and then disappearing and finally the stop button (red
circle with white x) turning into play button (green circle with white triangle) on the left-side
panel of core GUI. Stopping the emulation is an important step as core cleans up created
virtual nodes and processes. Once the emulation has stopped then close the core GUI
window.
3 Shutdown the VM
The VM runs a proper OS and as such needs to be treated as if running on a physical machine.
Once you are done with the VM and wish to close the VM window you should shut down the
system properly. To do so click on the power button on the bottom right corner of the VM
window and select Shutdown.
6
4 Virtualisation Explained
A virtual machine simulates a real computer. It allows you to run a complete operating system
(e.g.in our case, Linux) inside a window of your normal operating system (e.g.Windows or
macOS). We call your normal operating system the “host”, and the simulated one the “guest”.
An important property of VMs is that the host can control the guest. For example, if something
goes wrong with the guest, the host can simply restart it. The host can also control whether the
guest has access to the hard disk or the network. Another important property is that we can run
the exact same guest on a diverse range of host hardware and software. This means we can
provide a VM that works the same for all students, no matter what kind of laptop and operating
system they normally use.
By using the CORE emulator inside a VirtualBox VM, we in fact use two layers of
“virtualisation”:
• the CORE network is a simulated network,
• and it runs inside a simulated computer (the VM).
This makes it possible for us to safely try out complex network configurations without
compromising the security of a real hardware network. (If you’ve seen the movie Inception you
may recognize the idea of running simulations within simulations within simulations…)
7