Unit 1- Network Layer and Protocols-6
Unit 1- Network Layer and Protocols-6
Subject Code-22520
Examination Scheme
Theory Practical
ESE PA Total ESE PA Total
Max Min Max Min Max Min Max Min Max Min Max Min
2 Next Generation IP 10
• A node can be a computer, printer, or any other device capable of sending and/or receiving data
generated by other nodes on the network. A link can be a cable, air, optical fiber, or any medium which
can transport a signal carrying information.
• Network Criteria
1. Performance: Can be measured by transit time and response time.
• Transit time is the amount of time required for a message to travel from one device to
another.
• The performance of a network depends on the number of users, the type of transmission
medium, the capacities of the connected hardware and the efficiency of the software.
2. Reliability: Is measured by the frequency of failures, the time it takes a link to recover from
failure and the network robustness in a catastrophe.
3. Security: This refers to the ability to protect data from unauthorized access
. Protocols :
• A protocol is synonymous with rule. It consists of a set of rules that
• Network Models:
2. TCP/IP Model
OSI Reference Model
2.6
. Network Layer
• Main responsibility of Network layer is to carry the data packets from the source
to the destination without changing or using it. If the packets are too large for
delivery, they are fragmented i.e., broken down into smaller packets.
The address used in the network layer should be uniquely and universally
define the connection of a computer.
• Duties/Functions of Network Layer Continue….
1. IPv4 Addresses
2. IPv6 Addresses
1.1.1 IP Address
• An IP address is an address used to uniquely identify a device on a
network.
e.g. 145.25.10.100
• IPv4 Addresses :
• An IPv4 address is a 32-bit address that uniquely and universally defines the
connection of a device (for example, a computer or a router) to the Internet.
• They are unique so that each address defines only one connection to the
Internet. Two devices on the Internet can never have the same IPV4
address at the same time.
• The IPv4 addresses are universal in the sense that the addressing system
must be accepted by any host that wants to be connected to the Internet.
That means global addressing.
1.1.2 Address Space
• IPv4 has a certain address space. An address space is the total number of
addresses used by the protocol. If a protocol uses N bits to define an address, the
address space is 2N
• IPv4 uses 32-bit address format, which means that the address space is 232 or
4,294,967,296 (more than 4 billion).
1.1.3.Notations
There are three notations to show an IPv4 address:
• Binary notation
• Hexadecimal notation.
• IPv4 Addresses : (Continue…..)
1) Binary Notation(Base 2)
• In binary notation, the IPv4 address is displayed as 32 bits. Each octet is often
referred to as a byte. So it is common to hear an IPv4 address referred to a 4-
byte address. The following is an example of an IPv4 address in binary
notation: 01110111 10010101 00000001 00000011
Solution
We replace each group of 8 bits with its equivalent decimal number
and add dots for separation.
Example 1.2
Solution
We replace each decimal number with its binary
equivalent.
Example 1.3
Solution
a. There must be no leading zero (045).
b. There can be no more than four numbers.
c. Each number needs to be less than or equal to 255.
d. A mixture of binary notation and dotted-decimal
notation is not allowed.
1.1.4 Classful Addressing:
The 32 bit IP address is divided into five sub-classes. These are:
• Class A
• Class B
• Class C
• Class D
• Class E
• Each of these classes has a valid range of IP addresses. Classes D and E are reserved
for multicast and experimental purposes respectively. The order of bits in the first
octet determine the classes of IP address.
• IPv4 address is divided into two parts:
• Network ID
• Host ID
• The class of IP address is used to determine the bits used for network ID and host ID
and the number of total networks and hosts possible in that particular class. Each ISP
or network administrator assigns IP address to each device that is connected to its
network.
• Classful Addressing: (Continued…)
• Following figure shows the address space is divided into five classes.
Figure 3.2 Finding the classes in binary and dotted-decimal notation
• 1.2.1 IP Datagram format
• Packets in network (Internet) layer are called datagrams.
• The size of the 6th row representing the Options field vary.The size of Options field can go
up to 40 bytes. So, maximum length of IP header = 20 bytes + 40 bytes = 60 bytes.
• 1.2.2 IP Header format Continue……
3. Type Of Service-
• Type of service is a 8 bit field that is used for Quality of Service (QoS).
• 4 TOS bits and an unused bit that must be 0. The 4 TOS bits are:
4. Total Length-
• Total length is a 16 bit field that contains the total length of the datagram (in bytes).
7. Fragment Offset-
• Fragment offset for a given fragmented datagram = Number of data bytes ahead
of it in the original unfragmented datagram
• It indicates the maximum number of hops a datagram can take to reach the destination.
• The main purpose of TTL is to prevent the IP datagrams from looping around forever in a routing loop.
• If the value of TTL becomes zero before reaching the destination, then datagram is discarded.
9. Protocol-
• It tells the network layer at the destination host to which protocol the IP datagram belongs to.
• In other words, it tells the next level protocol to the network layer at the destination side.
13. Options-
1. Record route
2. Source routing
3. Padding
• 1.2.2 IP Header format Continue……
1. Record Route-
• A record route option is used to record the IP Address of the routers through
which the datagram passes on its way.
• When record route option is set in the options field, IP Address of the router gets
recorded in the Options field.
2. Source Routing-
• A source routing option is used to specify the route that the datagram must take
to reach the destination.
• This option is generally used to check whether a certain path is working fine or
not.
• It dictates the maximum size of the packet that can be transmitted through it.
• Data packets of size greater than MTU can not be transmitted through the network.
• So, datagrams are divided into fragments of size less than or equal to MTU.
• Datagram Fragmentation-
• When router receives a datagram to transmit further, it examines the following-
Case-01:
• Size of the datagram is found to be smaller than or equal to MTU.
• In this case, router transmits the datagram without any fragmentation.
Case-02:
• Size of the datagram is found to be greater than MTU and DF bit set to 1.
• In this case, router discards the datagram.
Case-03:
• Size of the datagram is found to be greater than MTU and DF bit set to 0.
• In this case, router divides the datagram into fragments of size less than or equal to MTU.
• Router attaches an IP header with each fragment making the following changes in it.
• Then, router transmits all the fragments of the datagram.
• 1.2.2 Fragmentation Continue…………
• Changes Made By Router-
Router makes the following changes in IP header of each fragment-
2. It sets the MF bit to 1 for all the fragments except the last one.
• Reassembly of Fragments:
• It takes place only at destination and not at routers since packets take
independent path, so all may not meet at a router and hence need of
fragmentation may arise again.
• 1.2.2 Fragmentation Continue…………
• Reassembly Algorithm-
Receiver applies the following steps for reassembly of all the fragments-
2. It identifies all the fragments belonging to the same datagram using identification
field.
3. It identifies the first fragment. Fragment with offset field value = 0 is the first
fragment.
4. It identifies the subsequent fragments using total length, header length and
fragment offset.
• Fixed part is 20 byte long, and variable part is comprises the options, which can
be maximum of 40 bytes.
• It is not required for a datagram. They can be used for network testing and
debugging.
1 2 5
(Copy) (Class) (Number)
• 1.2.3 Options Continue….
• The various fields in option format are as follows:
1. Type :
• It is 8 bit long and contains three subfields namely copy, class and number.
a) Copy (1 bit)
b) Class (2 bits)
c) Number (5 bits)
a) Copy :
Copy Meaning
Class Meaning
00 Datagram Control
• This subfield has 32 possible values but currently only 6 types are defined.
Number Meaning
00000 End of option.
00001 No option.
00100 Timestamp.
• The length field will not be present in all the option types.
3. Value:
• This is variable length field which contains the specific data which is required by
that option.
• The value field will not be present in all the option types.
1.3 ICMPv4
• Internet Control Message Protocol (ICMP) works in the network layer of the OSI
model and the internet layer of the TCP/IP model.
• Routers and other network devices monitor the operation of the network. When
an error occurs, these devices send a message using ICMP.
• ICMP messages are not passed directly to the data link layer. The message is first
encapsulated inside the IP datagram before going to the lower layer.
1.3 ICMPv4 Continue….
1.3.1 Functions of ICMP:
1. Announce Network Errors : Such as host or entire portion of the network being
unreachable, due to some type of failure.
• ICMP messages are not passed directly to the data link layer. The message is first
encapsulated inside the IP datagram before going to the lower layer.
• ICMP Message Format: Following figure shows the general ICMP message
format.
1.3 ICMPv4 Continue….
• Fields in message format of ICMPv4 are explained below:
1. Type − The type field identifies the type of the message.
2. Code − The code field in ICMP describes the purpose of the message.
3. Checksum − The checksum field is used to validate ICMP messages.
4. The Rest of header is specific for each message type.
5. Data in error messages carries information for finding original packet that had error. Data
in query messages carries extra information based on type of query.
1.3.2.1 Types of ICMP Messages:
• Error-reporting message − This message report problems that a router or a host
(destination) may encounter when it processes an IP packet.
• Query Message − The query messages, which occur in pairs, helps a host or a network
manager to get specific information from a router or another host.
• Following table lists the ICMP messages in each category.
1.3 ICMPv4 Continue….
Sr. Message Type Description
No.
Error Reporting Messages:
Query Messages:
1. Echo-Request and Echo-Reply Message: These messages help resolve network diagnostic
issues.
2. Timestamp Request and Reply: These time stamp requests and reply messages help
determine the round trip time between the devices.
1.3 ICMPv4 Continue….
1.3.3 Debugging Tools:
• 2 Tools are used.
1. Ping-
• It sends out pings, also referred to as echo request messages -- and then measures the
amount of time it takes the message to reach its destination and return to the source.
• These replies are called echo reply messages. Pings are useful for gathering latency
information about a specific device. Unlike traceroute, though, ping does not provide
picture maps of the routing layout.
• It tells the number of packets received, the total time, and the RTT minimum, maximum
and average.
1.3 ICMPv4 Continue….
2. Traceroute or Tracert :
• From source to the destination to trace the path of packet in Unix, the
traceroute command and in windows tracert command can be used.
• The traceroute utility is used to display the physical routing path between two
internet devices communicating with each other.
• It maps out the journey from one router to another -- sometimes called a hop.
• Traceroute uses two error messages namely, time exceeded and destination
unreachable.
• Thus, we need to modify the structure of the IP address. The two proposed
solutions to modify IP address are:
• Changing the IP address each time the host enters a new network.
• Every time the computer enters a new network it has to reboot. We have to keep
revising the DNS table to let every host on the internet have knowledge about
changes. Each time we have to change the configuration files. If the host moves
to another network in-between the transmission of data, the data exchange
would be interrupted.
1.4 Mobile IP Continue…..
2. Two Addresses :
• This solution is more feasible here, a mobile host will have two addresses:
• The home address is an original IP address of the mobile host, and the temporary
address is called as the care of address.
• A temporary address (care-of address) that would identify the host in the foreign
network. The care-of address will keep on changing whenever the host will move
to a new network.
• The second solution contributes to the design of Mobile IP. It allows a host to
move to another network by maintaining its original IP address and still is able to
communicate with the remote hosts over the internet.
1.4 Mobile IP Continue…..
• Entities of Mobile IP - The functional entities in the Mobile IP protocol are:
1. Home Network is a network to which the mobile host actually belongs. It is a
permanent network of the mobile host.
2. Foreign Network is a new network into which the mobile host has moved.
3. Remote Network is a network which is neither the home network nor the foreign
network.
4. Mobile Host is a host of the home network which has moved to the foreign network.
5. Remote Host is a host in a remote network.
6. Home Agent is a router attached to the home network that allows the mobile host to
send and receive data from the remote host over the internet.
7. Foreign Agent is a router attached to the foreign network that allows a mobile host to
send and receive data from a remote host over the internet.
8. Care-of address is a temporary IP address provided by the foreign agent to the mobile
host till it is in the foreign network.
9. Home Address is the address of the mobile host in its home network.
1.4 Mobile IP Continue…..
• Working
• Agent discovery is the first phase and requires the involvement of a mobile host,
a home agent and a foreign agent. This phase also has two sub-phases as
described below:
• The mobile host has to discover the home agent’s address before it moves away
from the home network (step 1 and 2)
• As the mobile host moves to a new network (foreign network), it has to discover
the foreign agent’s address and also the care-of address (step 3 and 4).
1.4 Mobile IP Continue…..
• The agent discovery phase includes two types of messages: agent advertisement
and agent solicitation.
a) Agent Advertisement
• A simple router advertises its existence on the network with the ‘ICMP router
advertisement’ packet. If the router is playing the role of an agent, it ‘appends’
the agent advertisement message to the ICMP advertisement packet.
• In case, if a host in the network doesn’t receive the ‘router ICMP advertisement’
packet. The host can initiate itself by sending the ‘router ICMP solicitation
packet’. If a mobile host has not received the ‘agent advertisement’, it can use
the ‘router ICMP solicitation packet’ to send the ‘agent solicitation’ message.
ii. Registration of mobile host with its home agent. This is normally done by the
foreign agent on behalf of mobile host (step 6).
1.4 Mobile IP Continue…..
iii. The reply packet is sent from the ‘home agent’ to the ‘mobile host’ via a ‘foreign
agent’. This registration reply has the confirmation of whether the request is accepted
or denied. (step 7 and 8).
• The mobile host has to renew its registration if it has expired. While returning back to
the home network the mobile host has to cancel or deregister its registration.
• Consider that the ‘remote host’ wants to send a data packet to the ‘mobile host’
unaware that the mobile host is not in its home network.
• The remote host would definitely send the packet with its own address in the source
address field and the mobile host’s home address in the destination address field of
the packet.
1.4 Mobile IP Continue…..
• As the mobile host is not it’s the home network, the packet sent by the remote
host is received by the home agent on behalf of the mobile host.
• the mobile communication between the remote host and home agent has been
marked by a thick path as “1” in fig.
• The foreign agent receives the packet, removes the encapsulation and sees the
home address of the mobile host in the destination address field of the original
packet sent by the remote host.
• The foreign agent reviews its registry table, observes which care-of address has
been registered to the corresponding home address, and then forwards the
corresponding mobile host packet as shown by the thick path marked by “3” in
above fig.
1.4 Mobile IP Continue…..
iv. From Mobile Host to Remote Host :
• if a mobile host being in the foreign network wants to reply or communicate with
the remote host, it simply prepares a packet and puts its home address in the
source address field of the packet and the remote host’s address in the
destination address field of the packet. The mobile host then directly sends the
packet from the foreign network to the remote host as shown by thick path “4”
in fig.
• Transparency :
• The movement of a mobile host from one network to another is transparent to
the entire internet as the internet is totally unaware of the movements of the
host.
1.4 Mobile IP Continue…..
• Advantages and Disadvantages of Mobile IP
• Advantages
1. A user with its network devices can move to any other network without losing its
connection with its home address.
2. Mobile IP provides transparency while the data transfer process. It hides the fact that
the mobile host is not in its home network and is communicating from a foreign
network.
• Disadvantages
1. When the ‘remote host’ and ‘mobile host’ both are in a foreign network and still the
data transfer is occurring through the ‘home agent’ then the data packet has to travel
more distance though both the host are in the same network.
2. As we have seen above, if the mobile host in the foreign network wants to send the
data packet to the remote host it sends it directly from the foreign network with its
home address as the source and the remote host address in the destination.
But, if a remote host wants to send a packet to a mobile host in a foreign network, the
data packet has to travel to the mobile host via its home agent. So, here it has to
travel the extra distance.
1.4 Mobile IP Continue…..
• Inefficiency in Mobile IP:
• The communication done with the help of mobile IP can be moderately and
severely inefficient.
• The case of moderate inefficiency is called as the Triangle Routing, or Dog Leg
Routing whereas the case of severe inefficiency called as Double Crossing or 2X.
1. Double Crossing or 2X :
• A mobile host can send a packet directly to the remote host. Therefore there is
no efficiency; the communication is local.
• But if the remote host sends a packet to the mobile host then it cannot do so
directly (via the dotted direct path in fig. 1.4.3)
1.4 Mobile IP Continue…..
• Instead the remote host has to send the packet first home agent (path 1) and
home agent will route the packet to the mobile host(path 2).
• In this case the packet crosses the Internet twice. Thus resources are used twice
unnecessarily in this communication which reduces the efficiency severely.
• Hence the double cross case is called as the case of severe efficiency.
• Occurs when the remote host wants to send a packet to the mobile host that is
not attached to the same network as the mobile host as shown in fig.
• When the mobile host sends a packet to the remote host it can do so directly.
There is no efficiency .
• But when the remote host sends a packet to the mobile host the packet goes
from the remote host to the home agent and then to the mobile host as shown
in fig. 1.4.4.
• Thus the packet has to travel along the two sides of a triangle instead of only
one which is the direct path shown by dotted line in fig.
1.4 Mobile IP Continue…..
Figure 1.4.4 Triangle Routing
• Solution :
• The remote host must know the mobile host’ s care-of address.
• The home agent can tell the remote host about this information by the update
binding packet.
• However, when the mobile host moves, its care-of address may be changed n
The home agent needs to send a warning packet to the remote host to inform it.