Network Layer
Network Layer
NETWORK LAYER
● HLEN (Header Length ,4 bits): Length of headeris 4 bit in 32 bit words. The minimum value
is five for a minimum header length of 20 octets
● TOS (Type-of-Service , 8 bit): The Type-of-Service field contains an 8- bit binary value
that is used to determine the priority of each packet
● Identifier (16 bits): A sequence number that, together with the source address, destination
address, and user protocol, is intended to uniquely identify a packet
• Flags(3 bits): Only two of the bits are currently defined
1. MF(More Fragments) bit
2. DF(Don't Fragment) bit
3. Future use bit
• Fragment Offset : A router may have to fragment a packet when
forwarding it from one medium to another medium that has a smaller
MTU *. When fragmentation occurs, the IPv4 packet uses the
Fragment Offset field and the MF flag in the IP header to
reconstruct the packet when it arrives at the destination host.
• TTL (Time-to-Live, 8-bit): Indicates the remaining "life" of the
packet
• The TTL value is decreased by at least one each time the packet is
processed by a router (that is, each hop). When the value becomes
zero, the router discards or drops the packet and it is removed from
the network data flow
• Protocol (8-bits): Indicates the data payload type that the packet
is carrying (TCP/UDP).
• Destination Address(32 bits): value that represents the packet
destination Network layer host address
• Source Address (32 bit): value that represents the packet source
Network layer host address
Address Depletion Problem in Internet
● 128 bits is divided into eight sections, each 2 bytes in length. Two bytes in hexadecimal
● notation requires four hexadecimal digits. Therefore, the address consists of 32 hexadecimal
● IPv6 has a much larger address space; 2^128 addresses are available
Example IPv6
FDEC: 0074 : 0000 : 0000 : 0000 : BOFF : 0000 : FFFO
•To pass through this region, the packet must have an IPv4 address.
•So the IPv6 packet is encapsulated in an IPv4 packet when it enters the region,
and it leaves its capsule when it exits the region.
•It seems as if the IPv6 packet goes through a tunnel at one end and emerges at
the other end.
•To make it clear that the IPv4 packet is carrying an IPv6 packet as data, the
protocol value is set to 41.
Header translation
•Header translation is necessary when the majority of the Internet has
moved to IPv6 but some systems still use IPv4.
•The sender wants to use IPv6, but the receiver does not understand IPv6.
•Tunneling does not work in this situation because the packet must be in
the IPv4 format to be understood by the receiver.
•In this case, the header format must be totally changed through header
translation. The header of the IPv6 packet is converted to an IPv4 header
Address of IPV6
ROUTING
● Metric : is a unit that help the router choose the best route among multiple
feasible routes to a destination.
● Delay: delay of a network specifies how long it takes for a bit of data to travel
across the network from one node or endpoint to another
Routing Technique
● Static routing manually sets up the optimal paths between the source and the
destination computers.
● On the other hand, the dynamic routing uses dynamic protocols to update the
routing table and to find the optimal path between the source and the
destination computers.
● The static routing is suitable for very small networks and they cannot be used
in large networks.
As against this, dynamic routing is used for larger networks.
● The manual routing has no specific routing algorithm.
The dynamic routers are based on various routing algorithms like OSPF
(Open Shortest Path First), IGRP (Interior Gateway Routing Protocol) and
RIP (Routing Information Protocol).
● The static routing is the simplest way of routing the data packets from a
source to a destination in a network.
The dynamic routing uses complex algorithms for routing the data packets.
● The static routing has the advantage that it requires minimal memory.
Dynamic router, however, require large memory, depending on the routing
algorithms used.
● The network administrator finds out the optimal path and makes the
changes in the routing table in the case of static routing.
In the dynamic routing algorithm, the algorithm and the protocol is
responsible for routing the packets and making the changes accordingly
in the routing table.
Routing Table
● A routing table is a set of rules, often viewed in table format that is used to
determine where data packets traveling over an Internet Protocol (IP) network
will be directed.
● All IP-enabled devices, including routers and switches, use routing tables.
● A routing table contains the information necessary to forward a packet along the
best path toward its destination.
● Each packet contains information about its origin and destination.
● When a packet is received, a network device examines the packet and matches it
to the routing table entry providing the best match for its destination.
● The table then provides the device with instructions for sending the packet to
the next hop on its route across the network.
● A basic routing table includes the following information:
● Interface: The outgoing network interface the device should use when
forwarding the packet to the next hop or final destination
● Metric: Assigns a cost to each available route so that the most cost-
effective path can be chosen
• Least-cost route between any two nodes is the route with minimum
distance
• Each node maintains a set of triples(Destination, Cost, NextHop)
• The table at each node(router) also guides the packets to the desired
node by showing the next stop in the route
• There is 2 steps in the route learning process
1. Initialization
2. Sharing
Initialization
• Initially routing table in each node consists the distance between
itself and its immediate neighbors, those directly connected to it
• Not directly connected is marked infinities()
Sharing
• 2 types of sharing(updates)
1. Periodic
2. Triggered
• Directly connected neighbors exchange(share) updates periodically
(on the order of several seconds 30 sec)
• Whenever table changes (called triggered update)
Update Process
● RIP (Routing Information Protocol) is a protocol type used in local area network
and wide area network.
● RIP uses a distance vector algorithm to decide which path to put a packet
on to get to its destination.
● It stores in its routing table the distance for each network it knows how to
reach, along with the address of the "next hop" router -- another router that is
on one of the same networks -- through which a packet has to travel to get to
that destination.
● If it receives an update on a route, and the new path is shorter, it will update
its table entry with the length and next-hop address of the shorter path;
Open shortest path first (OSPF)
● Open Shortest Path First (OSPF) is an active routing protocol used in internet
protocol.
● Particularly it is a link state routing protocol and includes into the group of interior
gateway protocol.
● Routers connect networks using the Internet Protocol (IP), and OSPF (Open
Shortest Path First) is a router protocol used to find the best path for packets as
they pass through a set of connected networks.
● Unlike RIP, which requires routers to send the entire routing table to
neighbors every 30 seconds, OSPF sends only the part that has changed and
only when a change has taken place.
Border Gateway Protocol (BGP)
● Border Gateway Protocol (BGP) are the core routing protocol of the internet
and responsible to maintain a table of Internet protocol networks which
authorize network reaching capability between AS.
Code:
For error messages, this defines the sub type of field error.
Checksum:
The checksum is calculated by the header and the data that is
used to detect the errors.
Data:
packet in this section contains the complete information of the
packet.
Destination un-reachable :
Destination unreachable is generated by the host or its inbound gateway to inform the client that the
destination is unreachable for some reason.
Parameter problem :
Whenever packets come to the router then calculated header checksum should be equal to received
header checksum then only packet is accepted by the router.
ICMP will take the source IP from the discarded packet and informs to source by sending parameter
problem message.
Time exceeded message :
When some fragments are lost in a network then the holding fragment by the router will be dropped then ICMP
will take source IP from discarded packet and informs to the source, of discarded datagram due to time to live
field reaches to zero, by sending time exceeded message.
Redirection message :
Redirect requests data packets be sent on an alternate route. The message informs to a host to update its
routing information (to send packets on an alternate route).
ICMPV6