University of Engineering & Technology (UET) Taxila Computer Communication Networks LAB

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

University of Engineering & Technology (UET)

Taxila
Computer Communication Networks LAB

EXPERIMENT # 07: Internet Control Message Protocol

Name of Student: …………………………………..

Roll No.: ……………………………………………

Date of Experiment: ………………………………..

Report submitted on: ………………………………..

Marks: ……………………………………

Remarks……………………………………

Signature………………………….………

Computer Communication Networks Lab Page 1


Internet Control Message Protocol (ICMP)
1. Objective:
Learn how ICMP is implemented on networks and the packet format used in this
protocol

2. Recourses Required:
 Computer
 Packet Tracer (version 5 or higher)

3. Introduction

ICMP (Internet Control Message Protocol) is an error-reporting protocol network


devices like routers use to generate error messages to the source IP address when
network problems prevent delivery of IP packets. ICMP creates and sends messages
to the source IP address indicating that a gateway to the Internet that a router, service
or host cannot be reached for packet delivery. Any IP network device has the
capability to send, receive or process ICMP messages.

While ICMP is not used regularly in end-user applications, it is used by network


administrators to troubleshoot Internet connections in diagnostic utilities
including ping and traceroute.

ICMP messages are transmitted as datagrams and consist of an IP header that


encapsulates the ICMP data. ICMP packets are IP packets with ICMP in the IP data
portion. ICMP messages also contain the entire IP header from the original message,
so the end system knows which packet failed.

3.1 ICMP and Ping:

Ping program is simple tool that allows anyone (for example, a network
administrator) to verify if a host is live or not. The Ping program in the source host
sends a packet to the target IP address; if the target is live, the Ping program in the
target host responds by sending a packet back to the source host and both of these
Ping packets are ICMP packets.

3.2 IP Packet Format:

 Version – static 4 bit value indicating which version of IP is being used.

Computer Communication Networks Lab Page 2


 IHL IP Header Length – 4 bit value indicating the number of 32-bit words that
makes up the header.
 Type of Service – 8 bit value that is used tell the network how to treat the IP packet.
 Packet Length – 16 bit value indicating the size of the IP Packet in terms of bytes.
This gives a maximum packet size of 65536 bytes.
 Identification – 16 bit field used for reassembling the packet at the destination.
 Flags – 3 bits indicating to network equipment if the IP packet can be further
fragmented or not and if the packet is the last fragment or not of a larger transfer.
 Fragment offset – 13 bit value used in the reassembly process at the destination.
 Time to Live – 8 bit value telling the network how long an IP packet can exist in a
network before it is destroyed.
 Protocol – 8 bit value used to indicate the type of protocol being used
HEX Protocol number Keyword
0x00 0 HOPOPT
0x01 1 ICMP
0x02 2 IGMP

 Header checksum – 16 bit 1’s compliment value designed to indicate errors in the
header only. Every node in the network has to check and re-insert a new checksum as
the header changes at every node (TTL value is decremented)
 Destination address – 32 bit value representing the IP address of the packets final
destination.
 Padding -Variable size bit field. These bits are used to ensure a 32 bit boundary for
the header is achieved.

3.3 ICMP Packet Format

 Type (8 bits) specifies the format of the ICMP message.

 Code (8 bits) further qualifies the ICMP message.

 ICMP Header Checksum (16 bits): When the data packet is transmitted, the checksum
is computed and inserted into this field. When the data packet is received, the
checksum is again computed and verified against the checksum field. If the two
checksums do not match then an error has occurred.

Computer Communication Networks Lab Page 3


 Payload (Variable length Data) contains the data specific to the message type
indicated by the Type and Code fields.

 Time-to-live (TTL) is a value in an Internet Protocol (IP) packet that tells a


network router whether or not the packet has been in the network too long and should
be discarded. In IPv6 the TTL field in each packet has been renamed the hop limit.

An IP TTL is set initially by the system sending the packet. It can be set to any value
between 1 and 255; different operating systems set different defaults. Each router that
receives the packet subtracts at least 1 from the count; if the count remains greater
than 0, the router forwards the packet, otherwise it discards it and sends an Internet
Control Message Protocol (ICMP) message back to the originating host, which may
trigger a resend.

The point of the TTL/hop limit is to keep streams of undeliverable packets stuck in
routing loops (perhaps due to incorrect routing tables) from circulating forever and
clogging up the networks in question.

 Header checksum node in the network has to check and re-insert a new checksum as
the header changes at every node (TTL value is decremented)

3.4 ICMP Message Types:

Based on the type field, the message types are categorized into different groups. Each
of these messages carries different fields with respect to ICMP over the network. The
summary of these messages and the type is tabularized below.

Type Message Category


0 Echo Reply
3 Destination Unreachable
4 Source Quench
5 Redirect
8 Echo
11 Time Exceeded
12 Parameter Problem
13 Time Stamp
14 Time Stamp Reply
15 Information Request
16 Information Reply

Computer Communication Networks Lab Page 4


Examples of ICMP queries:

Type/Code Description
8/0 Echo Request Ping Command uses Echo
0/0 Echo Reply Request and Reply

4. Procedure

Task: Understanding ICMP packet format

 Set up a simple network as shown below.

 Send a PDU from one host to another. And analyse the following in the packet
format.
 Analyse the IP datagram packet and compare it to the format given above.
 Analyse the type and code of ICMP packet. What are the types and code used
and why?
_______________________________________________________________
_______________________________________________________________
______________________________________________________________
 The Identifier and Sequence Number can be used by the client to match the
reply with the request that caused the reply. Send another PDU message and
analyse the sequence number. Add another PDU and analyse the sequence
number again. What do you analyse from the sequence number pattern of
consecutive ping messages.
_______________________________________________________________
_______________________________________________________________
______________________________________________________________
 What is TTL before and after passing the router interface in echo message?

_______________________________________________________________
_______________________________________________________________
______________________________________________________________

 From the version of IP header, specify which IP version is used?

Computer Communication Networks Lab Page 5


_______________________________________________________________
______________________________________________________________

 What is the value in the protocol field of packet? What is it indicating?

_______________________________________________________________
_______________________________________________________________
______________________________________________________________

 How OSI model is indicating that ICMP is working on layer 3 (network


Layer):

_______________________________________________________________
_______________________________________________________________
_______________________________________________________________
______________________________________________________________

Computer Communication Networks Lab Page 6


University of Engineering & Technology (UET),
Taxila
Computer Communication Networks Lab
LAB WORKSHEET (Lab # 7)
Q.1 Explain the Ethernet packet format?
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________

Q.2 How ICMP is used for debugging through ping command?


________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________

Q.3 What is fragmentation of packets?


________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________

Q.4 What is serial number, type and code in ICMP packet?


________________________________________________________________________
________________________________________________________________________
________________________________________________________________________
________________________________________________________________________

Computer Communication Networks Lab Page 7

You might also like