CS2 Computational Thinking for Scientists - Lab 07

CS2 Computational Thinking for Scientists - Lab 07

In this lab, we will learn about the fundamentals of networking, particularly the creation and delivery of IP (Internet Protocol) packets.

IP address

An Internet Protocol address (IP address) is a numerical label assigned to each device (e.g., computer, printer) participating in a computer network that uses the Internet Protocol for communication. In the first experiment, you will learn how to get the IP address of your own computer, and the IP address of othe web servers.

Three Ways to Get the IP Address

  1. By using browser: Open the browser (Firefox, Google Chrome, ...) and type in "IP address", then the IP address is shown.

  2. By looking at the Network information in local computer system setting (e.g., System Preferences in MacOS).

  3. By using Linux command in Terminal: open the terminal, type in the command "ifconfig" and then information will be shown as follows:

    Here, lo0, gif0, en0, en1 are the names of the active network interfaces on the system. en* are the wireless connections. Also, we need to know that eth* or em* are the LAN connections (the ethernet interfaces). In this example, the information of IP address in shown in en0 and the IP address is

IP Address and Domain Name

As we have already seen, IP address is a long string of numbers and is not easy to be memorized. Is there any other way to represent each website? The answer is obviously yes, because every time when we open Google, we don't type in the IP address of Google into the browser but simply "www.google.com". For convenience, we use domain name to get the website. Generally, a domain name is an identification string that defines a realm of administrative autonomy, authority or control within the Internet. Domain names are formed by the rules and procedures of the Domain Name System (DNS). Any name registered in the DNS is a domain name like "www.google.com" and "www.cs.ucsb.edu". At the same time, there is a relationship between the IP address and domain name.

In the second experiment, we will learn to get the IP address of the website we want to reach and whether we can connect to that website. We use the Linux command "ping". The usage is:

ping www.example.com

For example,

First we can get the IP address of www.google.com, which is Second, for the ping command, it will send Internet Control Message Protocol (ICMP) Echo Request messages to the destination computer every second (by default) and waiting for a response. The received response means the connection is OK.


Next, we want to know the route of packet transfer. We use the Linux command "traceroute". In computing, traceroute is a computer network diagnostic tool for displaying the route (path) and measuring transit delays of packets across an Internet Protocol (IP) network. The usage is:
traceroute www.example.com

IP packet

We will use a program called Wireshark, which is a free and open-source packet analyzer. It is used for network troubleshooting, analysis, software and communications protocol development,

Download (right click/save as) this file: example.pcapng, and load it into Wireshark. This file is part of packet information transfered on my computer. It contains:

  • Source, Destination IP address
  • Protocol
  • Packet Length
  • Detailed information of Internet Protocol
  • Deatiled information of Transmission Control Protocol
  • ...
Also, from this file we can see more information about data transfer. We will see the shake-hand connection setups for TCP, and how data will be chunked into small packets during transfer.

Report: Briefly describe each action you have performed and write the commands, and write (or copy/paste) the results into a file. Submit your report by email.

The lab report (if required) is due 5pm, Friday Mar 6.