Quick viewing(Text Mode)

Assignment #0 NES 411, Fall 2014, Dr. Ahmad T. Al-Hammouri

Assignment #0 NES 411, Fall 2014, Dr. Ahmad T. Al-Hammouri

Assignment #0 NES 411, Fall 2014, Dr. Ahmad T. Al-Hammouri

Due date: Not Applicable.

Objectives:

• To set up the environment that we will be using throughout the course for testing networked programs.

Introduction: In this assignment, we will guide you through the steps to prepare the appropriate setup for testing the several programs that will reinforce the concepts we will be studying in this course. The ideal environment would comprise two or more physically separate machines that are con- nected via any topology of an IP-based network. However, due to the limitations imposed on us by NAT middle-boxes, and to provide you with a versatile environment accessible virtually at any given time, we will utilize operating systems’ virtualization. With this, we will set up a min- imal topology comprising two Operating Systems (OSs) running concurrently on two separate machines (one is physical; the other is virtual) connected via a virtual network.

Requirements: You are required to have a machine with at least 2GB of RAM, and at least 25GB of free space on hard drive.

Environment Setup: You are one of the following two categories:

1. Your machine runs only one OS, which is a variant of the Windows OS. 2. You are already having a OS installed as a dual boot in addition to the primary Windows OS.

Note: If you are of category #1, you need to deploy both and the Linux VM, but if you are of category #2, you should skip the following section and proceed to the next one titled ‘Installing Linux As A Virtual Machine’. Installing Cygwin on Windows: Cygwin (https://www.cygwin.com/) provides a POSIX API functionality on Windows. The use of Cygwin allows us to use -based socket API and other UNIX utilities on Windows. For your convenience, the Cygwin installation files are cached on the following local machine http://10.242.130.111/Public/NES411.

1. Depending on your machine (being 64- or 32-bit), download and uncompressed the appropriate Cygwin archive file. 2. Start the installation program, i.e., the setup executable file. 3. Follow the on-screen wizard steps to complete the installation noting the following: • On the page ‘Choose A Download Source’, select the third option ‘Install from Local Directory’. NES411,Fall2014 Assignment#0 Page2of3

• On the page ‘Select Root Install Directory’, choose whatever directory you want Cygwin to be installed into. • On the page ‘Select Local Package Directory’, choose the folder where you decom- pressed the archive file in. • On the page ‘Select Packages’, change the behavior to Install instead of Default for the following 13 packages: Base, Devel, Editors, GNOME, Libs, Net, Security, Shells, System, Tcl, Utils, Web, and X11. Keep Others to Default. • The installation will take quite a while so plan your time and resources, e.g., laptop’s battery power reserve, accordingly. • After installation completes, run the Cygwin shell by double clicking on ‘Cygwin Terminal’. • On the shell, issue the command startx to bring up the primitive X window system of Cygwin. Installing Linux As A Virtual Machine: We next set up the CentOS Linux’s virtual machine per the following steps.

1. Download the pre-built CentOS image from http://10.242.130.111/Public/NES411/ CentOS-7.0.vdi. 2. Download and Install Oracle’s VM VirtualBox from https://www.virtualbox.org/. 3. On VirtualBox’s main window menu bar, choose ‘File’ −→ ‘Preferences’ −→ ‘Network’ −→ ‘Host-only Networks’. If there are no adapters present, click on ‘Add host-only network’ −→ ‘OK’; otherwise, do nothing. 4. On VirtualBox’s main window, click on ‘New’, then type whatever name you want to give to your Linux machine, e.g., CentOS-7. For ‘Type’, choose ‘Linux’ and for ‘Version’, choose ‘Red Hat (64 bit)’. Then, click ‘Next’. 5. For ‘Memory size’, enter 1024MB. 6. For ‘Hard drive’, choose ‘Use an existing virtual hard drive file’, browse to where you saved the image in step 1, select it, and click ‘Create’. 7. On VirtualBox’s main window menu bar, select/highlight the newly created virtual machine, and click on ‘Settings’ −→ ‘Network’: • For ‘Adapter 1’, make sure that ‘Enable Network Adapter’ is selected, and that ‘Attached to:’ is set to ‘NAT’. • Select ‘Adapter 2’, select ‘Enable Network Adapter’, and for ‘Attached to:’, choose ‘Host-only Adapter’. For ‘Name’, choose the adapter you created in step 3 (usually it will be the only one). Click ‘OK’. 8. On VirtualBox’s main window menu bar, select/highlight the newly created virtual machine, and click ‘Start’. 9. Log in onto the virtual machine using user name ‘nesstudent’ (Account Name is ‘NES Student’), and password ‘nesstudent’. Moreover, for your future uses, the root password is ‘root’. 10. In the Terminal, run the command ifconfig. There must be three Ethernet interfaces: lo, enp0s3, and enp0s8 (the last number might be different from 3 or 8, though). 11. Make sure that the three interfaces are having IPv4 addresses (inet) and network masks. NES411,Fall2014 Assignment#0 Page3of3

• If one or more interface(s) have no IP addresses, go to ‘Applications’ −→ ‘System Tools’ −→ ‘Settings’ −→ ‘Network’. Click ‘ON’ for both interfaces enp0s3 and enp0s8. • Bring the interfaces up with the command sudo ifconfig InterfaceName up where InterfaceName should be substituted with enp0s3 or enp0s8. 12. Run the command ifconfig. Now, one interface must have an IP address in the network 10.0.2.0/24 (usually it will be 10.0.2.15), and the other must have the IP address in the network 192.168.56.0/24 (usually it will be 192.168.56.101). Verifying The Connectivity Between The Two Machines: In this assignment and in the sequel ones, the OS that is running on the bare metal (Windows on Linux) is referred to by the Host OS, and the Linux OS that is running as a virtual machine is referred to by the Guest OS.

1. From the Host OS, make sure you can ping successfully the Guest OS on IP address 192.168.56.101. 2. From the Guest OS, make sure you can ping successfully the Host OS on IP address 192.168.56.1. 3. From the Guest OS, make sure you can access the Internet by directing the Web browser to, say, http://www.google.com. 4. Download the source code file daytimetcpcli. from elearning, change the IP ad- dress in line 26 to 192.168.56.101, compile it on the Host OS, and run it. Since the Guest OS is already configured to run the daytime service, the client running on the Host OS must be able to correctly receive the answer back. Deliverables: There are NO deliverables for this assignment, but you have to make sure that you have set up the complete environment correctly.