Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 57

Tishk International University

Faculty of Engineering Safwan Mawlood


Computer Engineering Department

NETWORK LAYER

Safwan Mawlood
Safwan Mawlood
Objectives
What will I learn to do in this module?

Topic Title Topic Objective


Network Layer Explain how the network layer uses IP protocols for
Characteristics reliable communications.
Explain the role of the major header fields in the
IPv4 Packet
IPv4 packet.
Explain the role of the major header fields in the
IPv6 Packet
IPv6 packet.
Explain how network devices use routing tables to
How a Host Routes
direct packets to a destination network.
Explain the function of fields in the routing table of a
Router Routing Tables
router.
Network Layer
Characteristics

12/06/2022 Safwan Mawlood 3


Network Layer

 The network layer is responsible for the source-to-destination delivery of


a packet, possibly across multiple networks (links). Whereas the data link
layer oversees the delivery of the packet between two systems on the
same network (links), the network layer ensures that each packet gets
from its point of origin to its final destination.

 The network layer's addressing scheme is used by devices to determine the


destination of data as it moves through the network.

12/06/2022 Safwan Mawlood 4


12/06/2022 Safwan Mawlood 5
Communication from Host
to Host

 To accomplish this end-to-end communication,


Layer 3 uses four basic processes:
- Addressing
- Encapsulation (Data-Segment-…Bits)
- Routing (need intermediary devices: router)
- Decapsulation (Bits…Data)

Safwan Mawlood 12/06/2022 6


Network Layer – Communication from
Host to Host

1. Addressing
 End devices must be configured with
a unique IP address for identification
on the network.

 When an address is added to a


device, the device is referred to as a
host.

Addressing end devices -

12/06/2022 Safwan Mawlood 7


Network Layer – Communication from
Host to Host

Encapsulation
The network layer encapsulates the protocol data unit
(PDU) from the transport layer into a packet. The
encapsulation process adds IP header information,
such as the IP address of the source (sending) and
destination (receiving) hosts. The encapsulation
process is performed by the source of the IP packet.

12/06/2022 Safwan Mawlood 8


Network Layer – Communication from
Host to Host

3. Routing
The network layer provides services to direct the packets to a
destination host on another network. To travel to other networks,
the packet must be processed by a router.

The role of the router is to select the best path and direct packets
toward the destination host in a process known as routing.

 A packet may cross many routers before reaching the destination


host. Each router a packet crosses to reach the destination host is
called a hop.

12/06/2022 Safwan Mawlood 9


Network Layer – Communication from
Host to Host

4. Decapsulation
When the packet arrives at the network layer of the
destination host, the host checks the IP header of the
packet. If the destination IP address within the header
matches its own IP address, the IP header is removed
from the packet. After the packet is de-encapsulated
by the network layer, the resulting Layer 4 PDU is
passed up to the appropriate service at the transport
layer. The de-encapsulation process is performed by
the destination host of the IP packet.

10

12/06/2022 Safwan Mawlood


Protocols involved in Network layer

 Internet Protocol version 4 (IPv4) –Is the host-to-host delivers protocol for the Internet.
IP is an unreliable and connectionless. IP Not provide error control or flow control. IP
needs a protocol called ARP to find the MAC address of the next hop.

 Internet Protocol version 6 (IPv6) -IPv6 also known as IPng (Internetworking Protocol,
next generation), was proposed and is now a standard. In IPv6, the Internet protocol
was extensively modified to accommodate the unforeseen growth of the Internet. The
format and the length of the IP address were changed along with the packet format.
Related protocols, such as ICMP,

12/06/2022 Safwan Mawlood 11


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 a need for connection-oriented traffic, then another protocol will handle this
(typically TCP at the transport layer).
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.
IP datagram

 Packets in the IP layer are called datagram’s. A datagram is a variable-length


packet consisting of two parts : header and data.

  The IPv4 packet header is used to ensure that this packet is delivered to its next
stop on the way to its destination end device.

 Header: is 20-60 bytes in the length and contains information essential to the
touting and delivery.

12/06/2022 Safwan Mawlood 15


Fields in the IPv4 Packet Header

12/06/2022 Safwan Mawlood 16


Fields in the IPv4 Packet Header

Header length (HLEN). This 4-bit field defines the total length of the datagram header in 4-byte words. This field is needed because the length of the header is
variable (between 20 and 60 bytes). When there are no options, the header length is 20 bytes.

12/06/2022 Safwan Mawlood 17


12/06/2022 Safwan Mawlood 18
IP V4 Packet Header

 Time-to-Live: Demo

12/06/2022 Safwan Mawlood 19


20

12/06/2022 Safwan Mawlood


Networks – Separating Hosts into
Common Groups

 As the number of hosts on the network grows, more planning is required to manage and
address the network.
Rather than having all hosts everywhere connected to one vast global
network, it is more practical and manageable to group hosts into smaller
networks.
 These smaller networks are often called subnetworks or subnets.

12/06/2022 Safwan Mawlood 21


Networks – Separating Hosts into
Common Groups

 As shown in the figure, networks can be grouped based on factors


that include:
Geographic location
Purpose
Ownership

12/06/2022 Safwan Mawlood 22


23

12/06/2022 Safwan Mawlood


24

12/06/2022 Safwan Mawlood


25

12/06/2022 Safwan Mawlood


Common issues with large networks are:

1. Performance degradation : Dividing large networks so that hosts who


need to communicate are grouped together reduces the traffic across
the internetworks.

2. Security issues :Dividing networks based on ownership means that


access to and from resources outside each network can be prohibited,
allowed, or monitored

12/06/2022 Safwan Mawlood 26


Common issues with large networks are:

3. Address Management:

Dividing large networks so that hosts who need to communicate are


grouped together reduces the unnecessary overhead of all hosts
needing to know all addresses.

12/06/2022 Safwan Mawlood 27


12/06/2022 Safwan Mawlood 28
Address Space

 A protocol such as IPv4 that defines addresses has an 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 because each bit can have two
different values (0 or 1) and N bits can have 2 N values.

12/06/2022 Safwan Mawlood 29


Who Assigns the Different Address?

 A company that wishes to have network hosts accessible from the Internet must have
a block of public addresses assigned.

 Internet Assigned Numbers Authority (IANA) (http://www.iana.net) is the master


holder of the IP addresses.
The IP multicast addresses and the IPv6 addresses are obtained directly from IANA.
Until the mid-1990s, all IPv4 address was managed by the IANA.
At that time, the remaining IPv4 address was allocated to various other registries to
manage for regional areas.

 These registration companies are called Regional Internet Registries (RIRs). There
are 5 RIRs:
AfriNIC (African Network Information Centre) - Africa Region http://www.afrinic.net
APNIC (Asia Pacific Network Information Centre) - Asia/Pacific Region
http://www.apnic.net
ARIN (American Registry for Internet Numbers) - North America Region http://www.arin.net
LACNIC (Regional Latin-American and Caribbean IP Address Registry) - Latin America and
some Caribbean Islands http://www.lacnic.net
RIPE NCC (Reseaux IP Europeans) - Europe, the Middle East, and Central Asia
http://www.ripe.net
12/06/2022 Safwan Mawlood 30
ISPs

 To get access to the Internet, we have to connect our network to


the Internet using an Internet Service Provider (ISP).
ISP generally provides to its customers DNS services, e-mail services,
and a website.

 Most companies or organizations obtain their IPv4 address blocks


from an ISP.
The ISP loans or rents these addresses to the organization.
If we choose to move Internet connectivity to another ISP, the new
ISP will provide us new addresses from their address blocks.

12/06/2022 Safwan Mawlood 31


Notation

1. Binary Notation
 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 as a 32-
bit address or a 4-byte address. The following is an example of an IPv4 address in
binary notation:

 11000000 10101000 0000001 00001010

12/06/2022 Safwan Mawlood 32


Dotted-Decimal Notation

 To make the IPv4 address more compact and easier to read, Internet addresses are
usually written in decimal form with a decimal point (dot) separating the bytes. The
following is the dotted-decimal notation of the above address:
 192.168.1.10

12/06/2022 Safwan Mawlood 33


Classful Addressing

12/06/2022 Safwan Mawlood 34


Example

12/06/2022 Safwan Mawlood 35


12/06/2022 Safwan Mawlood 36
12/06/2022 Safwan Mawlood 37
Portions

 Network Portions
For each IPv4 address, some portion of the high-order bits represents the network address.

 At Layer 3, we define a network as a group of hosts that have identical bit patterns in the network address
portion of their addresses.

 Host Portions
The number of bits used in this host portion determines the number of hosts that we can have within the network.

 For example, if we need to have at least 200 hosts in a particular network, we would need to use enough bits in
the host portion to be able to represent at least 200 different bit patterns.

 To assign a unique address to 200 hosts, we would use the entire last octet. With 8 bits, a total of 256 different
bit patterns can be achieved. This would mean that the bits for the upper three octets would represent the
network portion.

12/06/2022 Safwan Mawlood 38


Classful Addressing

12/06/2022 Safwan Mawlood 39


Types of Addresses in an IPv4 Network

 Broadcast Address
The IPv4 broadcast address is a special address that
allows communication to all the hosts in that network.
The broadcast address uses the highest address in the
network range.
 This is the address in which the bits in the host portion are
all 1s.
For the network 10.0.0.0 /24 the broadcast address
would be 10.0.0.255.
 This address is also referred to as the directed broadcast.

 Host Addresses
we assign the values between the network address and
the broadcast address to the devices in that network.

12/06/2022 Safwan Mawlood 40


Special IPv4 Addresses

 There are certain addresses that cannot be assigned to hosts.

 There are special addresses that can be assigned to hosts but with restrictions.

 Network and Broadcast Addresses


Within each network the first (network) address and last (broadcast) addresses
cannot be assigned to hosts.

 Default Route
The default route as 0.0.0.0.
The default route is used when a specific route is not available.
This also cover all addresses in the 0.0.0.0 - 0.255.255.255.

12/06/2022 Safwan Mawlood 41


Types of IPv4 Addresses
Special User IPv4 Addresses

 Loopback addresses (127.0.0.0 /8 or 127.0.0.1)


 Used on a host to test if the TCP/IP
configuration is operational.
 Link-Local addresses (169.254.0.0 /16 or
169.254.0.1)
 Commonly known as Automatic Private IP
Addressing (APIPA) addresses.
 Used by Windows client to self configure if no
DHCP server available.
 TEST-NET addresses (192.0.2.0/24 or 192.0.2.0 to
192.0.2.255)
 Used for teaching and learning.
Public and Private Addresses
0.0.0.0 to 223.255.255.255

 Public Addresses
The majority of the addresses are public addresses.
These addresses are designed to be used in the hosts that are publicly accessible
from the Internet.

 Private addresses
There are blocks of addresses that require no Internet access.
 10.0.0.0 to 10.255.255.255 (10.0.0.0 /8)
 172.16.0.0 to 172.31.255.255 (172.16.0.0 /12)
 192.168.0.0 to 192.168.255.255 (192.168.0.0 /16)
Hosts in different networks may use the same private addresses.
The hosts in the private networks use IP addresses that are
unique within their networking environment.

12/06/2022 Safwan Mawlood 43


Legacy IPv4 Addressing

 Limitations to the Class-based System


Classful allocation of address space wasted many addresses,
which exhausted the availability of IPv4 addresses.
 For example, a company that had a network with 260 hosts would need
to be given a class B address with more than 65,000 addresses.
This classful system was all but abandoned in the late 1990s

 Classless Addressing
The system that we currently use is referred to as classless
addressing.
 With the classless system, address blocks appropriate to the
number of hosts are assigned to companies or organizations
without regard to the unicast class.

12/06/2022 Safwan Mawlood 44


IPv4 Network: Network Prefixes

 How do we know how many bits represent the network


portion and how many bits represent the host portion?
A prefix length.

 The prefix length is the number of bits in the address in


the network portion.

12/06/2022 Safwan Mawlood 45


Planning to Address the Network

 The allocation of these addresses inside the networks should be planned and documented
for the purpose of:
Preventing duplication of addresses
 Each host in an internetwork must have a unique address.
Providing and controlling access
 For example, if a server has a random address assigned, blocking access to its address is difficult and clients
may not be able to locate this resource.
Monitoring security and performance
 If we have proper planning and documentation of the network addressing, we can identify the device on the
network that has a problematic address.

 Assigning Addresses within a Network

 Within a network, there are different types of hosts. Some examples of different types of
hosts are:
End devices for users
Servers and peripherals
Hosts that are accessible from the Internet
Intermediary devices

 Each of these different device types should be allocated to a logical block of addresses
within the address range of the network.
12/06/2022 Safwan Mawlood 46
Static Address for End User Devices

 With a static assignment, the network administrator must manually


configure the network information for a host (figure).
At a minimum, this includes entering the host IP address, subnet mask, and
default gateway.

 Static addresses have some advantages over dynamic addresses.


For instance, they are useful for printers, servers, and other networking
devices that need to be accessible to clients on the network.
 If hosts normally access a server at a particular IP address, it would cause
problems if that address changed.
Additionally, static assignment of addressing information can provide
increased control of network resources.
 However, it can be time-consuming to enter the information on each host.

 When using static IP addressing, it is necessary to maintain an accurate


list of the IP address assigned to each device.

12/06/2022 Safwan Mawlood 47


The Subnet Mask – Defining the network and Host Portions

 As we learned earlier, an IPv4 address has a network portion


and a host portion.
To define the network and host portions, the devices use a
separate 32-bit pattern called a subnet mask.

 We express the subnet mask in the same dotted decimal


format as the IPv4 address.
The subnet mask is created by placing a binary 1 in each bit
position that represents the network portion
Placing a binary 0 in each bit position that represents the host
portion.

 As shown in the figure, a /24 prefix is expressed as subnet


mask as 255.255.255.0 (11111111.11111111.11111111.00000000).
The remaining bits (low order) of the subnet mask are zeroes,
indicating the host address within the network.

12/06/2022 Safwan Mawlood 48


Mask

Although the length of the netid and hostid (in bits) is predetermined in classful
addressing, we can also use a mask (also called the default mask)

12/06/2022 Safwan Mawlood 49


Subnetting

 During the era of classful addressing, subnetting was introduced. If an organization


was granted a large block in class A or B, it could divide the addresses into several
contiguous groups and assign each group to smaller networks (called subnets) or, in
rare cases, share part of the addresses with neighbors. Subnetting increases the
number of Is in the mask, as we will see later when we discuss classless addressing.

12/06/2022 Safwan Mawlood 50


The Subnet Mask – Defining the network and Host Portions

For example, let's look at the host 172.16.4.35/27:

 IP address
172.16.20.35
10101100.00010000.00010100.00100011

 subnet mask
255.255.255.224
11111111.11111111.11111111.11100000

 network address
172.16.20.32
10101100.00010000.00010100.00100000

12/06/2022 Safwan Mawlood 51


Classless Inter-Domain Routing (CIDR)
 Steps to calculate a route summary
 List networks in binary format
 Count number of left most
matching bits to determine
summary route’s mask
 Copy the matching bits and
add zero bits to determine the
summarized network address
VLSM (Variable Length Subnet Masking )
 Classful routing
 Only allows for one subnet
mask for all networks
 VLSM & Classless routing
 This is the process of
subnetting a subnet
 More than one subnet mask
can be used
 More efficient use of IP
addresses as compared to
classful IP addressing
VLSM

 Variable Length Subnet Masking is a technique that allows network administrators to


divide an IP address space to subnets of different sizes
 Allow the use of different subnet masks in one network
 Subnetting the subnet

12/06/2022 Safwan Mawlood 54


12/06/2022 Safwan Mawlood 55
Benefits with VLSM

 More efficient use of IP addresses

 Variable size of the networks

 Greater capability to use route summarization

 Will reduce the entries in the routing table

12/06/2022 Safwan Mawlood 56


Summary

12/06/2022 Safwan Mawlood 57

You might also like