Lab - 2: Internet Protocol and Subnets¶

Objectives¶

The lab is on observations of:

  • IP packet format

  • Check the IP address and MAC address of interfaces

  • Learn about the tool, ping , that is on IP connectivity

Load Lab Network¶

Use File \longrightarrow New \longrightarrow Notebook to open a new notebook.

The labs are conducted using the University of Houston Education python libraries. Load these libraries by executing the following code in the first cell of your lab notebook:

You can now proceed with loading of the lab modules for this class:

Select your lab topology from the dropdown menu and then load by clicking the Build Network button.

In order to conduct this lab, please select IP Subnets in the labpicker dropdowm menu and then click on the Build Network button.

Topology Orientation¶

_images/subnetsARPTopo.png

Lab Network Topology

Attention

Each time you make a reservation, the hosts will be numbered in a random manner.

Observation Plan and Environment¶

  1. Open a terminal for each host, ssh into the hosts to identify their interfaces.

  2. Examine the subnets provided to you for the lab. Allocate two addresses from each subnet to be assigned to two of your host interfaces in each subnet.

  3. Assign the IP addresses to your host interfaces in your lab notebook:

                                                NET                      [                      <                      hostlabel                      >                      ]                      .                      setIPv4Address                      (                      <                      interfacename                      >                      ,                      <                      IPaddress                      >                      )                    
  4. Verify the IP address of the interface of the host by looking at the output of the command:

  5. Send packets using ipsend tool as explained below and monitor the packets using the tcpdump tool at sending and/or receiving hosts.

  6. Send an ICMP echo request packet using the ping tool to each IP address of the hosts to observe the IP connectivity.

Example IP Address Allocation and Assignment¶

Retrieve the subnets you have been assigned for this lab. Use the command below:

to display the subnets allocated to your lab.

_images/ipsubnetsSubnetData.png

For example, if the two subnets are 34.137.48.0/22 and 159.43.24.0/23 , the range of IP addresses that are available to assign to a network interface from each subnet are:

                                        34.137                    .                    48.0                    /                    22                    :                    34.137                    .                    48.1                    -                    34.137                    .                    51.254                    159.43                    .                    30.0                    /                    23                    :                    159.43                    .                    30.1                    -                    159.43                    .                    31.254                  

Attention

The first (min) and last (max) value in these ranges are reserved and not assigned to host interfaces.

The subnet address in each case is:

  1. Subnet address: 34.137.48.0/22

  2. Subnet address: 159.43.30.0/23

Tip

Finding the Range of IP Addresses in a Subnet

Use the tool netmask to display the range of IP addresses that are available in a given subnet on your lab notebook. Execute:

                      !netmask -r <subnetaddress>                    

Where <subnetaddress> is in the form of A.B.C.D/N. For example:

_images/netmasksubnetexample.png

Let's pick the following assignments to the following host interfaces in this topology:

                                        host03                    .                    eth1                    :                    159.43                    .                    30.12                    /                    23                    host12                    .                    eth1                    :                    159.43                    .                    31.38                    /                    23                    host34                    .                    eth1                    :                    34.137                    .                    51.250                    /                    22                    host35                    .                    eth1                    :                    34.137                    .                    51.149                    /                    22                  

In order to assign these IP addresses, use the notebook commands. For example, the host03 assignment will be:

                                        NET                    [                    "host03"                    ]                    .                    setIPv4Address                    (                    "eth1"                    ,                    "159.43.30.12/23"                    )                  

_images/setInterfaceIP.png

Note

When using the command, NET[<hostlabel>].setIPv4Address(<interfacename>, <IPaddress>) , the <hostlabel> refers to the label or name you see in the network topology for that host node, like host03 . The <interfacename> refers to the network interface of the host, typically eth1 . Finally, the <IPaddress> in the command refers to the IP address to be assigned to the host interface in the format A.B.C.D/N where N refers to the subnet prefix length.

Network Interfaces: Set & Verify IP Addresses¶

Lab Task

Please run the command NET.showInterfaces() in your lab notebook to display the node interfaces and their addresses:

An example view from a lab notebook with interface IP and MAC addresses:

_images/lab2showintf.png

Please note that you can identify the MAC and IP address at the eth1 interface.

Assign an IP address to a host interface using the command to set an IPv4 address: NET[<hostlabel>].setIPv4Address(<interfacename>, <IPaddress>) .

_images/setInterfaceIP.png

Please retrieve the interface information for your topology again to verify that the assigned IP address is now showing up in the displayed table.

_images/verifyInterfaceIP.png

You can also login to the hosts in your topology to examine the interface addresses using the command ip addr . For example, in a reservation, here is the output we have recorded for the command ip addr :

                                        /                    # ip addr                    1                    :                    lo                    :                    <                    LOOPBACK                    ,                    UP                    ,                    LOWER_UP                    >                    mtu                    65536                    qdisc                    noqueue                    state                    UNKNOWN                    qlen                    1000                    link                    /                    loopback                    00                    :                    00                    :                    00                    :                    00                    :                    00                    :                    00                    brd                    00                    :                    00                    :                    00                    :                    00                    :                    00                    :                    00                    inet                    127.0                    .                    0.1                    /                    8                    scope                    host                    lo                    valid_lft                    forever                    preferred_lft                    forever                    7304                    :                    eth1                    @if7303                    :                    <                    BROADCAST                    ,                    MULTICAST                    ,                    UP                    ,                    LOWER_UP                    ,                    M                    -                    DOWN                    >                    mtu                    1500                    qdisc                    netem                    state                    UP                    qlen                    1000                    link                    /                    ether                    ae                    :                    27                    :                    6                    f                    :                    90                    :                    bc                    :                    41                    brd                    ff                    :                    ff                    :                    ff                    :                    ff                    :                    ff                    :                    ff                    inet                    34.137                    .                    51.250                    /                    22                    scope                    global                    eth1                    valid_lft                    forever                    preferred_lft                    forever                    /                    #                  

In this case, the IP address of the host eth1 interface is 34.137.51.250 with a prefix length of 22 for its subnet. The MAC address of host interface eth1 is ae:27:6f:90:bc:41 .

The host interface information (all host interfaces are called eth1 ) is tabulated below:

hostname

Interface MAC

Interface IP

host03

5e:29:5a:ab:25:b3

159.43.30.12/23

host12

be:01:38:0a:95:43

159.43.31.38/23

host34

ae:27:6f:90:bc:41

34.137.51.250/22

host35

26:7c:15:8b:ad:e7

34.137.51.149/22

Attention

Please repeat the process of identifying subnets, allocating IP addresses to host interfaces and then assigning them to those interfaces for your network now.

Learning Activities¶

Step 1

Use the provided subnets to allocate and then assign IP addresses to your host interfaces. Verify your address assignments using the output of NET.showInterfaces() output in your notebook.

Step 2

Use the command line tool called ping to send echo request packets to check their IP connectivity status.

2a. ssh into hosts in the topology and use ping at the command line to send an ICMP echo request within the subnet of the sending host.

2b. ssh into the same host where you are using the command ping to also monitor the packets being sent and received by the host, monitor packets using tcpdump using the command below:

                                        tcpdump                    -                    i                    eth1                    -                    Ane                    not                    ether                    dst                    01                    :                    80                    :                    c2                    :                    00                    :                    00                    :                    00                    and                    not                    ether                    proto                    0x86DD                  

2c. Observations:

  • Which hosts are connected at layer 3?

  • How does subnet addressing relate to layer 3 connectivity?

Step 3 – Lab2 Homework

In your lab notebook, run:

in a cell and complete the submission.