0% found this document useful (0 votes)
23 views65 pages

Module 3 Network Layer

The document discusses the network layer of data communications, focusing on packetizing, routing, and forwarding, as well as error and flow control. It explains IPv4 addressing, including address space, classful addressing, subnetting, and classless addressing, along with special addresses and the Dynamic Host Configuration Protocol (DHCP). Additionally, it covers routing algorithms such as distance-vector and link-state routing, including protocols like RIP, OSPF, and BGP4.

Uploaded by

Sahana G
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views65 pages

Module 3 Network Layer

The document discusses the network layer of data communications, focusing on packetizing, routing, and forwarding, as well as error and flow control. It explains IPv4 addressing, including address space, classful addressing, subnetting, and classless addressing, along with special addresses and the Dynamic Host Configuration Protocol (DHCP). Additionally, it covers routing algorithms such as distance-vector and link-state routing, including protocols like RIP, OSPF, and BGP4.

Uploaded by

Sahana G
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 65

NETWORK LAYER

CHAPTER 18.1, 18.2, 18.4,,20.1-20.3, 21.3.2, 22.2


FOROUZAN 5TH EDITION, TMH
DATA COMMUNICATIONS AND NETWORKING
Communication at
• 18.1.1 Packetizing
Network layer
• Encapsulating the payload (data received from
upper layer) in a network-layer packet at the
source and decapsulating the payload from the
network-layer packet at the destination.
• 18.1.2 Routing and Forwarding
• The network layer is responsible for routing the
packet from its source to the destination. A physical
network is a combination of networks (LANs and
WANs) and routers that connect them. This means
that there is more than one route from the source to
the destination. The network layer is responsible for
finding the best one among these possible routes.
• Forwarding
• If routing is applying strategies and running some
routing protocols to create the decision-making
tables for each router, forwarding can be defined as
the action applied by each router when a packet
arrives at one of its interfaces.
• The decision-making table a router normally uses for
applying this action is sometimes called the
forwarding table and sometimes the routing table.
18.1.3 Other Services
• Error Control
• 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.
• Flow Control
• The network layer in the Internet, however, does not directly provide any flow
control. The datagrams are sent by the sender when they are ready, without
any attention to the readiness of the receiver.
• since there is no error control in this layer, the job of the network layer at the
receiver is so simple that it may rarely be overwhelmed.
• Second, the upper layers that use the service of the network layer can
implement buffers to receive data from the network layer as they are ready and
do not have to consume the data as fast as it is received.
• Third, flow control is provided for most of the upper-layer protocols that use the
services of the network layer, so another level of flow control makes the
18.2 Packet Switching
18.4 IPV4 ADDRESSES
• The identifier used in the IP layer of the TCP/IP protocol suite to identify the
connection of each device to the Internet is called the Internet address or IP address.
• An IPv4 address is a 32-bit address that uniquely and universally defines the
connection of a host or a router to the Internet.
• The IP address is the address of the connection, not the host or the router, because if
the device is moved to another network, the IP address may be changed.
• IPv4 addresses are unique in the sense that each address defines one, and only one,
connection to the Internet. If a device has two connections to the Internet, via two
networks, it has two IPv4 addresses.
• 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.
18.4.1 Address Space

• A protocol like 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 b bits to define an address, the address
32
space is 2b because each bit can have two different values (0
or 1).
• IPv4 uses 32-bit addresses, which means that the address
space is 232 or 4,294,967,296 (more than four billion).
• If there were no restrictions, more than 4 billion devices
could be connected to the Internet.
CLASSFUL
ADDRESSING
• An IPv4 address was designed with a fixed-length prefix, but to accommodate both small and
large networks, three fixed-length prefixes were designed instead of one (n = 8, n = 16, and n =
24).
• In class A, the network length is 8 bits, but since the first bit, which is 0, defines the class, we
can have only seven bits as the network identifier. This means there are only 27 = 128 networks
in the world that can have a class A address .
• In class B, the network length is 16 bits, but since the first two bits, which are(10) 2, define the
class, we can have only 14 bits as the network identifier. This means there are only 2 14 = 16,384
networks in the world that can have a class B address.
• All addresses that start with (110) 2 belong to class C. In class C, the network
length is 24 bits, but since three bits define the class, we can have only 21
bits as the network identifier. This means there are 221 = 2,097,152
networks in the world that can have a class C address.
• Class D is not divided into prefix and suffix. It is used for multicast
addresses. All addresses that start with 1111 in binary belong to class E. As
in Class D, Class E is not divided into prefix and suffix and is used as reserve
Subnetting and Supernetting
• To alleviate address depletion, two strategies were proposed and, to
some extent, implemented: subnetting and supernetting.
• In subnetting, a class A or class B block is divided into several subnets.
Each subnet has a larger prefix length than the original network. For
example, if a network in class A is divided into four subnets, each
subnet has a prefix of nsub = 10.
• At the same time, if all of the addresses in a network are not used,
subnetting allows the addresses to be divided among several
organizations. This idea did not work because most large organizations
were not happy about dividing the block and giving some of the unused
addresses to smaller organizations.
• While subnetting was devised to divide a large block into smaller ones,
supernetting was devised to combine several class C blocks into a
larger block to be attractive to organizations that need more than the
256 addresses available in a class C block. This idea did not work either
because it makes the routing of packets more difficult
18.4.3 Classless Addressing
• The above examples show that, given any address, we can find all
information about the block. The first address, the network address, is
particularly important because it is used in routing a packet to its
destination network.
• For the moment, let us assume that an internet is made of m networks and
a router with m interfaces.
• When a packet arrives at the router from any source host, the router needs
to know to which network the packet should be sent: from which interface
the packet should be sent out.
• When the packet arrives at the network, it reaches its destination host using
another strategy that we discuss later. Figure 18.22 shows the idea.
• After the network address has been found, the router consults its
forwarding table to find the corresponding interface from which the packet
should be sent out. The network address is actually the identifier of the
network; each network is identified by its network address.
• More levels of hierarchy can be created using subnetting.
Subnetting
• An organization (or an ISP) that is granted a range of addresses may divide
the range into several subranges and assign each subrange to a
subnetwork (or subnet).
• Note that nothing stops the organization from creating more levels.
• A subnetwork can be divided into several sub-subnetworks. A sub-
subnetwork can be divided into several sub-sub-subnetworks, and so on.
• Designing Subnets
• The subnetworks in a network should be carefully designed to enable the
routing of packets.
• We assume the total number of addresses granted to the organization is N,
the prefix length is n, the assigned number of addresses to each
subnetwork is Nsub, and the prefix length for each subnetwork is nsub.
• Then the following steps need to be carefully followed to guarantee the
proper operation of the subnetworks.
• The number of addresses in each subnetwork should be a power of 2.
• The prefix length for each subnetwork should be found using the following formula:
Example 19.10

An ISP is granted a block of addresses starting with 190.100.0.0/16 (65,536 addresses). The ISP

needs to distribute these addresses to three groups of customers as follows:

a. The first group has 64 customers; each needs 256

addresses.

b. The second group has 128 customers; each needs 128

addresses.

c. The third group has 128 customers; each needs 64

addresses.

Design the subblocks and find out how many addresses are still available after these allocations.
Example 19.10 (continued)

Group 1

For this group, each customer needs 256 addresses. This means that 8 bits are needed to define

each host. The prefix length is then 32 − 8 = 24. The addresses are
Example 19.10 (continued)

Group 2

For this group, each customer needs 128 addresses. This means that 7 bits are needed to define

each host. The prefix length is then 32 − 7 = 25. The addresses are
Example 19.10 (continued)

Group 3

For this group, each customer needs 64 addresses. This means that 6 bits are needed to each host.

The prefix length is then 32 − 6 = 26. The addresses are

Number of granted addresses to the ISP: 65,536

Number of allocated addresses by the ISP: 40,960

Number of available addresses: 24,576


Address Aggregation
• One of the advantages of the CIDR strategy is address aggregation
(sometimes called address summarization or route summarization).
• When blocks of addresses are combined to create a larger block, routing
can be done based on the prefix of the larger block. ICANN assigns a large
block of addresses to an ISP.
• Each ISP in turn divides its assigned block into smaller subblocks and
grants the subblocks to its customers.
• This-host Address
Special Addresses
• The only address in the block 0.0.0.0/32 is called the this-host address. It is used
whenever a host needs to send an IP datagram but it does not know its own address to
use as the source address.
• Limited-broadcast Address
• The only address in the block 255.255.255.255/32 is called the limited-broadcast
address. It is used whenever a router or a host needs to send a datagram to all devices
in a network. The routers in the network, however, block the packet having this address
as the destination; the packet cannot travel outside the network.
• Loopback Address
• The block 127.0.0.0/8 is called the loopback address. A packet with one of the
addresses in this block as the destination address never leaves the host; it will remain in
host. Any address in the block is used to test a piece of software in the machine. For
example, we can write a client and a server program in which one of the addresses in
the block is used as the server address. We can test the programs using the same host
to see if they work before running them on different computers
• Private Addresses
• Four blocks are assigned as private addresses: 10.0.0.0/8, 172.16.0.0/12,
192.168.0.0/16, and 169.254.0.0/16.
• Multicast Addresses
Dynamic Host Control Protocol
• After a block of addresses are assigned to an organization, the network administration can
manually assign addresses to the individual hosts or routers. However, address assignment in
an organization can be done automatically using the Dynamic Host Configuration
Protocol (DHCP).
• DHCP is an application-layer program, using the client-server paradigm, that actually helps
TCP/IP at the network layer.
• DHCP has found such widespread use in the Internet that it is often called a plugand-play
protocol. In can be used in many situations.
• A network manager can configure DHCP to assign permanent IP addresses to the host and
routers. DHCP can also be configured to provide temporary, on demand, IP addresses to
hosts.
• The second capability can provide a temporary IP address to a traveller to connect her laptop
to the Internet while she is staying in the hotel.
• It also allows an ISP with 1000 granted addresses to provide services to 4000 households,
assuming not more than one-forth of customers use the Internet at the same time.
Dynamic Host Control Protocol
OPERATION
OF DHCP
18.4.5 Network Address Resolution (NAT)
20.1.2 Least-Cost Routing
20.2.1 Distance-Vector Routing
• Bellman-Ford Equation
Bellman-Ford Routing

Count-to-Infinity Problem:

Distance Vector Routing is susceptible to the count-to-


infinity problem where inaccurate information takes time to
propagate through the network, potentially causing temporary
routing loops.
• Split Horizon:
• To mitigate the count-to-infinity problem, the "split horizon" technique
is often employed, where a router does not advertise routes back to
the neighbor from which it learned them.
• Poison Reverse:
• Another technique to prevent routing loops is "poison reverse," where
a router advertises an infinite distance for a route it learned from a
neighbor.
20.2.2 Link-State Routing
RO U T IN G A L G O R I T H M S
Dijkstra's Algorithm:
1.Fig. 5-7(a) shows a
weighted, undirected graph
with labels representing distance.
2.Finding the shortest path from A to D
involves marking nodes permanent and
relabeling.
RO U T IN G A L G O R I T H M S
Dijkstra's Algorithm:
1.Finding the shortest path from A to
D involves marking nodes
permanent and relabeling.
20.3 UNICAST
ROUTING
PROTOCOLS
20.3.2 Routing Information
Protocol (RIP)
20.3.2 Routing Information Protocol
(RIP)
20.3.3 Open Shortest Path First (OSPF)
• Open Shortest Path First (OSPF) is also an intradomain
routing protocol like RIP, but it is based on the link-state routing
protocol we described earlier in the chapter. OSPF is an open
protocol, which means that the specification is a public
document.
20.3.4 Border Gateway Protocol Version
4 (BGP4)

You might also like