Vous êtes sur la page 1sur 9

Assignment 1:

Physical Layer and Infrastructure


(Exploring VirtualBox, BusyBox, Shell commands)

Starting: Week 34 / Deadline: Week 35

The goal of this assignment is to get acquainted with the virtual lab environment, linux and shell
commands. The networking focus is on the wiring, i.e. how to patch devices together into a network.

All assignments shall be handed in according to the “Documentation-Guidelines”


document found in Canvas (see attachment)

PART ONE: Install Ubuntu on a Virtual Machine

The goal is to get started with VirtualBox and gaining knowledge about installing and using a Linux
distro, such as Ubuntu.

1. Download a late stable version of Ubuntu Server iso-image from the Internet, e.g. Ubuntu 14.04
Sever or a newer version. Choose either the x64 version:
http://releases.ubuntu.com/14.04/ubuntu-14.04.5-server-amd64.iso
or choose the x86 version:
http://releases.ubuntu.com/14.04/ubuntu-14.04.5-server-i386.iso

2. Download and install VirtualBox on your system. If you are working on a student machine, you
can skip this step, because VirtualBox is already installed.

3. Open VirtualBox and press "New". Select a name for the new Virtual Machine(VM) with
“Linux” as the type and “Ubuntu(64-bit)” as the version(Or Ubuntu 32-bit, depending on the
downloaded ISO image). Furthermore go for the default memory size(1024 MB) before
pressing next and selecting "Create a Virtual Hard disk now”. Use the VDI format, dynamically
allocated hard drive, and the default file size(8GB).

4. Power on the Virtual Machine you have created. When you are asked to select start-up disk,
you select the ISO file of Ubuntu that you downloaded above. Select “English” when prompted,
and after boot select "Install Ubuntu".

5. You can select English language, Norway as time zone, Norwegian Keyboard, and a hostname,
login name and password that suit you. When partitioning, select “guided use entire disk” you
and select Yes to write changes to disk. Otherwise, you can generally select the default settings
when prompted.

6. After installing, log in to your Ubuntu VM using the login and password you selected above.
Play around and make yourself acquainted with Ubuntu.

7. Finally, make sure to store away the virtual machine you have created, so that you can continue
working with it later in the semester, e.g. during demos in class lectures. Before doing it, you
need to stop your virtual machine or power it off. If you are working on a student machine at
OsloMet, make sure you store it in your home directory, H:. You can select File->Export to
export a virtual machine to your home directory, and later use File->Import to import it to
another student machine next time you will need to use it again.

PART TWO: Explore the Virtual Lab

The goal is to get more acquainted with VirtualBox and virtualization.

NB! After having finished this assignment, please store all the virtual machines that you created
during the assignment, because you can continue working on them for the next week’s
assignment. You save time by not having to recreate everything again from scratch.

8. Implement a host (Host1 or “H1”) as a Virtual Machine in VirtualBox and clone it

a. Download the “linux-microcore-4.0.2-clean.vdi” from Canvas. This appliance will be used


as the end-host system.

b. Create a new host in virtualbox by pressing new; Use “Host_clean” as the name,“Linux”
as the type and “Other linux(64-bit)” as the version(Or other linux 32-bit). Press Next –
Next – Use Existing virtual Hard disk file + <Browse and select the file you just
downloaded> – Create. Observe that the node you have created appears as a VM named
“Host_Clean” in the virtualbox GUI.

c. We are going to let the clean device be there for now, and instead work on a clone that we
will modify: Thus, select the Host_Clean VM (without powering it on) and on the menu
select Machine – Clone. Set the name as “Host1” and choose to reinitialize the MAC
address press Next- Select Full Clone – clone. Observe that you have created the new node.

d. In the VirtualBox GUI, mark the new node, Host1, that you have created, click on Network
and check out the networking settings. Notice that the Network adapter 1 uses NAT. The
new host is connected to the Internet. Your virtual network (as seen from Host1) and the
corresponding physical implementation of it in VirtualBox is roughly outlined in the
following figure:
VirtualBox implementation of
Your virtual network
Your virtual network

H1 H1 “H1”
(called «Guest»)
VM
Host 1

Virtual
NAT DHCP Box
NAT DHCP

Your Laptop
Internet (called «Host system»)
Internet

Figure 1
9. Start up “Host1” and do some initial testing and installation

a. Your username is tc (for “TinyCore”), there is no password for neither tc or root, and
you are automatically logged in as tc at startup. Microcore Linux is a lightweight
version of TinyCore Linux that is using Busybox: Check out the shell commands you
can use by issuing the command busybox | less. Note that default keyboard layout is US,
so if you are on a Norwegian keyboard you will find the pipe character as <shift->*. In
the first part of assignment 2, you will learn how to change the keyboard map into a
Norwegian Layout (or whatever layout you prefer).

b. Check out the configuration and network connectivity by issuing some of these
commands, such as “ifconfig” and “route”, … What do you observe? What is the default
gateway assigned to Host1.

c. Change directory into /etc. Open the files “services” and “resolv.conf”. What is the IP
address(es) of the DNS nameserver(s), and which protocol(s) and port number is used
for name lookup? What protocol/system has been into play to set the networking
configuration dynamically at the node?

d. Check out the Internet connectivity (e.g. ping www.vg.no). What protocols come into
play when you issue the command ping www.vg.no, and in which order?

e. On MicroCore Linux / TinyCore Linux, the command to start the packet manager is ab
<module> (corresponding to apt-get install <module> on Debian/Ubuntu).

i. Important! First install the libraries ncursesw.tcz, pcre.tcz and ncurses.tcz. If this is
not done, you will most likely get problems when installing and using the other
programs.
ii. Install tcpdump. (It requires Internet connectivity). After installation, issue for
example tcpdump as a command to confirm that you have got it installed.
iii. Install also openssh in the same way.
iv. Finally, install nmap

10. Check out the file system and persistent storage.

a. Change the hostname by sudo hostname Host1, and check that the change has occurred
(hostname). What is the meaning of “sudo”? Now, also use the vi editor to open, inspect and
edit the file /opt/bootlocal.sh: Add the command “hostname Host1” at the end of the script
(- you do not need sudo in bootlocal.sh, as this script already runs as root). What is the
purpose of this file?

b. Now reboot the system (sudo reboot). What has happened with the actions that were taken
with the hostname in the previous bullet point? Are the installed packages, such as tcpdump,
still available?

c. Change the hostname as in the previous steps, but end the procedure by issuing the
command “filetool.sh –b”. Which effect has this across a reboot?

d. List out the content of the file /opt/.filetool.lst. What is the interpretation of bootlocal.sh
being on this list?

e. You installed openssh above, but in order to be able to ssh into another node at a later stage,
you need to: cd into /usr/local/etc/ssh/ and create a new file by “sudo cp
sshd_config.example sshd_config”. Show how you can store this file persistently (i.e. across
reboots) on your system. Issue a sudo reboot and confirm that it is stored persistently.

f. Finally, for ssh, you also need to generate some security credentials using the commands
“sudo /usr/local/etc/init.d/openssh start” and use filetool.sh –b to store them persistently.

11. Do some simple traffic analysis.

a. Start tcpdump to capture packets on interface eth0 and write (i.e. -w) results to the file
/home/tc/mydump. tcpdump shall run in the background (i.e. use &), and quit after having
captured 20 packets (i.e. –c 20).

b. Check the arp cache (arp command), and remove any entries (you can write arp -help to
find out what options to add to the arp commands).

c. Run ping www.vg.no to fill the tcpdump file, mydump. Analyze the file with tcpdump. What
are the different kinds of protocols in use, and what is the purpose of the different kind of
traffic?

12. Clone the host into a new server, and plumb them together.

a. Shut down the host (sudo poweroff). Afterwards, in. the virtualbox GUI, select the host-VM
(Host1) that you have created, and on the menu select “Machine – Clone – Name=Server1.
NB! Choose to reinitialize the MAC address! Next- Select Full Clone – Clone. Observe that
you have created the new node.

b. Before we power them on, we are going to plumb them together: For Host1, select the
“Network” menu. Enable Adapter 1 (corresponding to eth0) and attach it to an “internal
network”. The name of the network is arbitrarily chosen by you. You can call it
“crossconnect”. You can think of this as attaching Host 1 to a “Hub” called “crossconnect”:
VirtualBox implementation of
Your virtual network
Your virtual network

H1 “H1”
H1 (called «Guest»)
Cross- VM
connect
Host 1
Cross- Virtual
connect Box

Your Laptop
(called «Host system»)

Figure 2

c. Now, for Server1, do exactly the same: By using the same name as above (“crossconnect”)
we ensure that Server1’s eth0 and Host1’s eth0 are connected to the same virtual internal
network. They can communicate directly, virtually inside VirtualBox. This is illustrated
below:

Your virtual network VirtualBox implementation of


Your virtual network

S1 H1 S1
Cross- H1
connect
Host1 VM VM
Server1

Cross- Virtual
connect Box

Your Laptop
(called «Host system»)

Figure 3

13. Configure the nodes manually, so that they can communicate


a. Start both hosts (Server1 and Host1). Check out ifconfig, and explain what you observe.
b. Use ifconfig to set up the nodes with the IP addresses as listed below. Make the changes
persistent, so that the nodes will reboot with the same settings:
• Server1: 10.0.0.4/24
• Host1: 10.0.0.3/24
c. Demonstrate reachability by using ping.
d. What will happen if we change the ip address of Host1 to 10.0.1.3? Demonstrate and
explain what happens when you try to ping with the new address. (After having tested this,
go back to using the correct ip address 10.0.0.3).

You are finished with this part! Make sure to store away the virtual machines you have created, so that
you can continue working with them on the next week’s assignment. That is, if you are working on
student machines at OsloMet, make sure you store it in your home directory, H:. (You can select
File->Export to export a virtual machine to your home directory, and later use File->Import to import it
to another student machine next time you will use it.) When you have finished, and done everything
correct, your virtual network will look as described in the figure below. Note that due to the strict
Layering principle of networking, what actually happens at the physical layer is transparent to the node,
so whether it is a “hub” (or someone would say “repeater” for a “hub” with only two interfaces) or a
crossconnect cable or a virtual implementation of it happening within VirtualBox does not matter. The
latter two can be considered only a cable extension. So, from the perspective of our node, we can
simply consider the two nodes connected like this:

S1 H1
10.0.0.4 10.0.0.3
Server1 Figure 4 Host1

The deadline for completing and submitting this assignment into Canvas is at 23:30
(11:30 pm) two days after the lab in the week of the deadline (i.e. Week 35).

Resources:
• http://en.wikipedia.org/wiki/Ethernet_crossover_cable
• http://www.cisco.com/en/US/docs/ios/preface/usingios.html
• http://www.iu.hio.no/teaching/materials/MS003A/html/IOScommands.html
Assignment 1
Physical Layer and Infrastructure


Group 1:
Person_1_name (student_nr1)
Person_2_name (student_nr 2)



Enterprise Networking: Practices and Technologies
(INF4018NSA)

Oslo and Akershus University College of Applied Sciences


<Submission Deadline Date>

Introduction
An explanation of what the aim of the task is, in your own words and opinion. Since the tasks are very open-
ended, you can choose to color them with your own interests.

Materials and Methods


The materials and methods used in the project should be documented in this section. It should describe exactly
what you did. There should be enough detail to allow you or another person to be able to reproduce exactly what
you did and get the same results.

You will be allowed to use only these documentations and nothing else under the test/exam towards the
end of the semester.

Include labeled diagrams of the setup and a detailed step-by-step of your implementation.

Do not include the configuration files in this section, as they should be attached to the report as an appen-
dices section!

Discussion
In this section you may discuss your findings:
• Were you able to implement the project according to the specifications?
o What particular problems did you encounter, and how did you solve them (briefly)
• What limitations did you encounter?
o What were you not able to resolve and why?

Conclusion
In this section you should be able to:
• Convey what you have discovered
• Your key learning points

References/Bibliography
Refer to any references in the text with numbers [1,2] and then list them here formatted as per these examples

[1] AuthorFirst, AuthorLast, (Other authors), “Title of the reference”, Publication, publisher, date
[2] Organization_or_committee (if no author listed), “Title of publication or web-page”, website, publisher, date
[3] CentOs,“CentOS is an Enterprise Linux distribution” https://www.centos.org/, accessed March 2012.

Appendices
Here you can have all the configuration files used by your in the task and are referenced in your document. For
example:

A.1 Configuration of OSPF


A.2 Configuration of static routes
A.1 Format and naming convention
The document must be submitted in doc/docx (Word), odt (OpenOffice) or pdf (Adobe) format. Documentation
document templates for the various formats can be found in Canvas.

The submitted file must use the following naming convention (this example, a pdf file):

GroupNumber_AssignmentNumber.pdf

Example: Group5_Assignment2.pdf

A.2 Front page


The first page must be a front page (cover page / title page) that contains the following elements:

Title of the project


• Assignment title (e.g. “Assignment 1”)
• Subtitle (E.g. “Exploring the lab”)

Authors
• Group number
• The name of each group member (including student number)

Entity for which the experiment was done (e.g. “Oslo and Akershus University College of Applied Sciences”)

Submission deadline date (e.g. “September 30, 2015”)

Vous aimerez peut-être aussi