ISM6225-Assignment-1

pdf

School

University of South Florida, Tampa *

*We aren’t endorsed by this school

Course

6225

Subject

Computer Science

Date

Dec 6, 2023

Type

pdf

Pages

35

Uploaded by ConstableOctopus2680

Report
ISM 6225: OSI Model Assignment #1 By Dr. Clinton Daniel and Dr. Manish Agrawal OSI Hands-on Fundamentals of Networking and Systems
1 Table of Contents OSI MODEL: INTRODUCTION .......................................................................................................................... 3 Lab 1 Basic Linux Operating System commands ..................................................................................... 3 Exercise 1 Working with directories .................................................................................................... 3 Lab 2 Basic Linux Networking commands ............................................................................................... 7 Exercise 1 Output the results of a network command to a text file ................................................... 7 Virtual Lab Exercise Capture Linux Traceroute from Course Virtual Machine ....................................... 8 OSI MODEL: PHYSICAL LAYER ......................................................................................................................... 9 Lab 1 Basic Linux Operating System commands ..................................................................................... 9 Exercise 1 Coding data from ascii to binary ........................................................................................ 9 Exercise 2 Coding data from binary to ascii ........................................................................................ 9 Lab 2 Basic Linux Networking commands ............................................................................................. 10 Exercise 1 Display network interface statistics ................................................................................. 10 Virtual Lab Exercise 1 Code ASCII to Binary using Course Virtual Machine .......................................... 11 Virtual Lab Exercise 2 Network Interface Statistics .............................................................................. 11 OSI MODEL: DATA-LINK LAYER ..................................................................................................................... 12 Lab 1 Basic Linux Operating System commands ................................................................................... 12 Exercise 1 Compute a Cyclic Redundancy Check (CRC) on a file ....................................................... 12 Exercise 2 Hex and Binary representation of files ............................................................................. 13 Lab 2 Basic Linux Networking commands ............................................................................................. 14 Exercise 1 Understanding network interfaces .................................................................................. 14 Virtual Lab Exercise Compute a Cyclic Redundancy Check (CRC) on a file ........................................... 15 OSI MODEL: NETWORK LAYER ...................................................................................................................... 16 Lab 1 Basic Linux Operating System commands ................................................................................... 16 Exercise 1 Convert bases to other bases using bc ................................... 16 Lab 2 Basic Linux Networking commands ............................................................................................. 17 Exercise 1 Capture IP packets using a host filter ............................................................................... 17 Virtual Lab Exercise Convert bases to other bases ............................................................................... 20 OSI MODEL: TRANSPORT LAYER ................................................................................................................... 21 Lab 1 Basic Linux Operating System commands ................................................................................... 21 Exercise 1 Explore the ss utility ........................................................................................................ 21 Lab 2 Basic Linux Networking commands ............................................................................................. 23 Exercise 1 Using the client/server model to demonstrate the use of a socket ................................ 23
2 Exercise 2 Using the client/server model to capture data transferred from client to server ........... 24 Virtual Lab Exercise Demonstrate the use of a socket to transfer data ............................................... 26 OSI MODEL: APPLICATION LAYER ................................................................................................................. 27 Lab 1 Basic Linux Operating System commands ................................................................................... 27 Exercise 1 Understand Linux file permissions ................................................................................... 27 Lab 2 Basic Linux Networking commands ............................................................................................. 31 Exercise 1 Understanding web-based applications ........................................................................... 31 Virtual Lab Exercise Explore a web application server ......................................................................... 34
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
3 bdcuser@BDCVM:~$ pwd /home/bdcuser bdcuser@BDCVM:~$ ls bdcuser@BDCVM:~$ mkdir test bdcuser@BDCVM:~$ ls test OSI MODEL: INTRODUCTION Lab 1 Basic Linux Operating System commands In this exercise you will be logging into the course virtual machine and executing some basic Linux Operating System commands. Learning how to navigate an operating system is an important practical skill for anyone whom desires to pursue a professional career in computer networking. Learning how to perform operating system tasks using the command line, as opposed to the graphical user interface (GUI) method, is important because most professional networking equipment is configured and managed using a command environment. Exercise 1 Working with directories In this lab task you will learn to work with Linux directories. At the terminal command prompt, type the following command: The pwd command will output your current working directory. If you’ve typed this command following the login of your virtual machine it should output: The above output shows that your current directory is within a directory called bdcuser that is within the home directory. Notice that when working with Linux directories that they are delimited by forward slashes or /. This is noticeably different than Windows directories which are delimited by backward slashes or \. For instance, when viewing a directory in Windows the output may look like: C:\Users\Clinton. Now, type ls command to list the contents of the current working directory: Unless you have created a file or directory in /home/bdcuser, then your output from the ls command should be nothing. So, let’s add a directory first and then run the command again. To add a new directory, type the following command: The mkdir test command creates a directory called test in the current working directory. It is important to note that Linux directories are case sensitive. A directory called “test” is not the same as a directory called “ T est”. Now type the ls command again: Notice that now the output from the ls command shows the newly created directory called “test”.
4 bdcuser@BDCVM:~$ cd test bdcuser@BDCVM:~/test$ bdcuser@BDCVM:~$ cd ~ bdcuser@BDCVM:~$ touch hello-world hello-world bdcuser@BDCVM:~$ nano hello-world bdcuser@BDCVM:~$ man nano Also, it is common between terminal views to see the output of commands, directories, etc. in different colors. For instance, the output of ls in this terminal view displays the “test” directory in the color blue. Let’s navigate inside the newly created “test” directory from the current directory using the cd command: The output from the cd test command should show the terminal command prompt similar to the following: Notice that this time there is a /test after the ~ symbol. The ~ symbol is used in Linux to identify your home directory. So, in this case you are in the /test directory within your home directory. At any time, you can navigate back to your home directory by typing the following command: If you executed the cd ~ command, please navigate back to the “test” directory by typing cd test again. Now that you are back in the “test” directory you will want to create a new file called hello-world using the touch command that will reside in the “test” directory. To do this, type the following command: Notice that when we run the touch command above that there is no file extension. The command simply creates a file on the Linux Operating System that is empty. In other words, the file has no content. Now, run the ls command again and you should see the file listed as “hello - world”. Once you’ve created the empty file, you can edit the file using an editor. We will edit the “hello - world” file using the nano editor. For more information on the nano editor, visit the text editor homepage here: https://www.nano-editor.org/ . Run the following nano command: It is also helpful to know the man command. The man command loads the help manual for any command if one exists. For instance, to access the manual for nano you type the following command:
5 The nano hello-world command will open the hello-world file in the GNU nano editor. Within the nano editor, type the following text: After typing Hello World in the nano editor, hit the CONTROL X keys on your keyboard. Notice in the figure above that ^X Exit (or CONTROL X ) exits the nano editor.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
6 bdcuser@BDCVM:~$ cat hello-world Hello World Upon hitting CONTROL X on your keyboard, you will be prompted to Save your edited file: To save the edited file, you simply hit the Y key on your keyboard (as seen above with Y Yes ). Then, you may have to hit the Enter key on your keyboard to re-display the command prompt. You can now view the contents of the file you have created, edited, and saved using the following cat command: The output from the cat hello-world command should show the contents of your file: * Other useful commands for working with Linux directories can be found on the Debian Wiki here: https://wiki.debian.org/ShellCommands
7 bdcuser@BDCVM:~$ sudo mount -t vboxsf vmshare ~/capture bdcuser@BDCVM:~/capture$ bdcuser@BDCVM:~/capture$ traceroute www.google.com>data.txt bdcuser@BDCVM:~$ cat data.txt Lab 2 Basic Linux Networking commands In this exercise you will be executing the traceroute network command and sending its output to a text file called data.txt. Exercise 1 Output the results of a network command to a text file First, you will need to navigate to the shared directory setup from your home directory. Please be sure that your virtual machine is setup based on the instructions provided with the Lab Manual. The setup instructions include a section which explains how to setup a local shared directory so that you can move files from your course virtual machine to a directory on your local laptop or PC. If you have setup your local shared directory as instructed in the virtual machine setup instructions, execute the following command to mount the shared directory called capture: When prompted, be sure to put in the password for the bdcuser account as instructed in the course virtual machine setup. Once you mount the “capture” directory to your local laptop/PC, execute the cd ~/capture command. The output from the cd ~/capture command should navigate you to the “capture” shared directory. Your output should look like this: Once you are in this directory, execute the following command: NOTE: Please be patient while this command runs. The cursor on the screen will just blink for a while the command collects the network data. It may take a minute or so depending on the speed of your network connection. When the command completes, you will see the command prompt re-display. Once the command has completed, you can type in the ls command. You should see the data.txt file. To view the contents of the file in Linux, run the following command: Upon execution of the cat data.txt command, you should see all the output of the traceroute command. The traceroute command collects data on the route that a packet will take to reach a destination. In this example the destination is www.google.com . As you observe the output of the command, each number listed in each row represents a new hop in the route to the destination. Each hop includes an IP address that supports an interface to route the packet toward the next hop. Additionally, each hop shows how many milliseconds it took for the interface to respond to the request. You may now minimize the Linux virtual machine and navigate to your local laptop or PC shared directory to access the data.txt file on your host operating system (ex. Windows or Mac OS X).
8 Virtual Lab Exercise Capture Linux Traceroute from Course Virtual Machine Search the Internet using your browser of choice and locate a website that is in a foreign country. You will need to find a website that uses an approved Country code as defined by ISO 3166 ( https://www.iso.org/iso-3166-country-codes.html ). For instance, the website https://realestate.co.jp/en/ is a Japanese website with the country code .jp . Once you have found the website of your choice that includes a foreign country code in the URL, follow the instructions below. 1. Review Labs 1 and 2 in the Introduction section of this course Lab Manual. Launch your course Virtual Machine and login with the bdcuser account. 2. Capture the output from the traceroute command using your foreign website as the destination. 3. When you execute your traceroute command, save your results in a file called foreign- website.txt 4. Execute the cat command on your foreign-website.txt file to observe the output generated by the traceroute command. 5. Open your foreign-website.txt file from your local laptop or PC shared directory. NOTE: Instructions on how to have your local shared directory setup can be found within your course lab manual. Observe the output from your local laptop or PC. Answer the following questions: 1. What was the difference in experience with this virtual lab exercise versus the Hands-on traceroute exercise? 2. What countries, starting from your source country (ie. Unites States), did your packets hop through along the route to your destination web site? 3. Why do you think your packets would be routed through those specific countries in order to get to the destination? For instance, did you observe the hops moving the packets through diplomatic channels? Or, is there some other interesting pattern you see as the packets hop through the specific countries?
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
9 bdcuser@BDCVM:~$ echo -n “h” | xxd -b 00000000: 01101000 bdcuser@BDCVM:~$ echo 01101000 01100101 01101100 01101100 01101111 | perl - lape ‘$_=pack“(B8)*”,@F’ OSI MODEL: PHYSICAL LAYER Lab 1 Basic Linux Operating System commands In this exercise you will be logging into the course virtual machine and executing some basic Linux Operating System commands. Learning how to navigate an operating system is an important practical skill for anyone whom desires to pursue a professional career in computer networking. Learning how to perform operating system tasks using the command line, as opposed to the graphical user interface (GUI) method, is important because most professional networking equipment is configured and managed using a command environment. Exercise 1 Coding data from ascii to binary In this lab task you will learn to code data using the Linux xxd command. If you read the xxd manual, it describes the xxd command as having the ability to create a “ hex dump of a given file or given input. It can also convert a hex dump back into its original binary form. ” To read more about the xxd command, type man xxp at the terminal command prompt. First, let’s start with a simple command to convert the letter “h” into binary. At the terminal command prompt, type the following command: The command in the example above converts the ascii character “h” to the binary 01101000. You can re - use the command above to convert other ascii characters to binary by just substituting the letter “h” with any other ascii character. From the above command, echo is the command to print a string to the standard output. The -n after echo is used so that there is no trailing newline. To learn more about the echo command, type man echo from the command prompt. Following the echo -n command is the “h”. This is the explicit ascii character that is being printed. Next is a pipe | character. The pipe character is used to delimit commands. The next command is the xxd -b . The -b commands xxd to switch the “h” ascii character to bits or binary digits. The -b option writes octets as eight digits. This is why you will see 8 zeros with a colon (:) followed by the 8-digit binary translation (or octet). The output of the above command should look like the following: Exercise 2 Coding data from binary to ascii It is useful to understand that network professionals often use scripting languages to work with data. A common scripting language available within Linux distributions is Perl. To learn more about Perl, type man perl from the terminal command prompt. Below is an example of a command that uses Perl script to code binary data to ascii characters. Now, type the following command: The output from the above command (displayed again below) should be the ascii characters “h e l l o”. echo 01101000 01100101 01101100 01101100 01101111 | perl -lape ‘$_=pack“(B8)*”,@F’
10 bdcuser@BDCVM:~$ ifstat First, the command starts with the echo command. As described in Exercise 1 above, the echo command is simply used to print a string to the standard output. Here, the echo command is followed by a series of 5 octets in binary. Next, the command presents the delimited pipe | to allow for the next command. The next command includes a Perl script. Notice that there is a -lape after the perl command. Anytime you use the dash after the perl command, this is called a command line argument. Therefore, -lape includes 4 separate command arguments executed in the order listed. For instance, the command argument -l would be executed before -a , and so forth. The command line argument for this Perl script, -lape , commands the script to basically read in the string generated from the echo command and loops through each character. Then it uses the pack function to convert the octet (groups of 8 characters) to an ascii character. Finally, the Perl script prints the output of the pack function to the screen. You can learn more about Perl’s pack function here: https://perldoc.perl.org/functions/pack.html Lab 2 Basic Linux Networking commands In this exercise you will be executing the ifstat command to report interface statistics on your device. Exercise 1 Display network interface statistics The Physical Layer of the OSI model sends data as signals over a physical medium. The ifstat utility is designed to report simple statistics from the interfaces connected to the physical medium. Execute the following command and wait about 5 seconds while it executes. Hit CNTRL C on your keyboard to stop the command: Your output should look something like this, but with more rows of data: enp0s3 KB/s in KB/s out 0.19 0.00 0.0 0.00 In the output from the ifstat command above, you can see the name of your interface first. In this case, the interface is labeled “ enp0s3 ”. Next, you will see two columns of data. One column lists the data moving in the interface at a rate in KB/s (Kilobytes per Second). The second column lists the data moving out of the interface at a rate in KB/s.
11 Virtual Lab Exercise 1 Code ASCII to Binary using Course Virtual Machine Review Exercise 1 in Lab 1 for the Physical Layer in the course Lab Manual. Retrieve the binary octets for your last name using the xxd command on your course virtual machine. Each letter of your last name should include an 8-digit binary translation. What is the binary translation of your last name? Why is it important to understand the translation of ASCII characters to Binary? Virtual Lab Exercise 2 Network Interface Statistics Review Exercise 1 in Lab 2 for the Physical Layer in the course Lab Manual. Collect 10 seconds of data using the ifstat command on our course virtual machine. What is the name of your interface? What is the fastest inteface in speed in KB/s? What is the fastest interface out speed in KB/s?
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
12 bdcuser@BDCVM:~$ cksum data.txt 2116921653 13 data.txt 1949538277 41 data.txt OSI MODEL: DATA-LINK LAYER Lab 1 Basic Linux Operating System commands When files are transferred or data is streamed over a network from a source to a destination, it is common for network professionals to verify the integrity of the data or file. Verifying the integrity of a file can be accomplished by conducting a Cyclic Redundancy Check (CRC) on the data. CRC can be accomplished using the Linux cksum command. To learn more about the cksum command, type cksum --help at the terminal command prompt. Exercise 1 Compute a Cyclic Redundancy Check (CRC) on a file Review Exercise 1 from Chapter 1 Lab 1. Navigate to a directory of your choice on the course virtual machine and create a text file called data.txt . Use nano to edit the file and add some data by typing “Hello World!”. Exit nano and save the file. Now, execute the following cksum command on the data.txt file: You should get output in the terminal similar the to the following after executing the above cksum command: In the above output, the cksum command is first displaying the checksum (CRC output), the second number is the number of bytes, and finally the name of the file is displayed. NOTE: Your output may be different from the output above. Based on the output above, the CRC is computed as 2116921653 with 13 bytes of data in the data.txt file. Now, use nano to edit the data.txt file. Add the following text to the file, “Making a change to the data”. Exit nano and save the changes to the data.txt file. Once you have done this, re-execute the cksum data.txt command. Your output should look similar to the following: ( NOTE: Your output may be different). Since the file has been edited, the CRC is computed by checksum with a different identity (1949538277). Additionally, you can see that the byte size of the data.txt file has increased from 13 bytes to 41 bytes. If a network professional was monitoring the integrity of a file being transferred from a source to a destination over a network connection, he or she would want to execute a checksum (CRC) on the file before the transmission and after the completion of the transfer. If the identity of the computed checksum is different when comparing before and after the transfer, then it is indicative that data may have been corrupted or altered in some way. Therefore, computing a CRC on a file or data is very important to network professionals when moving data over a network.
13 bdcuser@BDCVM:~$ xxd data.txt bdcuser@BDCVM:~$ xxd -b data.txt Exercise 2 Hex and Binary representation of files The Linux xxd command (as described in its documentation) can be used to perform a “ hex dump of a given file or standard input ”. Navigate to the directory you created the data.txt file in Exercise 1 of this Lab 1. You will first convert the contents of the data.txt file to hex. To do this, execute the following command: The output of the above xxd command will look similar to the following ( NOTE: Your output may have different hex values): In the above output, you can see the text “Hello World! Making a change to the data” on the right includes the content in the data.txt file. To the left of this text, you can see the hex values of this content. Also notice that there is a period (.) after “Hello World!” and after “Making a change to the data”. In this case, the period(.) is indicative of a next line feed. So, if you were to view the content of the data.txt file, it would look like this: Hello World! Making a change to the data Next, we can use the xxd command to produce binary from the data.txt . To do this, execute the following command: The output of the above xxd command will look similar to the following ( NOTE: Your output may have different binary values): The above output is similar to the previous output. The only difference is that the -b argument of the xxd command produced the binary values of the content included in the data.txt file.
14 bdcuser@BDCVM:~$ ip address Lab 2 Basic Linux Networking commands In this exercise you will be logging into the course virtual machine and executing some basic Linux ip utility commands. Linux has a built-in utility called ip that can be used to display network information. It is important for a network professional to understand how to view network information using command- line utilities because many network devices require this type of interface. To view the Linux manual for the ip utility you will need to type the command man ip . Exercise 1 Understanding network interfaces From the terminal command prompt, type the following ip command from any directory: The output of the ip address (can also be typed as ip a or ip addr ) will be a list all your local interfaces. Here is a sample of the output from a laptop using the ip address command: In the above output, there are two interfaces viewable. 1 is labeled as lo and 2 is labeled enp0s3 . The lo interface has an IP address of 127.0.0.1. This is also known as the loopback address. The loopback address is a reserved IP address that is used to locally test communication on your local device. The IP address has no physical connection to your device or local network and is simply used for testing purposes only. The enp0s3 interface displays the local network connection with the IP address 192.168.1.103 NOTE: Please be sure that your virtual machine is setup based on the instructions provided with the Lab Manual. Within VirtualBox, your virtual machine must have the Network Setting for Adapter 1 set (checked) to “Enable Network Adapter”. Additionally, the “Attached to:” field for Adapter 1 should be set to “Bridged Adapter”. Having a “Bridged Adapter” allows you to connect to the Internet through your local network interface which is running your virtual machine. Your local network interface would be a wireless or ethernet connection on your local laptop or PC.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
15 Virtual Lab Exercise Compute a Cyclic Redundancy Check (CRC) on a file Review Exercise 1 in Lab 1 for the Data Link Layer in the course Lab Manual. Complete the following steps: 1. Create a text file called mymessage.txt ”. 2. Open the file using nano and edit the file with the following text, “Learning how to compute a Cyclic Redundancy Check on a file” 3. Now, exit nano and save the file. 4. Use the cksum command to compute a Cyclic Redundancy Check on the mymessage.txt file What output did you get from this command? Explain each part of the output. Next, complete the following steps: 1. Re-open the mymessage.txt file in nano and edit the file with by typing your First and Last name on the next row. 2. Exit nano and save the file. 3. Use the cksum command to compute a Cyclic Redundancy Check on the mymessage.txt file What output did you get from this command? What was the difference in the output of this command versus the first time you executed the command? Why do you think it is important for a network professional to know how to conduct a Cyclic Redundancy Check on a file?
16 bdcuser@BDCVM:~$ echo “obase=2;133” | bc 10000101 bdcuser@BDCVM:~$ echo “ibase=2;10000101” | bc 133 OSI MODEL: NETWORK LAYER Lab 1 Basic Linux Operating System commands It is a common skill for network professionals to use tools in Linux which can perform various precision tasks on numbers. For instance, a common precision task would be to convert an integer base to binary base or binary base to an integer base. According to the documentation, bc is “a language that supports arbitrary precision numbers with interactive execution of statements ”. You can learn more about bc by typing man bc at the terminal command prompt. Exercise 1 Convert bases to other bases using bc To convert the integer 133 to binary using bc , execute the following command: You should get output in the terminal similar the to the following after executing the above bc command: To convert the binary 10000101 to an integer using bc, execute the following command: You should get output in the terminal similar to the following after executing the above bc command:
17 Lab 2 Basic Linux Networking commands In this Lab you will be logging into the course virtual machine and executing some basic Linux tcpdump commands. According to the documentation, the tcpdump tool is a command-line packet analyzer that can “ print out a description of the contents of packets on a network interface ”. To learn more about tcpdump , you can type man tcpdump at the terminal command prompt or visit the project website at https://www.tcpdump.org/ . It is important for a network professional to understand how to view the contents of packet information on a network interface using command-line utilities because many network devices require this type of interface. Exercise 1 Capture IP packets using a host filter To complete this exercise, you will need to complete the following steps 1. Start and login to your course virtual machine 2. Get the IP address of your local virtual machine 3. Use a remote client to ssh into your local virtual machine 4. Execute a tcpdump command The following is a summary on how to complete the above steps. STEP 1: Start and login to your course virtual machine Start-up your virtual machine and login with the bdcuser account as you’ve done in previous labs. STEP 2: Get the IP address of your local virtual machine To acquire the IP address of your local virtual machine, use the ip address command as instructed in Chapter 3 Lab 2 Exercise 1. For example, my local virtual machine IP address is: 192.168.0.7 STEP 3: Use a remote client to ssh into your local virtual machine If you are using the Windows Operating System on your local laptop/PC, you will need to download and install a free client application called PuTTY from here: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html If you are using Mac OS X, you can use your local terminal as instructed by Apple here: https://support.apple.com/guide/terminal/connect-to-servers-trml1018/mac Once you have downloaded PuTTY or open a terminal on your Mac, you will need to connect using ssh with the client. For instance, in PuTTY your connection will look like this:
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
18 bdcuser@BDCVM:~$ ping 8.8.8.8 bdcuser@BDCVM:~$ sudo tcpdump -i any -c5 -nn host dns.google Notice in the screen shot of PuTTY above that the Port is set to 22. This is the common port used for ssh . After clicking Open you will be prompted to enter your username and password. Use the same username (bdcuser) and password you typically use to login to your course virtual machine. STEP 4: Execute a tcpdump command Once you have logged into your remote session using either PuTTY or the Mac Terminal app, you will need to execute the ping command so that your virtual machine can capture requests and replies from IP packets that are related to a specific host. From the PuTTY or Mac Terminal app connection client, type the following command (8.8.8.8 is the IP address assigned to Google’s primary DNS (Domain Name System) server for Google DNS): Once you have typed in the above ping command in the PuTTY or Mac Terminal app connection client, you will see a continuous output similar to the following: Allow this continuous ping to continue without interruption. Minimize the PuTTY or Mac Terminal app and return to your course virtual machine (launched by VirtualBox). From the virtual machine terminal command prompt, type the following tcpdump command from any directory (add your bdcuser username and password when prompted to):
19 The output from this tcpdump command should produce output similar to the following: Once your tcpdump is complete, you will need to click ( NOTE: make sure it is clicked on ) back on to the PuTTY or Mac Terminal app connection client to stop the ping process. To stop the ping process, simply type CNTRL +C (Control and C at the same time) on your keyboard. In the above tcpdump output, you can see that it has captured 5 packets of data. The filter in the tcpdump command will capture any 5 packets ( -c5 ) from any port ( -nn ) that includes the host dns.google . Since we are pinging 8.8.8.8, tcpdump can detect the packet requests and replies from Google’s DNS server or host. Each packet captured includes the datagram timestamp, source IP address, destination IP address, protocol, information from the protocol, the id identifying the fragmented part of the datagram, the sequence number, and the packet length. For instance: 00:00:08.458155 IP 192.168.1.103 > 8.8.8.8: ICMP echo request, id 862, seq 39, length 64 Can be interpreted as: 00:00:08.458155 = the datagram timestamp IP = Internet Protocol 192.168.1.103 = Source IP address (local PC/Laptop) 8.8.8.8 = Destination IP address (Google’s DNS Server host) ICMP = Internet Control Message Protocol echo request = ICMP information id 862 = the id of the fragmented part of the datagram seq 39 = the sequence number length 64 = the length of the packet
20 Virtual Lab Exercise Convert bases to other bases Review Exercise 1 in Lab 1 for Network Layer in the course Lab Manual. Complete all of the following using the bc language: 1. Convert your age to binary 2. Now, take your converted binary age and covert it back into an integer 3. Get the local IP address of your course virtual machine using the ip address command. Now, convert it to binary. For instance, if your IP address is 8.8.8.8 then the binary translation would be 00001000000010000000100000001000. Recall that IP addresses are 32-bit (8 bits x 4 sets) binary addresses. So, 8.8.8.8 in 32-bit binary would include 4 sets of 00001000.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
21 bdcuser@BDCVM:~$ ss -s bdcuser@BDCVM:~$ ss -l > ss_output.txt OSI MODEL: TRANSPORT LAYER Lab 1 Basic Linux Operating System commands The Linux Operating system includes the ss command which allows network professionals to quickly display socket statistics in an easily readable format. You can access the ss utility by typing man ss at the terminal command prompt. The ss manual describes the utility as having the ability to investigate sockets by dumping statistics that are similar to the output of netstat . However, ss can display more TCP and state information than other tools . Exercise 1 Explore the ss utility Try some of the following commands from any directory to explore the ss utilityman: The ss -s command prints the summary statistics of all current sockets. Here is an example of the summary output: In the output above, “RAW” shows all sockets that could send or receive IP packets without UDP or TCP formatting. Next, the output shows “TCP” and “UDP” sockets followed by “INET”. “INET” includes both IP (IPV4) and IPV6. Finally, the summary statistics show “FRAG” or fragmented. Now that you can see that there are UDP and TCP sockets on your virtual machine, you can display only listening sockets and identify which ones are labeled UDP and TCP. The command used to output this information can get quite lengthy. Therefore, it is easier to output the data from the command to a text file. To do this, first navigate to a directory on your virtual machine where you want to save the data output to a text file. Execute the following command. ( NOTE: wait about 30 seconds for the command to run before trying to view the output of the command.) After waiting for about 30 seconds or so, you can open the output with nano using the following command: nano ss_output.txt While in nano , scroll up and down the text file (using your up and down arrow keys on the keyboard) and locate the TCP and UDP sockets under the “ Netid ” column. Here’s an example of what you may find:
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
22 In the above output, you can see in the first entry next to “ udp ” th at there is a local IP address 0.0.0.0 socket to “ bootpc ”. First, 0.0.0.0 is used by operating systems as a non -routable meta-address to designate an invalid, unknown, or non- applicable target. “ bootpc ” is the bootp (or Bootstrap) client used on Port 68 by client machines to obtain dynamic IP addressing information from a DHCP server. Another notable piece of information here is under the State column where the State status is UNCONN or unconnected. In contrast to the udp entry, there are two tcp entries in the output that show and active socket with the “State” LISTEN (or listening) from 0.0.0.0 on the port for “ ssh ”. “ ssh ” is Secure Shell which is used on port 22. Additionally, you can observe that 128 bytes have been queued for transmit (Send-Q) through this socket. They have not been acknowledged by a remote host. Continue to scroll up and down the ss_output.txt file while observing more socket statistical data. Now, look though the ss manual and try to query other types of socket information using the ss command.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
23 bdcuser@BDCVM:~$ nc -l -p 12345 Lab 2 Basic Linux Networking commands In this Lab you will be using the netcat ( nc ) utility to start listening on a specific port within your course virtual machine. The netcat utility is used to read and write data across network connections using the TCP or UDP protocol. To learn more about the netcat utility, execute man nc at the terminal command prompt. Once the nc utility creates the socket (IP + Port), we will transfer data using the client/server model. Exercise 1 Using the client/server model to demonstrate the use of a socket To complete this exercise, you will need to complete the following steps 1. Start and login to your course virtual machine 2. Get the IP address of your local virtual machine 3. Execute a nc command to simulate a server on a specific port 4. Use a telnet client to telnet into your local virtual machine and transfer data The following is a summary on how to complete the above steps. STEP 1: Start and login to your course virtual machine Start-up your virtual machine and login with the bdcuser account as you’ve done in previous labs. STEP 2: Get the IP address of your local virtual machine To acquire the IP address of your local virtual machine, use the ip address command as instructed in Chapter 3 Lab 2 Exercise 1. For example, my local virtual machine IP address is: 192.168.0.7 STEP 3: Use netcat to start listening on a specific port From your course virtual machine terminal command prompt, type the following command: ( NOTE : After typing this command and pushing the “Enter” or “Return” key on your keyboard, you will not see any additional output. Do not type anything else. Just wait) From the command above: nc starts netcat . The -l starts netcat in “listen” mode for input connects. The -p specifies the port to listen on. In this case, netcat will be listening on port 12345. Therefore, you have effectively created a socket with your local IP address and port 12345. STEP 4: Use Telnet to connect to the netcat session and transfer data. From your local host (ie. the host running your course virtual machine - Windows or Mac OS X), you will need to make sure that you have telnet installed. For Microsoft Windows 10, visit this Microsoft TechNet article to make sure that you have telnet setup: https://social.technet.microsoft.com/wiki/contents/articles/38433.windows-10-enabling-telnet-client.aspx For Mac OS X , visit this Terminal Users Guide article to make sure you have a telnet session setup: https://support.apple.com/guide/terminal/connect-to-servers-trml1018/mac
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
24 C:\Users\Clinton>telnet 192.168.0.7 12345 bdcuser@BDCVM:~$ nc -l -p 12345 > get_data.txt Once you have telnet setup on your host Operating System, telnet into the course virtual machine IP. Here is what the Microsoft Windows command will look like if you course virtual machine IP address is 192.168.0.7: ( NOTE: Once you execute the following telnet command your command Window will just have a blinking cursor) Now, put both connections one on top of each other so that you can see your course virtual machine on top and your Telnet connection immediately below (See below screenshot). Click on the Telnet connection and start typing any message. For instance, in the screen shot below I’m typing: “this is a test of the netcat tool”. Notice, that as you type in the Telnet session from your local host environment that the text is simultaneously typing into the terminal of the netcat session within your course virtual machine. To stop the data transfer process, click back on your course virtual machine and type “CNTRL C” (Control c) to stop the nc session. This will also kill your Telnet connection. Exercise 2 Using the client/server model to capture data transferred from client to server Repeat Steps 1 and 2 in Exercise 1 above. For Step 3, navigate to a directory on your course virtual machine where you can capture data and save it to a text file called get_data.txt ”. Execute the following command on your course virtual machine: After you have executed the above command, repeat Step 4 from Exercise 1 above. This time, as you are typing in the Telnet session on your local host the data will not be displayed in the course virtual machine terminal windows. Instead, the data you are typing will be transferred to a file on the course virtual machine titled, “ get_data.txt ”. Once you have typed some text from your Telnet connection, wait a couple of seconds for the data to transfer then go ahead and cancel the netcat session by hitting “ CNTRL C ” (Control c) on your keyboard. Now your netcat session is cancelled on your course virtual machine and your Telnet session has been cancelled on your local host.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
25 To view the data transferred, navigate to the directory on your course virtual machine where you created the “ get_data.txt ”. This will be the director where you executed the nc command from. Open the get_data.txt ” file using nano and review the data. ** NOTE: It is important to know that it is generally unsafe to create a session using a random port that will accept any connections (such as the one we created using the netcat utility in this lab). It is also generally unsafe to use Telnet on an open network connection because text can be intercepted with no secure transfer. This lab is a good learning experience and clearly demonstrates the cyber security risks involved when using unencrypted open data transfer on open connections.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
26 Virtual Lab Exercise Demonstrate the use of a socket to transfer data Review Labs 1 and 2 for Transport Layer in the course Lab Manual. Complete all of the following using the netcat utility: 1. Start a netcat session on your course virtual machine by socketing the ip address to port 12356. Make sure that you execute the nc command so that it saves the data in a text file called transport-layer-lab.txt 2. Now, open a Telnet session on your local Microsoft Windows or Mac OS X host. 3. Telnet into your course virtual machine netcat session. 4. Type the following in your Telnet session, Applications can use network connections to send data over the network using a socket. Answer the following questions: Explain how data is being transferred to the text file on the course virtual machine using the Telnet connection. What business applications can be applied to use this type of data transfer?
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
27 bdcuser@BDCVM:~$ cd /var/www/html bdcuser@BDCVM:/var/www/html$ ls -l -rw-r--r-- 1 root root 10701 Jan 20 21:35 index.html OSI MODEL: APPLICATION LAYER Lab 1 Basic Linux Operating System commands It is a common task for network professionals to execute permission commands on files within the Linux operating system. For instance, a network professional could manage the .html files stored within a web server directory of a public facing website. In this case, the public users should have read-only privileges to the .html files serviced by the web server. Exercise 1 Understand Linux file permissions View the permissions of a restricted directory managed by the Apache web server. First navigate to the web server directory by typing the following at the terminal command prompt: The /var/www/html directory is the root directory used by the Apache web server installed on your course virtual machine. Users will be accessing this directory when attempting to view web pages served by the web server. Therefore, any file which resides in this directory should be restricted. To view the files and their restrictions within this directory, type the following command: The ls command lists the contents of a directory or directories. You can learn more about the ls command by typing man ls from the terminal command prompt. The -l argument listed after the ls command is used for a long listing format which lists the permissions for all files in the directory. For instance, take a look at the following sample output of the ls -l command from the /var/www/html directory: In the output above, the following can be explained: The first dash (- ) means that this is a file. If it were a “d” instead of a dash ( -), then it would be a directory. Next you will see the permissions divided into three distinct sections. Each section has three possible entries. To simplify this explanation, after the first dash (- ) or “d” the command lists three sections in the following format: 1 st section: --- followed by 2 nd section: --- followed by 3 rd section: --- So, in the 1 st section above the permissions are set as: rw- The 1 st section is used to reserve read ( r ), write ( w ), and execute ( e ) permissions for the file owner. So, in this case the file owner has read ( r ) and write ( w ) permission. In the second section above, the permissions are set as: r-- The 2 nd section is used to reserve read ( r ), write ( w ), and execute ( e ) permissions for the group owner of the file. Groups can be used by operating systems to store multiple users so that groups of users can perform the same operations. In this case the group owner of the file has read ( r ) permissions.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
28 bdcuser@BDCVM:/var/www/html$ sudo touch test.txt In the third section above, the permissions are set as: r-- The 3 rd section is used to reserve read ( r ), write ( w ), and execute ( e ) permissions for all other users of the file. All other users of the file within this directory would be those users who are accessing the web pages served by Apache web server. Here, all other users have read ( r ) permissions. If all users did not have read ( r ) permissions to the web pages, they would not be able to view the web site. Following the three sections of file permissions you see the number one ( 1 ) listed. The number one ( 1 ) indicates the number of hard links associated with a file or directory. Hard links are created by operating systems so that a directory entry can be associated with the name of the file which is stored on the file system. Immediately after the hard link count includes the entry: root root The first root listed indicates the owner of the file. In this case, the owner of the file is the root user. A root user has full administrative control of the operating system. In previous labs, you have executed root user commands using the sudo command. The second root listed indicates the group the file is owned by. In this case, the group owner of the file is root . Next, following the root root entry, is the size of the file listed in bytes. In this case, the size of the file is 10701 bytes. The last two entries listed in the ls -l command above include the last-modified date and the name of the file. The output above indicates that the last-modified date of the file named index.html is Jan 20 21:35 . This date/time format ( Mmm dd HH:MM ) translates to January 20 th at 21:35 (or 9:35 PM). Exercise 2 Change Linux file permissions The chmod (change file mode bits) command can be used to change the permissions of a file on the Linux operating system. You can learn more about the chmod command by typing man chmod from the terminal command prompt within your course virtual machine. Additionally, you can learn more about the chmod command or other means of changing Linux file permissions here: https://wiki.debian.org/Permissions Explore the chmod command by completing the following steps: 1. Create a test.txt file in the /var/www/html directory 2. View the permissions of the newly created test.txt file 3. Change the test.txt file permissions 4. View the recently changed test.text file permissions 5. Delete the test.txt file To begin with Step 1, navigate to the /var/www/html directory on your course virtual machine. Again, this is restricted directory managed by the Apache web server. Therefore, you will need to execute all chmod commands as root using sudo . Create the test.txt file using the following command: ( NOTE: You will be prompted to enter your bdcuser password)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
29 bdcuser@BDCVM:/var/www/html$ ls -l -rw-r--r-- 1 root root 0 Jan 21 11:38 test.txt bdcuser@BDCVM:/var/www/html$ sudo chmod 664 test.txt -rw-rw-r-- 1 root root 0 Jan 21 11:38 test.txt Recall from previous labs that the touch command is used within Linux to create files. After creating the file, you can verify that it exists by typing the ls command. Upon completion of the ls command, you should see the “ test.txt ” file listed. In Step 2, you need to view the permissions of the newly created test.txt file. To do this, execute the following command: Notice that the permissions of the newly created test.txt file are the same as the index.html file: ( NOTE : Your last-modified date will be different than the one listed in my example here) Since this is a web server directory, it is common for several web developers to have -rw permissions to the web files. Therefore, we want to change the root group permissions of this file to -rw . This would allow for the network manager to add web developers to the root group so that the group would have elevated privileges on all the files or directories using the root group permissions. To complete Step 3 and change the permissions of this “ test.txt ” file, type the following command: In the command above, you are using chmod to change the files root group permissions to read/write ( - rw ) using the number 6 in the second position of the file permissions. Permissions are specified using the chmod command using the octal numeral system (or base-8 number system). Recall from Exercise 1 in this lab that permissions are set in three distinct sections. Therefore, the command chmod 664 is setting three different numbers for the three distinct permission sections (file owner, file owner group, all others). To understand which numeral to use when setting permissions for each section, review the key below. For instance, the numeral 6 sets the permissions to read/write. So, chmod 664 sets the permissions of the file to: rw-rw-r-- Use the following key to understand permission assignments: 7 = read/write/execute 6 = read/write 5 = read/execute 4 = read 3 = write/execute 2 = write 1 = execute To confirm the recently changed permission of the “ test.txt ” file and complete Step 4, type the ls -l command. Notice that the output of the ls -l command now shows the permissions of the test.txt file as follows:
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
30 bdcuser@BDCVM:/var/www/html$ sudo rm test.txt Finally, to complete Step 5 you need to delete the “ test.txt ” file. To do this, you will need to use the rm command. The rm command is used within Linux to remove files or directories. To learn more about the rm command, type man rm at the terminal command prompt. Complete Step 5 of this exercise by typing the following command: Once you have completed this command, the test.txt file will be removed from the /var/www/html directory. You can confirm that the file has been removed by typing the ls command at the terminal command prompt.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
31 bdcuser@BDCVM:~$ cd /var/www/html bdcuser@BDCVM:/var/www/html$ sudo touch test.html Lab 2 Basic Linux Networking commands It is a common task for network professionals to start and stop application services so that they are available for users in a networked environment. In this Lab you will be creating an html web page in the /var/www/html directory of your course virtual machine. Once you have created the web page you will start the Apache web server and view the web page on your local host PC/laptop using an internet browser. Exercise 1 Understanding web-based applications To complete this exercise, you will need to complete the following steps 5. Start and login to your course virtual machine 6. Get the IP address of your local virtual machine 7. Create an html page in the /var/www/html directory 8. Start Apache web server and view your web page from your local host PC/laptop The following is a summary on how to complete the above steps. STEP 1: Start and login to your course virtual machine Start-up your virtual machine and login with the bdcuser account as you’ve done in previous labs. STEP 2: Get the IP address of your local virtual machine To acquire the IP address of your local virtual machine, use the ip address command as instructed in Chapter 3 Lab 2 Exercise 1. For example, my local virtual machine IP address is: 192.168.0.7 STEP 3: Create an html page in the /var/www/html directory Navigate to the /var/www/html directory by typing the following command at the terminal command prompt: Now that you are in the /var/www/html directory, execute the ls command so that you can view the files within the directory. Unless you’ve previously created other files, you should only see the index.html file that was added by default from the Apache web server install. Next, you will be creating an html file called “test.html”. To create this file type the following command: After executing the above command and entering the bdcuser credentials, type the ls command to confirm that your “ test.html ” file has been created.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
32 bdcuser@BDCVM:/var/www/html$ sudo nano test.html <!DOCTYPE html> <html> <head> <title>Learning the Application Layer</title> </head> <body> <h1>My name is and this is my web page.</h1> <p>Web applications can be implemented using Apache web server.</p> </body> </html> bdcuser@BDCVM:/var/www/html$ sudo systemctl start apache2 Use nano to open the test.html file using the following command: Type and save the following html code: In the html code above, be sure to substitute the “My name is …” with your name. Upon completing the above html code, be sure to save the file and exit nano . STEP 4: Start Apache web server and view your web page from your local host PC/laptop. Type the following command to start the Apache web server: After typing the start command, you will not see anything at the command prompt. But, your Apache web server should be running. To view your web pages in the Apache web server open any web browser on your local PC/laptop. Upon opening your local web browser, navigate to the following URL: http://YourCourseVirtualMachineIPAddress My course virtual machine IP address (known from STEP 2 above) is 192.168.0.7. So, I had to type the following URL in my browser: http://192.168.0.7 This URL will display the index.html page within the /var/www/html directory of your course virtual machine. The web page will look like this:
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
33 bdcuser@BDCVM:/var/www/html$ sudo systemctl stop apache2 To access your “test.html” web page type the following URL: http://YourCourseVirtualMachineIPAddress/test.html My course virtual machine IP address (known from STEP 2 above) is 192.168.0.7. So, I had to type the following URL in my browser: http://192.168.0.7/test.html This URL will display the test.html page within the /var/www/html directory of your course virtual machine. The web page will look like this: To stop the Apache web server, type the following command in your course virtual machine: Once you stop the Apache web server with the stop command, your web pages will not be available.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
34 Virtual Lab Exercise Explore a web application server Review Labs 1 and 2 for Application Layer in the course Lab Manual. Complete the following: 1. Build a web page with the filename “application - layer.html” within your course virtual machine /var/www/html directory using nano . 2. The content of your web page should describe what you know about the Application Layer of the OSI model. 3. Start the Apache web server on your course virtual machine. 4. View your web page using a browser on your local Laptop/PC Answer the following question: Explain in detail what makes it possible for your web page to be viewed from a browser on your local laptop/PC?
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help