0% found this document useful (0 votes)
18 views13 pages

Chapter 4 Exercises and Solutions

The document contains exercises and solutions related to the IP layer of computer networks, focusing on topics such as flow control, IP addressing, subnetting, and packet fragmentation. It includes detailed explanations and calculations for various scenarios involving IPv4 addresses, subnet masks, and network configurations. The exercises are designed for students in a computer networks course at Holy Spirit University of Kaslik.

Uploaded by

hadytarabay12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views13 pages

Chapter 4 Exercises and Solutions

The document contains exercises and solutions related to the IP layer of computer networks, focusing on topics such as flow control, IP addressing, subnetting, and packet fragmentation. It includes detailed explanations and calculations for various scenarios involving IPv4 addresses, subnet masks, and network configurations. The exercises are designed for students in a computer networks course at Holy Spirit University of Kaslik.

Uploaded by

hadytarabay12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

CSC 420 - Computer Networks

Chapter 4
IP Layer

Exercises/Solutions

Holy Spirit University of Kaslik (USEK) - Faculty of Arts and Sciences - Department of CS & IT
CSC 420 - Computer Networks
Dr. Jacques Demerjian
Exercise 1: Flow control is used by the logical link layer and by the network layer.
Explain the difference between these two functions. Why is it important to have the flow
control on these two levels? Explain the difference between those two methods.

On the logical link layer the flow control is between two entities on the same physical
link, while the network layer flow control is between the two entities at both ends of the
virtual circuit.

Besides the sliding window mechanism, the network layer use commands to stop and
restart the packet transmission.

Exercise 2: Why an IPv4 address is associated with an interface and not a machine?

The first part of the address indicates the network; if we move the machine in another
network the IP address will change.

Holy Spirit University of Kaslik (USEK) - Faculty of Arts and Sciences - Department of CS & IT
CSC 420 - Computer Networks
Dr. Jacques Demerjian
Exercise 3: Assume the Network Interface Card (NIC) has reserved for you the network
address 132.207.0.0 and that your corporation has six branches to which you should
assign a subnet address.

a) What is your network address in binary?

1000 0100.1100 1111.0000 000.000 0000


b) What is your class?

The class of 132.207 is B

c) The sub network use 3 bits:

.001 Sub Network 1 .010 Sub Network 2


.011 Sub Network 3 .100 Sub Network 4
.101 Sub Network 5 .110 Sub Network 6
What should be the address mask in order to have six sub networks? Express your
answer in binary and in decimal.

To represent 6 sub networks, you need 3 bits for addressing since 23=8, which provides
enough unique combinations for 6 sub-networks.

These 3 bits will be used for addressing the individual sub networks.

In binary, the 3 bits can take the following values:

 001

 010

 011

 100

 101

 110

Holy Spirit University of Kaslik (USEK) - Faculty of Arts and Sciences - Department of CS & IT
CSC 420 - Computer Networks
Dr. Jacques Demerjian
 111

However, you need to reserve one address for the main network, leaving 6 addresses
for the sub networks. That's why you use only the first six combinations.

Now, the address mask is created by using these 3 bits and filling the remaining bits with
0 to create an 8-bit mask. So, it becomes 11100000 in binary. In decimal, this is 224.

The address mask 111000002 or 22410 ensures that you have 6 usable subnetwork
addresses within the larger network. Each subnetwork can be assigned a unique
combination of the remaining bits in their addresses.

1111 1111 . 1111 1111 . 1110 0000 . 0000 0000

255 . 255 . 224 . 0

d) What is the sub network 4 address? Express your answer in binary and in decimal.

1. Address Mask: 11100000


This address mask is used to identify the network and sub-network portions of an IP
address. In this case, it's a 8-bit mask where the first 3 bits represent the network, and
the remaining 5 bits represent the sub-network.

2. Sub Network 4: 10000000


When we allocate this address mask to Sub Network 4, it means that the network
portion is 100 and the sub-network portion is 00000.

Therefore, the binary representation of the address is 10000000 and the decimal
representation is 128.

This means that any device in Sub Network 4 will have the IP address

1000 0100.1100 1111.1000 0000.0000 0000


132 . 207 . 128 . 0

where the network portion, and the rest of the IP address is available for host addressing
Holy Spirit University of Kaslik (USEK) - Faculty of Arts and Sciences - Department of CS & IT
CSC 420 - Computer Networks
Dr. Jacques Demerjian
within that sub-network.

So, the Sub Network 4 address, with the given subnet mask, is 132.207.128.0 with the
network portion modified based on the subnet mask.

e) What are the first and the last usable IP addresses of the sub network 4? Express
your answer in binary and in decimal.

1000 0000.0000 0001 1001 1111.1111 1110


128 . 1 159 . 254

Holy Spirit University of Kaslik (USEK) - Faculty of Arts and Sciences - Department of CS & IT
CSC 420 - Computer Networks
Dr. Jacques Demerjian
Exercise 4: Draw the routing table of both routers R1 and R2; Take in consideration the
3 sub networks given in the following figure.

Holy Spirit University of Kaslik (USEK) - Faculty of Arts and Sciences - Department of CS & IT
CSC 420 - Computer Networks
Dr. Jacques Demerjian
Exercise 5: A company which has bought a class B IP address (133.110.0.0), is divided
into 3 branches. The network administrator has decided to provide a sub network
address for each branch. In order to divide this network into three sub networks, what is
the subnet mask to be used?

To divide a Class B network (133.110.0.0) into three subnetworks, you need to


find a subnet mask that provides enough host addresses for each subnet. Since
you want to divide it into three subnetworks, you need a subnet mask that allows
for at least four subnets (2^2 = 4).

The subnet mask is represented by the number of bits dedicated to the network
portion. Let's find the appropriate subnet mask:

 The default subnet mask for a Class B network is 255.255.0.0, which is


represented in binary as 11111111.11111111.00000000.00000000.

 To create at least four subnets, you need to borrow two more bits for the
network portion. The subnet mask would then be 255.255.192.0 in decimal
or 11111111.11111111.11000000.00000000 in binary.

So, the subnet mask for dividing the Class B network 133.110.0.0 into three
subnetworks would be 255.255.192.0.

Holy Spirit University of Kaslik (USEK) - Faculty of Arts and Sciences - Department of CS & IT
CSC 420 - Computer Networks
Dr. Jacques Demerjian
Exercise 6:
a) A company which has bought a class B IP address (133.110.0.0), is divided into 6
branches. The network administrator has decided to provide a sub network address
for each branch. In order to divide this network into three sub networks, what is the
subnet mask to be used?

The number of requested subnet is 6,


x
So the subnet ID should be made of 2 ≥ 6  X = 3

The default mask for class B is 255.255.0.0


 1111 1111.1111 1111.0000 0000.0000 0000

Having the subnet ID on 3 bit means the Subnet Mask is

1111 1111.1111 1111.1110 0000.0000 0000  255.255.224.0

b) How many IP address we have in each subnet? And how many in all?

Subnet mask is 255.255.224.0

 1111 1111.1111 1111.1110 0000.0000 0000


 (8+8) 16 bits for network, 3 bits for subnet, (5+8) 13 bits for hosts  8192
Different address

The first address should be removed (Subnet address) and the last (Subnet
broadcast)  8190 address in each subnet.

We have 6 subnets  totally we have = 6 x 8190 = 46068 Address.

Holy Spirit University of Kaslik (USEK) - Faculty of Arts and Sciences - Department of CS & IT
CSC 420 - Computer Networks
Dr. Jacques Demerjian
Exercise 7: Suppose we have a packet for 1700 bytes to be transmitted over an
MTU of 1500 bytes. Fragment the original IP packet of 1700 bytes.

When a packet on a network exceeds the MTU value in size then in order to get
the packet delivered to the destination, it is broken down into smaller chunks or
fragmented and delivered to the destination where the fragmented packets are
again reassembled to form the original packet.

The source device must send some additional information in the IP header for the
destination device to be able to reassemble the fragments of a packet to get the
original packet.

Few of the fields in the IP header used for this purpose are:

Total Length Field: After fragmenting, this field indicates the length of each
fragment, not the length of the overall message. Normally, the fragment size is
selected to match the MTU value in bytes after subtracting the IP header size of
20 bytes or more.

Identification Number: All the fragments of the same packet have the same
identification number to allow the receiving device to identify all the fragments of
a single packet.

Flags: It is a 3-bit field which is used to identify the fragments.


 bit 0: Reserved; must be zero
 bit 1: Don’t Fragment (DF)
 bit 2: More Fragments (MF)

Holy Spirit University of Kaslik (USEK) - Faculty of Arts and Sciences - Department of CS & IT
CSC 420 - Computer Networks
Dr. Jacques Demerjian
The MF bit is set for all the fragments except the last one for which it is zero.

The DF bit is set to disable the fragmentation and in this case, if the packet size is
greater than MTU value then it is dropped.

Fragmentation Offset: This field helps the destination device to place the
fragments in the proper sequence to build the original packet.
The fragmentation offset value for the first fragment is always 0. The field is 13
bits wide, so the offset can be from 0 to 8191. Fragments are specified in units of
8 bytes, which is why fragment length must be a multiple of 8.

First fragment:
 Fragment Offset: 0
 ID : 1
 MF = 1
 DF = 0
 Total Length : 1500 bytes
 Data Payload = 1500 -20 bytes IP header = 1480

Second Fragment:
 Fragment Offset: 185 (Calculation – Previous Offset + Previous Fragment
Data transmitted/8)
 ID : 1
 MF = 0
 DF = 0
 Total Length: 240 bytes
 Data Payload = 240 bytes – 20 byes of IP header

Below is the diagram illustrating the fragmentation of packets as stated in the


above computation:

Holy Spirit University of Kaslik (USEK) - Faculty of Arts and Sciences - Department of CS & IT
CSC 420 - Computer Networks
Dr. Jacques Demerjian
Holy Spirit University of Kaslik (USEK) - Faculty of Arts and Sciences - Department of CS & IT
CSC 420 - Computer Networks
Dr. Jacques Demerjian
Exercise 8: Given the IP address 132.208.17.5 with a mask 255.255.255.0 give
the network address, the host address and the class.

To find the network address and host address, you can use the subnet mask. The
subnet mask 255.255.255.0 means that the first 24 bits are used for the network, and
the remaining 8 bits are used for hosts.

Let's break down the IP address 132.208.17.5:

The first three octets (132.208.17) are the network address.

The last octet (5) is the host address.

So, the network address is 132.208.17.0, and the host address is 0.0.0.5.

As for the class of the IP address, it belongs to Class B because the first octet is in the
range 128-191.

Exercise 9: Given the IP address 88.3.4.4 with a subnet mask 255.255.0.0 give
the network address, the host address, the subnet address and the class.

Network Address: 88.3.0.0

Host Address: 0.0.4.4

Subnet Address: 88.3.0.0/16

Now, let's determine the class of the IP address. The class is determined by the range of
the first octet:

Class A: 1-126
Class B: 128-191
Class C: 192-223

Class: Class A

Holy Spirit University of Kaslik (USEK) - Faculty of Arts and Sciences - Department of CS & IT
CSC 420 - Computer Networks
Dr. Jacques Demerjian
Exercise 10: Given the IP address 132.208.25.5 with a subnet mask 255.255.0.0
give the network address, the host address, the subnet address and the class.

The given IP address is 132.208.25.5, and the subnet mask is 255.255.0.0.


1. Network Address:
 We perform a bitwise AND operation between the IP address and the
subnet mask:

IP Address: 132.208.25.5 => 10000100.11010000.00011001.00000101


Subnet Mask: 255.255.0.0 => 11111111.11111111.00000000.00000000
--------------------------------------------------------------
Network Address: => 10000100.11010000.00000000.00000000

So, the network address is 132.208.0.0.

2. Host Address:
 The host address is obtained by using the bitwise NOT operation on the
subnet mask and performing an AND operation with the IP address:
Inverse Subnet Mask: => 00000000.00000000.11111111.11111111
IP Address: => 10000100.11010000.00011001.00000101
--------------------------------------------------------------
Host Address: => 00000000.00000000.00011001.00000101

So, the host address is 0.0.25.5.

3. Subnet Address:
 The subnet address is the first address in the subnet, and for a subnet with
a 255.255.0.0 subnet mask, it is always a multiple of 256. Therefore, the
subnet address is 132.208.0.0.
4. Class:
 The IP address 132.208.25.5 falls into the Class B range (128.0.0.0 to
191.255.255.255).
-----
Network Address: 132.208.0.0

Host Address: 0.0.25.5

Subnet Address: 132.208.0.0/16

Class: Class B

Holy Spirit University of Kaslik (USEK) - Faculty of Arts and Sciences - Department of CS & IT
CSC 420 - Computer Networks
Dr. Jacques Demerjian

You might also like