Ch4.G CN Network Layer
Ch4.G CN Network Layer
(CT 702)
Sharad Kumar Ghimire
Department of Electronics and Computer Engineering
Pulchowk Campus
Institute of Engineering
Tribhuvan University
Nepal
Chapter 4
Network Layer
Contd...
S. K. Ghimire
Contents
Protocols:
● IP
● ICMP
○ Debugging tools using ICMP
- S. K. Ghimire
Protocols
TCP/IP Protocol Suits
Internet Protocol
IPv4
Internet Protocol: IPv4
Connectionless protocol for a packet-switching network
The datagrams sent by the same source to the same destination could arrive out
of order and some could be lost or corrupted during transmission
● 4-bit field
● Defines the total length of the datagram header in 4-byte words
● As the length of the header is variable (between 20 and 60 bytes)
● When there are no options, the header length is 20 bytes so the value of this
field is 5 (5 x 4 = 20) at min, and the value of this field is 15 (15 x 4 = 60) at
max
Type of Service (8 bits)
● The field that has changed its meaning (slightly) over the years
● It was and is still intended to distinguish between different classes of service
● Various combinations of reliability and speed are possible
● For digitized voice, fast delivery beats accurate delivery
● For file transfer, error-free transmission is more important than fast
transmission
Total Length (16 bits)
● Defines the total length of the datagram including the header, in octets
● The maximum length is 65,535 bytes
● Length of data = Total length – Header length
● Indicates the next higher level protocol that is to receive the data field at the
destination
● Tells which transport protocol is carried by IP packet
● The numbering of protocols is global across the entire Internet
● Examples TCP = 6; UDP = 17; ICMP = 1
● A complete list is at: http://www.iana.org/assignments/protocol-numbers
Header checksum (16 bits)
Destination Address (32 bits): Network number and host number of destination
machine
Data (variable): The data field must be an integer multiple of 8 bits in length and
the maximum length of the datagram is 65,535 octets (data field plus header)
ICMP
Provides a means for transferring messages from routers and other hosts to a
host
ICMP encapsulation
ICMP Message Format
The format of the header is different for each message type, the first 4 bytes are
common to all
The code field specifies the reason for the particular message type
Two categories
When the final destination does not receive all of the fragments in a set time, it
discards the received fragments and sends a time-exceeded message to the
original source
ICMP Error: Parameter Problem
Any ambiguity in the header part of a datagram can create serious problems as
the datagram travels through the Internet
Usually a host has a very limited number of route entries; i.e. it knows the IP
address of only one router, the default gateway
When a host send a datagram, which is destined for another network, to the
wrong router, the router that receives the datagram will forward the datagram to
the correct router
However, to update the routing table of the host, it sends a redirection message to
the host
ICMP: Query Messages
ICMP can be used to diagnose some network problems via the query messages
ICMP: Echo Request and Reply
The echo-request and echo-reply messages are designed for diagnostic purposes
The combination of echo-request and echo-reply messages are used whether two
systems (hosts or routers) can communicate with each other
If the host knows the address of the router, it sends the request directly to the
router but if it does not know, it broadcasts the message
The router or routers that receive the solicitation message broadcast their routing
information using the router-advertisement message
Windows: tracert
Used to trace the route of a packet from the source to the destination
To find the route of a packet it uses two ICMP messages, time exceeded and
destination unreachable
This is a program at the application level that uses the services of UDP