Session 5: Network Layer
Prepared By: Eng.Israa Saadeh
Network Layer
Characteristics
Network Layer in Communications
The Network Layer
• The network layer, which resides at OSI
Layer 3, provides services that allow end
devices to exchange data across a network.
• The network layer uses four processes in
order to provide end-to-end transport:
• Addressing of end devices – IP addresses must
be unique for identification purposes.
• Encapsulation – The protocol data units from the
transport layer are encapsulated by adding IP
header information including source and
destination IP addresses.
• Routing – The network layer provides services to
direct packets to other networks. Routers select
the best path for a packet to take to its destination
network.
• De-encapsulation – The destination host de-
encapsulates the packet to see if it matches its
own.
Network Layer in Communications
Network Layer Protocols
• There are several network layer
protocols in existence; however,
the most commonly implemented
are:
• Internet Protocol version 4 (IPv4)
• Internet Protocol version 6 (IPv6)
Note: Legacy network layer protocols
are not discussed in this course.
Network Layer Characteristics
IP Encapsulation
• IP encapsulates the transport layer
segment.
• IP can use either an IPv4 or IPv6
packet and not impact the layer 4
segment.
• IP packet will be examined by all
layer 3 devices as it traverses the
network.
• The IP addressing does not change
from source to destination.
Note: NAT will change addressing,
but will be discussed in a later
module.
Characteristics of the IP Protocol
Characteristics of IP
• IP was designed as a protocol
with low overhead – it
provides only the functions
required to deliver a packet
from the source to a
destination.
• An IP packet is sent to the
destination without prior
establishment of a connection
• IP was not designed to track
and manage the flow of
packets.
• These functions, if required, are
performed by other layers –
primarily TCP
Network Layer Characteristics
Connectionless
IP is Connectionless
• IP does not establish a connection with the destination before sending the packet.
• There is no control information needed (synchronizations, acknowledgments, etc.).
• The destination will receive the packet when it arrives, but no pre-notifications are sent by IP.
• If there is atypically TCP at the transport layer). need for connection-oriented traffic, then
another protocol will handle this (
Network Layer Characteristics
Best Effort
IP is Best Effort
• IP will not guarantee delivery of the
packet.
• IP has reduced overhead since there
is no mechanism to resend data that
is not received.
• IP does not expect
acknowledgments.
• IP does not know if the other device
is operational or if it received the
packet.
Network Layer Characteristics
Media Independent
IP is unreliable:
• It cannot manage or fix undelivered or
corrupt packets.
• IP cannot retransmit after an error.
• IP cannot realign out of sequence
packets.
• IP must rely on other protocols for
these functions.
IP is media Independent:
• IP does not concern itself with the type
of frame required at the data link layer
or the media type at the physical layer.
• IP can be sent over any media type:
copper, fiber, or wireless.
Network Layer Characteristics
MTU = how big each
Media Independent (Contd.) packet can be without
fragmentation.
The network layer will establish the Bandwidth = how fast you
Maximum Transmission Unit (MTU). can send packets.
• Network layer receives this from
control information sent by the data
link layer.
• The network then establishes the
MTU size.
Fragmentation is when Layer 3 splits the
IPv4 packet into smaller units.
• Fragmenting causes latency.
• IPv6 does not fragment packets.
• Example: Router goes from Ethernet
to a slow WAN with a smaller MTU
IPv4 Packet
IPv4 Packet
IPv4 Packet Header
IPv4 is the primary communication protocol for the network layer.
The network header has many purposes:
• It ensures the packet is sent in the correct direction (to the destination).
• It contains information for network layer processing in various fields that help
routers and network devices know what to do with the packet.
• The information in the header is used by all layer 3 devices that handle the packet
(Any device working at Layer 3 (like routers) reads the header information to make
routing decisions; where to send the packet next)
IPv4 Packet
IPv4 Packet Header Fields
The IPv4 network header characteristics:
• It is in binary.
• Contains several fields of information
• Diagram is read from left to right, 4 bytes per
line
• The two most important fields are the source
and destination.
Protocols may have one or more functions.
*****All the fragments will carry the same Identification number.
IPv4 Packet
IPv4 Packet Header Fields
Significant fields in the IPv4 header:
Function Description
Version This will be for v4, as opposed to v6, a 4 bit field= 0100
Differentiated Services Used for QoS: DiffServ – DS field or the older IntServ – ToS or Type of Service
Header Checksum Detect corruption in the IPv4 header
Time to Live (TTL) Layer 3 hop count. When it becomes zero the router will discard the packet.
Protocol I.D.s next level protocol: ICMP, TCP, UDP, etc.
Source IPv4 Address 32 bit source address
Destination IPV4 Address 32 bit destination address
IPv6 Packets
IPv6 Packet
Limitations of IPv4
• IPv4 has been updated to address new challenges.
• Three major issues still exist with IPv4:
• IP address depletion – IPv4 has a limited number of unique
public IPv4 addresses available. Although there are about
4 billion IPv4 addresses, the exponential growth of new IP-
enabled devices has increased the need.
• Internet routing table expansion – A routing table contains
the routes to different networks in order to make the best
path determination. As more devices and servers are
connected to the network, more routes are created. A large
number of routes can slow down a router.
• Lack of end-to-end connectivity – Network Address
Translation (NAT) was created for devices to share a single
IPv4 address. However, because they are shared, this can
cause problems for technologies that require end-to-end
connectivity.
IPv6 Packets
IPv6 Overview
• IPv6 was developed by Internet
Engineering Task Force (IETF).
• IPv6 overcomes the limitations of IPv4.
• Improvements that IPv6 provides:
• Increased address space – based on
128 bit address, not 32 bits
• Improved packet handling –
simplified header with fewer fields
• Eliminates the need for NAT – since
there is a huge amount of addressing,
there is no need to use private
addressing internally and be mapped to
a shared public address
IPv6 Packets
IPv4 Packet Header Fields in the IPv6 Packet Header
• The IPv6 header is simplified,
but not smaller.
• The header is fixed at 40 Bytes
or octets long.
• Several IPv4 fields were
removed to improve
performance.
• Some IPv4 fields were removed
to improve performance:
• Flag
• Fragment Offset
• Header Checksum
IPv6 Packets
IPv6 Packet Header
Significant fields in the IPv4 header:
Function Description
Version This will be for v6, as opposed to v4, a 4 bit field= 0110
Traffic Class Used for QoS: Equivalent to DiffServ – DS field
Flow Label Informs device to handle identical flow labels the same way, 20 bit field
Payload Length This 16-bit field indicates the length of the data portion or payload of the IPv6
packet
Next Header I.D.s next level protocol: ICMP, TCP, UDP, etc.
Hop Limit Replaces TTL field Layer 3 hop count (maximum number of hops (routers)
that the packet can pass through before being destroyed.)
Source IPv4 Address 128 bit source address
Destination IPV4 Address 128 bit destination address
IPv6 Packets
IPv6 Packet Header (Cont.)
IPv6 packet may also contain extension headers (EH).
EH headers characteristics:
• provide optional network layer information
• are optional
• are placed between IPv6 header and the payload
• may be used for fragmentation, security, mobility support, etc.
Note: Unlike IPv4, routers do not fragment IPv6 packets.
How a Host Routes
How a Host Routes
Host Forwarding Decision • An important role of the network
layer is to direct packets between
hosts. A host can send a packet to:
• Itself – A host can ping itself for testing
purposes using 127.0.0.1 which is referred
to as the loopback interface.
• Local host – This is a host on the same local
network as the sending host. The hosts
share the same network address.
• Remote host – This is a host on a remote
network. The hosts do not share the same
network address.
• The source IPv4 address and
subnet mask is compared with the
destination address and subnet
mask in order to determine if the
host is on the local network or
remote network.
How a Host Routes
Default Gateway • The default gateway is the
network device that can route
traffic out to other networks. It
is the router that routes traffic
out of a local network.
• This occurs when the
destination host is not on the
same local network as the
sending host.
• The default gateway will know
where to send the packet using
its routing table.
• The sending host does not need
to know where to send the
packet other than to the default
gateway – or router.
How a Host Routes
A Host Routes to the Default Gateway
• The host will know the default
gateway (DGW) either statically or
through DHCP in IPv4.
• IPv6 sends the DGW through a
router solicitation (RS) or can be
configured manually.
• A DGW is static route which will be
a last resort route in the routing
table.
• All device on the LAN will need the DHCP automatically gives devices on a network (like your
DGW of the router if they intend to laptop) their IP address and other network settings so they
can connect to the internet or local network without manual
send traffic remotely. setup.
How a Host Routes
Host Routing Tables
• On Windows, route print
or netstat -r to display
the PC routing table
• Three sections displayed
by these two commands:
• Interface List – all
potential interfaces and
MAC addressing
• IPv4 Routing Table
• IPv6 Routing Table
Introduction to Routing
Introduction to Routing
Router Packet Forwarding Decision
What happens when the router receives the frame from the host device?
Introduction to Routing
IP Router Routing Table
There three types of routes in a router’s routing table:
• Directly Connected – These routes are automatically added by the router, provided the interface
is active and has addressing.
• Remote – These are the routes the router does not have a direct connection and may be learned:
• Manually – with a static route
• Dynamically – by using a routing protocol to have the routers share their information with each other
• Default Route – this forwards all traffic to a specific direction when there is not a match in the
routing table
Introduction to Routing
Static Routing
Static Route Characteristics:
• Must be configured manually
• Must be adjusted manually by the
administrator when there is a change
in the topology
• Good for small non-redundant
networks
• Often used in conjunction with a
dynamic routing protocol for
configuring a default route
Introduction to Routing
Dynamic Routing
Dynamic Routes Automatically:
• Discover remote networks
• Maintain up-to-date information
• Choose the best path to the
destination
• Find new best paths when there is a
topology change
Dynamic routing can also share static
default routes with the other routers.
Introduction to Routing
Introduction to an IPv4 Routing Table
The show ip route command shows the
following route sources:
• L - Directly connected local interface IP
address
• C – Directly connected network
• S – Static route was manually configured
by an administrator
• O – OSPF
• D – EIGRP
This command shows types of routes:
• Directly Connected – C and L
• Remote Routes – O, D, etc.
• Default Routes – S*