Module 3 Part 3

You might also like

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

Computer Networks (18EC71)

Text Book: Data Communications and Networking, Forouzan, 5th Edition, McGraw Hill, 2016

Module - 3

McGraw-Hill © The McGraw-Hill Companies, Inc., 2000


Topics
 Wireless LANs:
 Introduction: Architectural Comparison, Characteristics

 IEEE 802.11: Architecture, MAC Sublayer, Addressing Mechanism,

Physical Layer, Bluetooth: Architecture, Layers.


 Connecting Devices:
 Hubs, Switches

 Virtual LANs: Membership, Configuration, Communication between

Switches, Advantages.
 Network Layer:
 Introduction, Network Layer services: Packetizing, Routing and

Forwarding, Other services


 Packet Switching: Datagram Approach, Virtual Circuit Approach,

 IPV4 Addresses: Address Space, Classful Addressing, Classless

Addressing, DHCP, Network Address Resolution


 Forwarding of IP Packets: Based on destination Address and Label.
Network Layer
• NETWORK-LAYER SERVICES
• Packetizing
 Encapsulating the in a network-layer packet at the source
and decapsulating the payload from the network-layer
packet at the destination.
 The source host receives the payload from an upper-layer

protocol, adds a header that contains the source and


destination addresses and some other information that is
required by the network-layer protocol
 The destination host receives the network-layer packet

from its data-link layer, decapsulates the packet, and


delivers the payload to the corresponding upper-layer
protocol
Network Layer
• NETWORK-LAYER SERVICES
• Packetizing
 The routers are not allowed to change source and

destination addresses either. They just inspect the


addresses for the purpose of forwarding the packet
to the next network on the path. However, if a
packet is fragmented, the header needs to be copied
to all fragments.
Network Layer
• NETWORK-LAYER SERVICES
• Routing and Forwarding
• Routing
• The network layer is responsible for routing the
packet from its source to the destination.
• 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.
Network Layer
• NETWORK-LAYER SERVICES
• Forwarding
 Forwarding can be defined as the action applied by
each router when a packet arrives at one of its
interfaces.
 When a router receives a packet from one of its attached
networks, it needs to forward the packet to another
attached network or to some attached networks.
 The decision-making table a router normally uses for
applying this action is sometimes called the forwarding
table and sometimes the routing table.
Introduction to Network Layer
Network layer at the source
Introduction to Network Layer
Network layer at the Router
Introduction to Network Layer
Network layer at the Destination
Network Layer
• NETWORK-LAYER SERVICES
 Error Control

 Design of the network layer adds a checksum field to the


datagram to control any corruption in the header, but not
in the whole datagram.
 ICMP provides some kind of error control if the
datagram
 Congestion Control
 Congestion in the network layer is a situation in which
too many datagrams are present in an area of the Internet.
 Congestion may occur if the number of datagrams sent
by source computers is beyond the capacity of the
network or routers
PACKET SWITCHING
 A router, in fact, is a switch that creates a connection
between an input port and an output port.
 Packet switching is used at the network layer because
the unit of data at this layer is a packet.
 The source of the message sends the packets one by
one; the destination of the message receives the packets
one by one.
 The destination waits for all packets belonging to the
same message to arrive before delivering the message to
the upper layer.
 Two different approaches to route the packets: the
datagram approach and the virtual circuit approach.
PACKET SWITCHING
 Datagram Approach: Connectionless Service
PACKET SWITCHING
 Datagram Approach: Connectionless Service
 network layer is only responsible for delivery of
packets from the source to the destination.
 Network-layer protocol treats each packet
independently, with each packet having no
relationship to any other packet
 With a connectionless service, each packet traveling
in the Internet is an independent entity
 Packet belonging to a message may be followed by
a packet belonging to the same message or to a
different message.
PACKET SWITCHING
 Datagram Approach: Connectionless Service
 Each packet is routed based on the information
contained in its header: source and destination
addresses
 The router routes the packet based only on the
destination address.
 The source address may be used to send an error
message to the source if the packet is discarded.
PACKET SWITCHING
 Datagram Approach: Connection-Oriented
Service

PACKET SWITCHING
 Datagram Approach: Connection-Oriented
Service
 There exists is a relationship between all packets belonging
to a message.
 A virtual connection is set up to define the path for the
datagrams.
 After connection setup, the datagrams can all follow the
same path.
 It also contain a flow label, a virtual circuit identifier that
defines the virtual path the packet should follow apart from
SA and DA.
 Each packet is forwarded based on the label in the packet
PACKET SWITCHING
 Datagram Approach: Connection-Oriented
Service
 Setup Phase
 A router creates an entry for a virtual circuit. For
example, suppose source A needs to create a virtual
circuit to destination B.
 Two auxiliary packets need to be exchanged
between the sender and the receiver: the request
packet and the acknowledgment packet.
Forwarding process in a router when used in a virtual circuit network

Incoming Outgoing
label label
PACKET SWITCHING
 Datagram Approach: Connection-Oriented
Service
 Request packet
 A request packet is sent from the source to the
destination. This auxiliary packet carries the source
and destination addresses.
Sending request packet in a virtual-circuit network

A to B

A to B

A to B A to B
PACKET SWITCHING
 Datagram Approach: Connection-Oriented
Service
1. Source A sends a request packet to router R1.
2. Router R1 receives the request packet and sent out through
port 3 as it knows that a packet going from A to B.
3. Router R3 receives the setup request packet. three columns
of the table are completed: in this case, incoming port (1),
incoming label (66), and outgoing port (3).
4. Router R4 receives the setup request packet
5. Destination B receives the setup packet, and if it is ready to
receive packets from A, it assigns a label to the incoming
packets that come from A
PACKET SWITCHING
 Datagram Approach: Connection-Oriented
Service - Acknowledgment Packet
 A special packet, called the acknowledgment packet,
completes the entries in the switching tables.
1. The destination sends an acknowledgment to router R4. The
acknowledgment carries the global source and destination addresses.
2. Router R4 sends an acknowledgment to router R3 that contains its
incoming label in the table
3. Router R3 sends an acknowledgment to router R1 that contains its
incoming label in the table, chosen in the setup phase.
4. Finally router R1 sends an acknowledgment to source A that
contains its incoming label in the table, chosen in the setup phase.
5. The source uses this as the outgoing label for the data packets to be
sent to destination B.
Sending acknowledgments in a virtual-circuit network
PACKET SWITCHING
 Datagram Approach: Connection-Oriented
Service – Data Transfer
 The second phase is called the data-transfer phase.
 After all routers have created their forwarding table for a
specific virtual circuit, then the network-layer packets
belonging to one message can be sent one after another
 Teardown Phase
 In the teardown phase, source A, after sending all packets
to B, sends a special packet called a teardown packet.
 Destination B responds with a confirmation packet. All
routers delete the corresponding entries from their tables.
Flow of one packet in an established virtual circuit
IPV4 ADDRESSES
 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.
 IPv4 addresses are unique in the sense that each
address defines one, and only one,connection to the
Internet
IPV4 ADDRESSES
 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 2b.
 IPv4 uses 32-bit addresses, which means that the
address space is 232 or 4,294,967,296
IPV4 ADDRESSES
 Notation
 There are three common notations to show an IPv4 address:
 Binary notation (base 2),
 An IPv4 address is displayed as 32 bits

 Dotted-decimal notation (base 256), and


 IPv4 address is usually written in decimal form with a

decimal point (dot) separating the bytes


 Hexadecimal notation (base 16).
 Each hexadecimal digit is equivalent to four bits
IPV4 ADDRESSES
 Notation
 There are three common notations to show an IPv4 address:

IPV4 ADDRESSES
 Hierarchy in Addressing
 In any communication network the addressing
system is hierarchical.
 A 32-bit IPv4 address is also hierarchical, but
divided only into two parts.
 The first part of the address, called the prefix,
defines the network.
 The second part of the address, called the suffix,
defines the node (connection of a device).
IPV4 ADDRESSES
 Hierarchy in Addressing

IPV4 ADDRESSES
 Classful Addressing
 IPv4 address was designed with a fixed-length
prefix.
 To accommodate both small and large networks,
three fixed-length prefixes were designed instead of
one (n = 8, n = 16, n = 24)
 The whole address space was divided into five
classes (class A, B, C, D, and E)
IPV4 ADDRESSES
 Classful Addressing
 Class A
 In class A, the network length is 8 bits

 First bit, which is 0, defines the class

 There can be 7 bits as the network identifier i.e. there are

only 27 = 128 networks in the world that can have a class


A address.
 Class B
 In class B, the network length is 16 bits
 First two bits, which is 10, defines the class
 There can be 14 bits as the network identifier i.e. there are
only 214 = 16,384 networks in the world that can have a
class B address.
IPV4 ADDRESSES
 Classful Addressing
 Class C
 In class C, the network length is 24 bits

 First three bits, which is 110, defines the class

 There can be 21 bits as the network identifier i.e. there are only 2 21

= 2,097,152 networks in the world that can have a class C address.


 Class D
 Class D is not divided into prefix and suffix.

 First four bits, which is 1110, defines the class

 It is used for multicast addresses

 Class E
 Class E is not divided into prefix and suffix.

 First four bits, which is 1111, defines the class

 It is reserved for future use


IPV4 ADDRESSES
 Classful Addressing

IPV4 ADDRESSES
 Classful Addressing
 Write the following IP addresses using binary
notation:
 110.11.5.88
 12.74.16.18
 201.24.44.32
 Write following IP addresses using dotted-decimal
notation:
 01011110 10110000 01110101 00010101
 10001001 10001110 11010000 00110001
 01010111 10000100 00110111 00001111
IPV4 ADDRESSES
 Classful Addressing
 Find the class of the following classful IP addresses:
 130.34.54.12
 200.34.2.1
 245.34.2.8
 Find the class of the following classful IP addresses:
 01110111 11110011 10000111 11011101
 11101111 11000000 11110000 00011101
 11011111 10110000 00011111 01011101
IPV4 ADDRESSES
 Address Depletion
 Classful addressing has become obsolete due to address
depletion the addresses were not distributed properly
 Class A can be assigned to only 128 organizations in the
world, but each organization needs to have a single network
with 16,777,216 nodes
 Class B addresses were designed for midsize organizations,
but many of the addresses in this class also remained unused.
 Class C addresses have a completely different flaw in design.
The number of addresses that can be used in each network
(256) was so small.
 Class E addresses were almost never used, wasting the whole
class.
IPV4 ADDRESSES
 Subnetting
 Dividing the network into smaller contiguous
networks or subnets is called subnetting.
 Why subnetting?
 Suppose we take a network of class A. So, in class
A, we have 2²⁴ (16,777,216) hosts.
 To manage such a large number of hosts is tedious.
 If we divide this large network into the smaller
network then maintaining each network would be
easy.
IPV4 ADDRESSES
 How does subnetting work?
 Suppose we have a class C network having network
ID as 201.10.1.0
 So the total number of hosts is 256, but, the total
usable host is 254 (This is because the first IP
address is for the network ID and the last IP address
is Direct Broadcast Address)
 In subnetting we will divide these 254 hosts
logically into two networks.
 We have 24 bits for Network ID and the last 8 bits
for the Host ID.
IPV4 ADDRESSES
 How does subnetting work?
 We are going to borrow the left-most bit of the host
address and declare for identifying the subnet.
 If the leftmost bit of the host address is 0 then it is the 1st
subnet network and if the leftmost bit is 1 then it would
be 2nd subnet network.
 Using 1 bit we can divide it into 2 networks i.e. 2¹. If we
want to divide it into four networks then we need 2
bits(2²=4 networks).
 The range of IP address which is in 1st subnet network is
from 201.10.1.0 to 201.10.1.127. The range of IP address
that lies in the 2nd subnet network is from 201.10.1.128
to 201.10.1.255.
IPV4 ADDRESSES
 How does subnetting work?

IPV4 ADDRESSES
 How does subnetting work?
 In the 1st subnet network(S1), we have a total of 126
hosts only because the first and last IP address is reserved
for the network ID and the Direct Broadcast
Address respectively.
 Similarly, in the 2nd subnet network, we have 126 hosts.
 Overall, there are 252 usable hosts after subnetting. So,
because of subnetting, there is a loss in the number of IP
addresses.
IPV4 ADDRESSES
 Supernetting or Aggregation
 It is the opp osite of Subnetting. In this multiple smaller
networks are combined together to form a large network.
 Why supernetting?
 The routing table contains the entry of a subnet mask for
every network. If there are lots of small networks then
the size of the routing table increases.
 When the router has a big routing table then it takes a lot
of time for the router to process the routing table.
 Supernetting is used to reduce the size of the IP routing
table to improve network routing efficiency.
IPV4 ADDRESSES
 What is a Subnet Mask?
 A Subnet mask is a 32-bit number that masks an IP
address, and divides the IP address into network
address and host address.
 Subnet Mask is made by setting network bits to all
"1"s and setting host bits to all "0"s.
IPV4 ADDRESSES
 What is a Subnet Mask?

IPV4 ADDRESSES
 Classless Addressing/CIDR notation
 Subnetting and supernetting in classful addressing
did not really solve the address depletion problem.
 To reduce the wastage of IP addresses in blocks we
use subnetting.
 In Classless addressing wastage of IP addresses in
a block is more reduced than Classful subnetting.
 In this variable length, blocks are used that belongs
to no class.
IPV4 ADDRESSES
 Classless Addressing/CIDR notation
 Properties:

1. Addresses in a block must be in contiguous form


2. The number of address in a block must be
the power of 2 i.e. 2, 4, 8, 16,...
3. The first address must be evenly divisible by the
number of addresses.
IPV4 ADDRESSES
 Classless Addressing/CIDR notation

 Extracting Information from an Address


 Given any address in the block, we normally like to
know three pieces of information about the block to
which the address belongs:
 the number of addresses.
 the first address in the block and
 the last address.
IPV4 ADDRESSES
 Extracting Information from an Address
 1. The number of addresses in the block is found as
N = 232−n.
 2. To find the first address, we keep the n leftmost
bits and set the (32 − n) rightmost bits all to 0s.
 3. To find the last address, we keep the n leftmost
bits and set the (32 − n) rightmost bits all to 1s.
 Example:
 A classless address is given as 167.199.170.82/27.
IPV4 ADDRESSES
 Extracting Information from an Address
1. The number of addresses in the block is found as
N = 232−n = 232−27 = 25 = 32
2. To find the first address, we keep the n leftmost bits
and set the (32 − n) rightmost bits all to 0s.

3. To find the last address, we keep the n leftmost bits


and set the (32 − n) rightmost bits all to 1s.
IPV4 ADDRESSES
 Extracting Information from an Address
 Another way to find the first and last addresses in
the block is to use the address mask.
 The address mask is a 32-bit number in which the n
leftmost bits are set to 1s and the rest of the bits (32
− n) are set to 0s.
1. The number of addresses in the block N = NOT (mask) +
1.
2. The first address in the block = (Any address in the block)
AND (mask).
3. The last address in the block = (Any address in the block)
OR [(NOT (mask)].
IPV4 ADDRESSES
 Extracting Information from an Address

 Each of the following addresses belongs to a block. Find the


first and the last address in each block.
 14.12.72.8/24
 200.107.16.17/18
 70.110.19.17/16
IPV4 ADDRESSES
 Network Address
 In any network the first address, the network
address, is particularly important as it is used in
routing a packet to its destination network.
 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, how it reaches its
destination host?
IPV4 ADDRESSES
 Network Address
 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
IPV4 ADDRESSES
 Network Address

IPV4 ADDRESSES
 Block Allocation
 How are the address blocks allocated?
 The responsibility of block allocation is given to a
global authority called the Internet Corporation for
Assigned Names and Numbers (ICANN).
 ICANN does not normally allocate addresses to
individual Internet users.
 It assigns a large block of addresses to an ISP
IPV4 ADDRESSES
 Block Allocation
 Two restrictions need to be applied to the allocated
block.
 The number of requested addresses, N, needs to be a
power of 2.
 The requested block needs to be allocated where
there is an adequate number of contiguous
addresses available in the address space.
 The first address needs to be divisible by the
number of addresses in the block.
IPV4 ADDRESSES
 Subnetting
 More levels of hierarchy can be created using
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.
 A subnetwork can be divided into several sub-
subnetworks.
IPV4 ADDRESSES
 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
IPV4 ADDRESSES
 Designing Subnets
 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: nsub = 32 - log2Nsub
 The starting address in each subnetwork should be
divisible by the number of addresses in that
subnetwork.
IPV4 ADDRESSES
 Example
 An organization is granted a block of addresses with
the beginning address 14.24.74.0/24. The
organization needs to have 3 subblocks of addresses
to use in its three subnets: one subblock of 10
addresses, one subblock of 60 addresses, and one
subblock of 120 addresses. Design the subblocks.
 There are 232 – 24 = 256 (232 – n )addresses in this
block.
 The first address is 14.24.74.0/24; the last address is
14.24.74.255/24
IPV4 ADDRESSES
 Example
 Organization needs to have 3 subblocks
 Assign addresses to subblocks, starting with the
largest and ending with the smallest one
 Subnet-1: 120 Addresses
 Subnet-2: 60 Addresses
 Subnet-3: 10 Addresses
IPV4 ADDRESSES
 Example
 Subnet-1: 120 Addresses
 The number of addresses in the largest subblock,
which requires 120 addresses, is not a power of 2.
We allocate 128 addresses.
 The subnet mask for this subnet can be found as
 n = 32-log 128 = 25.
1 2

 The first address in this block is 14.24.74.0/25; the


last address is 14.24.74.127/25.
 Subnet-2: 60 Addresses
 Subnet-3: 10 Addresses
IPV4 ADDRESSES
 Example
 Subnet-2: 60 Addresses
 The number of addresses in the largest subblock,
which requires 120 addresses, is not a power of 2.
We allocate 64 addresses.
 The subnet mask for this subnet can be found as
 n = 32-log 64 = 26.
2 2

 The first address in this block is 14.24.74.128/26;


the last address is 14.24.74.191/26.
 Subnet-3: 10 Addresses
IPV4 ADDRESSES
 Example
 Subnet-3: 10 Addresses
 The number of addresses in the largest subblock,
which requires 10 addresses, is not a power of 2. We
allocate 16 addresses.
 The subnet mask for this subnet can be found as
 n = 32-log 16 = 28.
3 2

 The first address in this block is 14.24.74.192/28;


the last address is 14.24.74.208/28.
Dynamic Host Configuration Protocol
(DHCP)
 After a block of addresses are assigned to an
organization, the network administration can
manually assign addresses to the individual hosts or
routers.
 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
Dynamic Host Configuration Protocol
(DHCP)
 DHCP Message Format
 DHCP is a client-server protocol in which the client sends a
request message and the server returns a response message
Dynamic Host Configuration Protocol (DHCP)
 DHCP Operation
Dynamic Host Configuration Protocol (DHCP)
 DHCP Transition States
Dynamic Host Configuration Protocol (DHCP)
 DHCP Transition States

 To provide dynamic address allocation, the DHCP

client acts as a state machine that performs


transitions from one state to another depending on
the messages it receives or sends.
Dynamic Host Configuration Protocol (DHCP)
1. When the DHCP client first starts, it is in the INIT state,
client broadcasts a discover message.
2. When it receives an offer, the client goes to the
SELECTING state, it may receive more offers.
3. After it selects an offer, it sends a request message and
goes to the REQUESTING state.
4. If an ACK arrives while the client is in this state, it goes to
the BOUND state and uses the IP address.
5. When the lease is 50 percent expired, the client tries to
renew it by moving to the RENEWING state. If the server
renews the lease, the client moves to the BOUND state
again.
6. If the lease is not renewed and the lease time is 75 percent
expired, the client moves to the REBINDING state.
Network Address Resolution (NAT)
 The technology allows a site to use a set of private
addresses for internal communication and a set of
global Internet addresses (at least one) for
communication with the rest of the world.
 Network Address Translation (NAT) is a process
in which one or more local IP address is translated
into one or more Global IP address and vice versa
in order to provide Internet access to the local hosts.
Network Address Resolution (NAT)
 As the figure shows, the private network uses private
addresses.
 The router that connects the network to the global address
uses one private address and one global address.
 The private network is invisible to the rest of the Internet;
the rest of the Internet sees only the NAT router with the
address 200.24.5.8.
Network Address Resolution (NAT)
 Address Translation
 All of the outgoing packets go through the NAT router,
which replaces the source address in the packet with the
global NAT address.
 All incoming packets also pass through the NAT router,
which replaces the destination address in the packet (the
NAT router global address) with the appropriate private
address.

You might also like