Network Layer
(updated )
1
Related Chapter _12
Related CLO-5
• Implementation of Transport Layer and
Network Layer Protocols for Application Layers
Protocols.
Position of network layer
3
Related Chapter ..18
Communication between Alice and Bob at the network layer
4
Communication between Alice and Bob at the network layer
• The figure shows that the Internet is made of many
networks (or links) connected through the connecting
devices.
• Internet is an internetwork, a combination of LANs and
WANs.
• We need to think about the connecting devices (routers or
switches) that connect the LANs and WANs.
5
Communication between Alice and Bob at the network layer
• Network layer is involved at the source host, destination host, and all
routers in the path (R2, R4, R5, and R7).
• At the source host (Alice)
– the network layer accepts a packet from a transport layer, encapsulates the packet in a
datagram, and delivers the packet to the data-link layer.
• At the destination host (Bob)
– the datagram is decapsulated, and the packet is extracted and delivered to the
corresponding transport layer.
• Although the source and destination hosts are involved in all five layers of
the TCP/IP suite, the routers use three layers if they are routing packets
only; however, they may need the transport and application layers for
control purposes.
6
Communication between
Alice and Bob at the
network layer
• A WAN switch is a multiport internetworking device used in carrier networks.
• Two routers at remote ends of a WAN can be connected by WAN switches
Responsibilities of Network Layer
1. End to end transmission
2. Data Encapsulation
3. Logical Addressing
4. Fragmentation and Reassembly
5. Error Handling and Diagnostics
6. Routing
1. End to end transmission
1. End to end transmission
• Comparison of Network Layer and Data layer:
• Network layer is responsible for the source-to-destination
delivery of a packet, possibly across multiple networks (links).
• Network layer ensures that each packet gets from its point of
origin to its final destination.
• Data link layer oversees the delivery of the packet between two
systems on the same network (links)
2. Datagram Encapsulation:
2. Datagram Encapsulation:
• The network layer normally encapsulates
messages received from higher layers by
placing them into datagrams (also called
packets) with a network layer header.
12
2. Datagram Encapsulation:
• If the data packet is arriving at the Network Layer
from another computer
– It had already traversed the Physical Layer (Layer 1) and the Data Link layer (layer 2).
– Data Link layer (Layer 2) had already read the information from the Layer 2 header
(Ethernet Frame), removed the Layer 2 header and pushed the IP datagram up to the
Network Layer.
– Now the Network Layer (Layer 3) will read and process the information it required (May
be Source IP Address, Destination IP Address, Fragmentation details etc) from IP
header, tear off the IP header, and push the TCP/UDP segment/datagram up to
Transport (Layer 4) for further processing at Transport Layer (Layer 4).
– This process is known as decapsulation.
2. Datagram Encapsulation:
• When the data is sent from one computer to
another, the process is encapsulation and
when data is received from another computer,
the process is decapsulation
14
3. Logical Addressing
15
3. Logical Addressing
• Every device that communicates over a network has associated
with it a logical address, sometimes called a layer three address.
• For example, on the Internet, the Internet Protocol (IP) is the
network layer protocol and every machine has an IP address.
• Note that addressing is done at the data link layer as well,
but those addresses refer to local physical devices.
• In contrast, logical addresses are independent of particular
hardware and must be unique across an entire internetwork.
16
4. IP Fragmentation
4. Fragmentation and Reassembly
• The network layer must send messages down to the data
link layer for transmission.
• Some data link layer technologies have limits on the length
of any message that can be sent.
• If the packet that the network layer wants to send is too
large, the network layer must split the packet up, send
each piece to the data link layer, and then have pieces
reassembled once they arrive at the network layer on the
destination machine.
18
Network layer at the source
19
Network layer at the destination
20
IP Fragmentation
• A datagram can travel through different networks. Each router
decapsulates the IPv4 datagram from the frame it receives,
processes it, and then encapsulates it in another frame.
• The format and size of the sent frame depend on the
protocol used by the physical network through which the
frame is going to travel.
• For example, if a router connects a LAN to a WAN, it receives a
frame in the LAN format and sends a frame in the WAN format.
IP Fragmentation
• Each data link layer protocol has its own frame format in most protocols.
• One of the fields defined in the format is the maximum size of the data
field.
• When a datagram is encapsulated in a frame, the total size of the
datagram must be less than this maximum size, which is defined by the
restrictions imposed by the hardware and software used in the network.
• Value of the MTU (Maximum transfer unit ) depends on the physical
network protocol.
22
Maximum transfer unit (MTU)
1,500
Table showing the value of MTU
23 (in
bytes) for some protocols.
Maximum transfer unit (MTU)
• To make the IPv4 protocol independent of the physical
network, the designers decided to make the maximum
length of the IPv4 datagram equal to 65,535 bytes.
• This makes transmission more efficient if we use a
protocol with an MTU of this size. However, for other
physical networks, we must divide the datagram to
make it possible to pass through these networks. This
is called fragmentation.
24
MTU
• Maximum Transmission Unit (MTU):
– Largest IP packet a network will accept
– Arriving IP packet may be larger
MTU
IP Packet
IP Fragmentation
• If IP packet is longer than the MTU, the router breaks
packet into smaller packets :
– Called IP fragments
– Fragments are still IP packets
MTU
IP Packet 3 2 1
IP Packets
Fragmentation
IP Fragmentation
• What is Fragmented?
– Only the original data field
– New headers are created
MTU
IP Packet 3 2 1
IP Packets
Fragmentation
IP Fragmentation
• Who Does the Fragmentation?
– The router
– Not the subnet
MTU
IP Packet 3 2 1
IP Packets
Fragmentation
Multiple Fragmentations
• Original packet may be fragmented multiple times along its
route
Source Destination
Host Host
Internet Internet
Process Process
Fragmentation
Defragmentation
• Internet layer process on destination host defragments,
restoring the original packet
• IP Defragmentation only occurs once
Source Destination
Host Host
Internet Internet
Process Process
Defragmentation
Defragmentation: Recap
• IP Defragmentation
– Defragmentation (reassembly) is done once, by
destination host’s internet layer process
5. Error Handling and Diagnostics
32
Responsibilities of Network Layer
• Unreliable
– Packets might be lost, corrupted, duplicated, delivered out of order.
– IP is connectionless, in that a datagram can travel from a sender to
a recipient without the recipient having to send an
acknowledgement (no flow control, no error control, and no
congestion control services. ).
– This means that if any of these services is required for an
application, the application should rely only on the transport-layer
protocol.
33
Note:
Communication at the network layer
in the Internet is connectionless.
34
Note:
• Although error control also can be implemented in the
network layer, the designers of the network layer in
the Internet ignored this issue for the data being
carried by the network layer.
• One reason for this decision is the fact that the packet
in the network layer may be fragmented at each
router, which makes error checking at this layer
inefficient.
35
Note:
• The designers of the network layer, however, have added a
checksum field to the datagram to control any corruption in the
header, but not in the whole datagram. This checksum may
prevent any changes or corruptions in the header of the
datagram.
• Although the network layer in the Internet does not directly
provide error control, the Internet uses an auxiliary protocol,
ICMP (Internet Control Message Protocol), that provides
some kind of error control if the datagram is discarded or
has some unknown information in the header.
36
Other auxiliary protocols at Network Layer
• The network layer also has some auxiliary protocols that help IP in its delivery
and routing tasks.
• E.g
– Internet Control Message Protocol (ICMP)
– Internet Group Management Protocol (IGMP)
– Some more………………
– ICMP
• It is used by network devices, like routers, to send error messages and operational information
indicating, e.g, that a requested service is not available or that a host or router could not be
reached
– IGMP
• IGMP is another protocol that helps IP in multitasking.
• IGMP can be used for one-to-many networking applications such as online streaming video and
gaming,
6. Routing Protocols
38
6. Routing
• Moving data across a series of interconnected
networks is probably the defining function of the
network layer.
• It is the job of the devices and software routines that
function at the network layer to :
1. handle incoming packets from various sources
2. determine their final destination
3. and then figure out where they need to be sent to get them
where they are supposed to go.
39
6. Routing
• Moving data across a series of interconnected
networks is probably the defining function of the
network layer.
• It is the job of the devices and software routines that
function at the network layer to handle incoming
packets from various sources, determine their final
destination, and then figure out where they need to
be sent to get them where they are supposed to go
40
Routing Protocols
• Routing protocols are used to continuously
update the routing tables that are consulted
for forwarding and routing.
• Routing protocol is a combination of rules and
procedures that lets routers in the Internet
inform each other of changes.
41
Routing
• Routing algorithm::
– that part of the Network Layer responsible for
deciding on which output line to transmit an
incoming packet.
• Algorithm properties:
– correctness, simplicity, robustness, stability,
fairness, optimality, and scalability.
42
Routing Protocols
• A routing table can be either static or
dynamic.
– A static table is one with manual entries.
– A dynamic table is one that is updated
automatically when there is a change somewhere in
the Internet.
43
Static Routing Table
• Static routing table
– contains information entered manually.
– The administrator enters the route for each destination into
the table.
– When a table is created, it cannot update automatically when
there is a change in the Internet. The table must be manually
altered by the administrator.
– Such routing table can be used in a small internet that
does not change very often, or in an experimental internet
for troubleshooting.
44
Static Routing Table
• Advantages of static routing
–It can backup multiple interfaces/networks on a router
–Easy to configure
–No extra resources are needed
–More secure
• Disadvantages of static routing
–Network changes require manual reconfiguration
–Does not scale well in large topologies
Dynamic Routing Table
• Dynamic routing table
– A dynamic routing table is updated periodically
– Whenever there is a change in the Internet, such as a
shutdown of a router or breaking of a link, the dynamic
routing protocols update all the tables in the routers
(and eventually in the host) automatically.
– The routers in a big internet such as the Internet need to be
updated dynamically for efficient delivery of the IP packets.
– Routing Protocols are such as RIP, OSPF, or BGP etc.
46
Popular Routing Protocols
• Routing Information Protocol (RIP) is an
implementation of the ‘distance vector
technique’.
• Open Shortest Path First (OSPF) is an
implementation of the ‘link state technique’.
• Border Gateway Protocol (BGP) is an implementation
of the ‘Path vector technique’.
Popular Routing Protocols
48
What are Autonomous systems ?
• Autonomous system (AS) or domain is a set of routers or
networks administered by a single organisation.
• Autonomous System is a group of routers under the
control of a single authority.
49
Classifying Routing Protocols
• Sometimes we say ----Types of routing protocols:
• Interior Gateway Protocols (IGP)
• Exterior Gateway Protocols (EGP)
Thanks
51