Lect13 Intro Network Layer

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 98

Position of network layer

Network layer duties


Packetizing

The first duty of the network layer is definitely


packetizing: encapsulating the payload in a network-
layer packet at the source and decapsulating the
payload from the network-layer packet at the
destination. In other words, one duty of the network
layer is to carry a payload from the source to the
destination without changing it or using it. The
network layer is doing the service of a carrier such
as the postal office, which is responsible for delivery
of packages from a sender to a receiver without
changing or using the contents.
Routing and Forwarding

Other duties of the network layer, which are as


important as the first, are routing and forwarding,
which are directly related to each other.
Figure: Forwarding process

Forwarding Send the packet


value out of interface 2
B Data B Data
PACKET SWITCHING

A kind of switching occurs at the network


layer. A router, in fact, is a switch that creates
a connection between an input port and an
output port (or a set of output ports), just as an
electrical switch connects the input to the
output to let electricity flow.
Datagram Approach

When the Internet started, to make it simple, the


network layer was designed to provide a
connectionless service in which the network-layer
protocol treats each packet independently, with each
packet having no relationship to any other packet.
The idea was that the network layer is only
responsible for delivery of packets from the source to
the destination. In this approach, the packets in a
message may or may not travel the same path to
their destination.
Figure : A connectionless packet-switched network
Figure : Forwarding process in a router when used in a
connectionless network

SA DA Data SA DA Data
Virtual-Circuit Approach

In a connection-oriented service (also called virtual-


circuit approach), there is a relationship between all
packets belonging to a message. Before all
datagrams in a message can be sent, a virtual
connection should be set up to define the path for
the datagrams. After connection setup, the
datagrams can all follow the same path. In this type
of service, not only must the packet contain the
source and destination addresses, it must also
contain a flow label, a virtual circuit identifier that
defines the virtual path the packet should follow.
Figure : A virtual-circuit packet-switched network
Figure : Forwarding process in a router when used in a virtual
circuit network
Figure : Sending request packet in a virtual-circuit network

A to B

A to B

A to B A to B
Figure : Sending acknowledgments in a virtual-circuit network
Figure : Flow of one packet in an established virtual circuit
Network Layer Design Isues
• Store-and-Forward Packet Switching
• Services Provided to the Transport Layer
• Implementation of Connectionless Service
• Implementation of Connection-Oriented
Service
• Comparison of Virtual-Circuit and Datagram
Subnets
Store-and-Forward Packet Switching
The environment of the network layer
protocols.
Implementation of Connectionless
Service

Routing within a diagram subnet.


Implementation of Connection-Oriented
Service

Routing within a virtual-circuit subnet.


Comparison of Virtual-Circuit and Datagram
Subnets

5-4
NETWORK-LAYER PERFORMANCE

The upper-layer protocols that use the service


of the network layer expect to receive an ideal
service, but the network layer is not perfect.
The performance of a network can be
measured in terms of delay, throughput, and
packet loss. Congestion control is an issue that
can improve the performance.
Delay

All of us expect instantaneous response from a


network, but a packet, from its source to its
destination, encounters delays.
The delays in a network can be divided into four
types: transmission delay, propagation delay,
processing delay, and queuing delay.
Throughput

Throughput at any point in a network is defined as the


number of bits passing through the point in a second,
which is actually the transmission rate of data at that
point. In a path from source to destination, a packet
may pass through several links (networks), each with a
different transmission rate. How, then, can we
determine the throughput of the whole path?
Figure : Throughput in a path with three links in a series
Figure : A path through the Internet backbone
Figure : Effect of throughput in shared links
Packet Loss

Another issue that severely affects the performance


of communication is the number of packets lost
during transmission. When a router receives a
packet while processing another packet, the received
packet needs to be stored in the input buffer waiting
for its turn. A router, however, has an input buffer
with a limited size. A time may come when the buffer
is full and the next packet needs to be dropped. The
effect of packet loss on the Internet network layer is
that the packet needs to be resent, which in turn may
create overflow and cause more packet loss.
Congestion Control

Congestion control is a mechanism for improving


performance. Although congestion at the network
layer is not explicitly addressed in the Internet
model, the study of congestion at this layer may help
us to better understand the cause of congestion at
the transport layer and find possible remedies to be
used at the network layer.
Congestion at the network layer is related to two
issues, throughput and delay.
Figure Packet delay and throughput as functions of load
Figure : Backpressure method for alleviating congestion
Figure : Choke packet
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.
IP Addressing

• Primary job of IP – delivering messages


• IP Addressing
– Network Interface Identification
– Routing
• Become more complicated with subnetting
and classless addressing
Introduction

• You can probably work with decimal


numbers much easier than with the binary
numbers needed by the computer.
• Working with binary numbers is time-
consuming & error-prone.
Address Space
A protocol like IPv4 that defines addresses has an
address space.

addr1
RULE: addr15
addr2
If a protocol uses N bits to
…………..
define an address,addr41 addr226
addr31 space is 2N
the address
………….. …………..
because each bit can have two
different values (0 and 1)
and N bits can have 2N values.
The address space of IPv4 is
232
or
4,294,967,296.
Figure : Three different notations in IPv4 addressing
Figure : Hierarchy in addressing
Classful Addressing

When the Internet started, 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).
The whole address space was divided into five
classes (class A, B, C, D, and E), as shown in Figure
18.18. This scheme is referred to as classful
addressing. Although classful addressing belongs to
the past, it helps us to understand classless
addressing, discussed later.
Finding the class in binary notation
Finding the class in decimal notation
Netid and hostid
Figure : Occupation of the address space in classful addressing
Network address
Converting to Decimal (Cont.)

• What then do you suppose is the largest


decimal number that can be expressed in
an octet?

Eight 1’s (1111 1111)


Converting to Decimal (Cont.)

• Now, for 11111111, what is its


equivalent decimal value?
27 26 25 24 23 22 21 20
1 1 1 1 1 1 1 1
128 64 32 16 8 4 2 1

The binary number 1111 1111 converts into the decimal


number:
128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255
Converting to Decimal (Cont.)

• Therefore, the largest decimal number that


can be stored in an IP address octet is
255.
Example 1

Change the following IP address from binary


notation to dotted-decimal notation.
10000001 00001011 00001011 11101111

Solution

129.11.11.239
Example 2

Change the following IP address from


dotted-decimal notation to binary notation.
111.56.45.78

Solution

01101111 00111000 00101101 01001110


Example 3

Find the error, if any, in the following IP


address:
111.56.045.78

Solution

There are no leading zeroes in


dotted-decimal notation (045).
Example 3 (continued)

Find the error, if any, in the following IP


address:
75.45.301.14

Solution

In dotted-decimal notation,
each number is less than or
equal to 255; 301 is outside this range.
Example 4

Change the following IP addresses from


binary notation to hexadecimal notation.
10000001 00001011 00001011 11101111

Solution

0X810B0BEF or 810B0BEF16
Finding the address class
Example 5

How can we prove that we have


2,147,483,648 addresses in class A?
Solution

In class A, only 1 bit defines the class.


The remaining 31 bits are available
for the address. With 31 bits,
we can have 231 or 2,147,483,648 addresses.
Example 6

Find the class of the address:


00000001 00001011 00001011 11101111

Solution

The first bit is 0. This is a class A address.


Example 6 (Continued)

Find the class of the address:


11000001 10000011 00011011 11111111

Solution

The first 2 bits are 1; the third bit is 0.


This is a class C address.
Finding the class in decimal notation
Example 7

Find the class of the address:


227.12.14.87

Solution

The first byte is 227 (between 224 and 239);


the class is D.
Example 7 (Continued)

Find the class of the address:


193.14.56.22

Solution

The first byte is 193 (between 192 and 223);


the class is C.
Example 8

In Example 4 we showed that class A has 231


(2,147,483,648) addresses. How can we
prove this same fact using dotted-decimal
notation?
Solution

The addresses in class A range from 0.0.0.0 to


127.255.255.255. We notice that we are
dealing with base 256 numbers here.
Solution (Continued)

Each byte in the notation has a weight.


The weights are as follows:
2563 , 2562, 2561, 2560
Last address: 127  2563 + 255  2562 +
255  2561 + 255  2560 = 2,147,483,647
First address: = 0
If we subtract the first from the
last and add 1, we get 2,147,483,648.
Are You the Host or the
Network?
• The 32 bits of the IP address are divided into
Network & Host portions, with the octets
assigned as a part of one or the other.
Network & Host Representation
By IP Address Class
Class Octet1 Octet2 Octet3 Octet4

Class A Network Host Host Host

Class B Network Network Host Host

Class C Network Network Network Host


Are You the Host or the
Network? (Cont.)
• Each Network is assigned a network address &
every device or interface (such as a router port)
on the network is assigned a host address.
• There are only 2 specific rules that govern the
value of the address.
Are You the Host or the
Network? (Cont.)

• A host address cannot be designated by all


zeros or all ones.
• These are special addresses that are reserved
for special purposes.
Netid and hostid
Class A Addresses

• Class A IP addresses use the 1st 8 bits (1st


Octet) to designate the Network address.
• The 1st bit which is always a 0, is used to
indicate the address as a Class A address & the
remaining 7 bits are used to designate the
Network.
• The other 3 octets contain the Host address.
Class A Addresses (Cont.)

• There are 128 Class A Network Addresses, but


because addresses with all zeros aren’t used &
address 127 is a special purpose address, 126
Class A Networks are available.
Class A Addresses (Cont.)

• There are 16,777,214 Host addresses available in a


Class A address.
• Rather than remembering this number exactly, you
can use the following formula to compute the number
of hosts available in any of the class addresses, where
“n” represents the number of bits in the host portion:
(2n – 2) = Number of available hosts
Class A Addresses (Cont.)
• For a Class A network, there are:
224 – 2 or 16,777,214 hosts.
• Half of all IP addresses are Class A addresses.
• You can use the same formula to determine the
number of Networks in an address class.
• Eg., a Class A address uses 7 bits to designate the
network, so (27 – 2) = 126 or there can be 126 Class
A Networks.
Millions of class A addresses
are wasted.
Class B IP Addresses

• Class B addresses use the 1st 16 bits (two


octets) for the Network address.
• The last 2 octets are used for the Host address.
• The 1st 2 bit, which are always 10, designate
the address as a Class B address & 14 bits are
used to designate the Network. This leaves 16
bits (two octets) to designate the Hosts.
Class B IP Addresses (Cont.)

• So how many Class B Networks can there be?


• Using our formula, (214 – 2), there can be
16,382 Class B Networks & each Network can
have (216 – 2) Hosts, or 65,534 Hosts.
Many class B addresses
are wasted.
Class C IP Addresses

• Class C addresses use the 1st 24 bits (three


octets) for the Network address & only the last
octet for Host addresses.the 1st 3 bits of all
class C addresses are set to 110, leaving 21
bits for the Network address, which means
there can be 2,097,150 (221 – 2) Class C
Networks, but only 254 (28 – 2) Hosts per
Network.
Class C IP Addresses (Cont.)
The number of addresses in
a class C block
is smaller than
the needs of most organizations.
Class D addresses
are used for multicasting;
there is only
one block in this class.
Class E addresses are reserved
for special purposes;
most of the block is wasted.
Network Addresses
The network address is the first address.

The network address defines the network to the


rest of the Internet.
Given the network address, we can find the
class of the address, the block, and the range of
the addresses in the block
In classful addressing,
the network address
(the first address in the block)
is the one that is assigned
to the organization.
Example 9

Given the network address 17.0.0.0, find the


class, the block, and the range of the
addresses.

Solution

The class is A because the first byte is between


0 and 127. The block has a netid of 17.
The addresses range from 17.0.0.0 to
17.255.255.255.
Example 10

Given the network address 132.21.0.0, find


the class, the block, and the range of the
addresses.

Solution

The class is B because the first byte is between


128 and 191. The block has a netid of
132.21. The addresses range from
132.21.0.0 to 132.21.255.255.
Example 11

Given the network address 220.34.76.0, find


the class, the block, and the range of the
addresses.

Solution

The class is C because the first byte is between


192 and 223. The block has a netid of 220.34.76.
The addresses range from 220.34.76.0
to 220.34.76.255.
OTHER
ISSUES
Special Addresses

• A few addresses are set aside for specific


purposes.
• Network addresses that are all binary zeros, all
binary ones & Network addresses beginning
with 127 are special Network addresses.
Special Addresses (Cont.)
Special Addresses (Cont.)

• Within each address class is a set of addresses


that are set aside for use in local networks
sitting behind a firewall or NAT (Network
Address Translation) device or Networks not
connected to the Internet.
Multihomed devices
A multihomed host is physically connected to multiple data links
that can be on the same or different networks
Network addresses
Example of direct broadcast address
Example of limited broadcast address
Example of this host on this address
Example of specific host on this network
Example of loopback address
Private Addresses

A number of blocks in each class are assigned


for private use. They are not recognized
globally.
Unicast, Multicast, and
Broadcast Addresses
Unicast communication is one-to-one.

Multicast communication is one-to-many.

Broadcast communication is one-to-all.


Sample internet

You might also like