0% found this document useful (0 votes)
13 views

Cn Unit2ppt

The document covers the fundamentals of IPv4 addressing, including address space, notations, classful and classless addressing, subnetting, and network devices. It explains the structure of IP addresses, the classification into different classes (A, B, C, D, E), and the rules for assigning host and network IDs. Additionally, it discusses the concepts of Fixed-Length Subnet Masking (FLSM) and the challenges of address depletion, along with strategies like subnetting and supernetting to manage IP address allocation.
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)
13 views

Cn Unit2ppt

The document covers the fundamentals of IPv4 addressing, including address space, notations, classful and classless addressing, subnetting, and network devices. It explains the structure of IP addresses, the classification into different classes (A, B, C, D, E), and the rules for assigning host and network IDs. Additionally, it discusses the concepts of Fixed-Length Subnet Masking (FLSM) and the challenges of address depletion, along with strategies like subnetting and supernetting to manage IP address allocation.
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/ 68

SRM INSTITUTE OF SCIENCE AND TECHNOLOGY

SCHOOL OF COMPUTING
DEPARTMENT OF COMPUTING TECHNOLOGIES

21CSC302J – Computer Networks

UNIT - II
Unit - 2
• IPv4 addresses - Address space, Notations
• Classful IP Addressing
• Subnet Mask
• FLSM
• Classless IP Addressing
• VLSM
• NAT
• Supernetting
• Network Devices – Hub, Repeaters, Switches,
Routers, Bridges and Gateways

3/08/2024 Computer Networks 2


Introduction to IP V4 (Version 4)
• Internet Protocol (IP) is one of the major network layer
protocols in the TCP/IP protocols suite.
• The responsibility of IP is to identify hosts based upon their
logical addresses and to route data among them over the
underlying network.
• Internet Protocol version 4 uses 32-bit logical address.
• Network devices use IP addresses and subnets to identify
the source and destination of communications and manage
network addresses respectively.
• An address space is the total number of addresses used by
the protocol.
• The address space of IPv4 is 232 = (4,294,967,296)
• IP addresses contain two parts: a network identifier (NetId)
and a host identifier (HostId).
3/08/2024 Computer Networks 3
IP V4 Notations

• IP V4 is represented in the following formats:


– Binary Notation (base 2)
– Dotted Decimal Notation (base 256)
– Hexa-decimal Notation (base 16)

3/08/2024 Computer Networks 4


IP V4 Notations

• Binary Notation
– The IP address is displayed as 32 bits (0s and 1s).
– Spaces may be introduced between each Octets to make the
address more readable.
– Each octet is often referred to as a byte (8 Bits)
• Dotted Decimal Notation
– IP addresses are represented in decimal numbers (0 to 255)
– It is usually written in decimal form with a decimal point
(dot) separating the bytes.
• Hexa-Decimal Notation
– IPv4 address can also be represented in hexadecimal notation.
– Each hexadecimal digit is equivalent to four bits.
– This means that a 32-bit address has 8 hexadecimal digits.
– This notation is often used in network programming
3/08/2024 Computer Networks 5
Hierarchy in IP V4

• A 32-bit IPv4 address is hierarchical, 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
or host (connection of a device to the Internet).
• The prefix length is n bits and the suffix length is (32 − n) bits.

3/08/2024 Computer Networks 6


Hierarchy in IP Version 4 (IP v4)

• A prefix can be fixed length or variable length.


• The network identifier in the IPv4 was first designed as a fixed-
length prefix.
• This scheme, which is now obsolete, is referred to as classful
addressing.
• The new scheme, which is referred to as classless addressing, uses
a variable-length network prefix.
• In Classful Addressing, 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).

3/08/2024 Computer Networks 7


Classful Addressing

• An IP address space is divided into 5 classes:


– Class A, Class B, Class C, Class D and Class E

3/08/2024 Computer Networks 8


Class A
• In Class A, IP addresses are assigned to a large number
of hosts in a network.
– The network ID is 8 bits long.
– The host ID is 24 bits long.

• In Class A, the first bit in higher order bits of the first octet is
always set to 0 and the remaining 7 bits determine the
network ID.
• The last 24 bits determine the host ID in any network.
• The total number of networks in Class A = 27 = 128
network address
• The total number of hosts in Class A = 224 - 2 =
16,777,214 host address

3/08/2024 Computer Networks 9


Class B

• In Class B, IP addresses are assigned to from small-sized


to large-sized networks.
– The network ID is 16 bits long.
– The host ID is 16 bits long.

• In Class B, the first bit in higher order bits of the first octet is
always set to 10 and the remaining 14 bits determine the
network ID.
• The last 16 bits determine the host ID in any network.
• The total no. of networks in Class B = 214 = 16384
network address
• The total no. of hosts in Class B = 216 - 2 =65534 host
address

3/08/2024 Computer Networks 10


Class C

• In Class C, an IP address is assigned to only small-sized


networks
– The network ID is 24 bits long.
– The host ID is 8 bits long.

• In Class C, the first bit in higher order bits of the first octet is
always set to 110 and the remaining 21 bits determine the
network ID.
• The last 8 bits determine the host ID in a network.
• The total no. of networks in Class C = 221 = 2097152
network address
• The total no. of hosts in Class C = 28 - 2 = 254 host
address
3/08/2024 Computer Networks 11
Class D

• In Class D, an IP address is reserved for multicast


addresses.
• It does not possess subnetting.
• The higher order bits of the first octet is always set
to 1110, and the remaining bits determines the host
ID in any network.

3/08/2024 Computer Networks 12


Class E

• In Class E, an IP address is used for the future use


or for the research and development purposes.
• It does not possess any subnetting.
• The higher order bits of the first octet is always set
to 1111, and the remaining bits determines the host
ID in any network.

3/08/2024 Computer Networks 13


Rule for Assigning the Host ID

The Host ID is used to determine the host within any


network.
The Host ID is assigned based on the following rules:
• The Host ID must be unique within any network.
• The Host ID in which all the bits are set to 0 cannot
be assigned as it is used to represent the network
ID of the IP address.
• The Host ID in which all the bits are set to 1 cannot
be assigned as it is reserved for the multicast
address.

3/08/2024 Computer Networks 14


Rule for Assigning the Network ID

If the hosts are located within the same local network,


then they are assigned with the same network ID.
The following are the rules for assigning Network ID:
• The network ID cannot start with 127 as it is used
for Loopback Address.
• The Network ID in which all the bits are set to 0
cannot be assigned as it is used to specify a
particular host on the local network.
• The Network ID in which all the bits are set to 1
cannot be assigned as it is reserved for the
multicast address.

3/08/2024 Computer Networks 15


Classful IP Addresses - Summary

3/08/2024 Computer Networks 16


Subnetting and Supernetting

Address Depletion
• The reason that classful addressing has become obsolete is
address depletion.
• Since the addresses were not distributed properly, the
Internet was faced with the problem of the addresses being
rapidly used up, resulting in no more addresses available for
organizations and individuals that needed to be connected to
the Internet.
• To alleviate address depletion, two strategies were proposed
and, implemented: subnetting and supernetting

3/08/2024 Computer Networks 17


Subnetting and Supernetting

Subnetting
• 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
3/08/2024 Computer Networks 18
Subnetting and Supernetting

Supernetting
• 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.

3/08/2024 Computer Networks 19


FLSM
Fixed-Length Subnet Mask (FLSM)
• When a block of addresses is divided into subnets all having an
equal number of addresses, the type of subnetting is said to be
Fixed Length Subnetting.
• The subnet masks used here will be the same for all the subnets
as the number of addresses is equal for each subnet.

3/08/2024 Computer Networks 20


FLSM
FLSM Example 1
• Given an IP address 198.168.10.0. Divide this IP address into 4
subnetworks. Find out the range of IP addresses for each block.
Steps for Calculating Network Blocks of IP Address
• To Calculate the required subnet bit, in this subnetting process, we will
borrow the bits from the host side.
• Now the question is, which bits belong to the host side and network
side?
• We will find it with the help of subnet masks.
• First, identify the class of the given IP Address and its default mask.
• Here, it is a Class C IP address and default mask for Class C is
255.255.255.0. Every octet consists of 8-bit, in this case we are having
24 1’s in network bit.

3/08/2024 Computer Networks 21


FLSM
• With one binary, we can make two value and with two binary values,
we can make four values. And with 3 binary value, we can make 8
values and so on.
• Here, we need to configure 4 subnets for this we need to borrow 2
bits and making the MSB of host bit of subnet mask to 1 and the value
we will get 11111111.11111111.11111111.11000000
• From this we get the mask value for the subnet. i.e. 255.255.255.192
(The decimal equivalent of upper mask in binary)
• Range = Maximum Subnet Mask – Updated Subnet Mask value
• Maximum Subnet Mask is always 255.255.255.255 for every case.
• The network address is the first address of the IP subnet.
• The broadcast address is the last address of the IP subnet.
• All addresses between the network address and the broadcast address
are that block IP addresses.
• Routers use network addresses to find IP subnets and make
forwarding decisions.
• A broadcast address belongs to all devices in the IP subnet. Any
message sent to this address reaches all devices on the subnet.
3/08/2024 Computer Networks 22
FLSM

Here is the range for network is 0.0.0.63.


Now we divide the whole network into 4 subnets with the help of the range.
• Subnet masks will remain same for every network block i.e.
255.255.255.192
Subnet Block Address Range Network Broadcast
Block Start End Address Address
1 198.168.10.0 198.168.10.63 198.168.10.0 198.168.10.63
2 198.168.10.64 198.168.10.127 198.168.10.64 198.168.10.127
3 198.168.10.128 198.168.10.191 198.168.10.128 198.168.10.191
4 198.168.10.192 198.168.10.255 198.168.10.192 198.168.10.255
• A broadcast address is a destination-only address. It is never used in the
source address field of data packets.

3/08/2024 Computer Networks 23


FLSM

Example 2
• Consider an address block 121.37.10.64 /26. Find the first and last
addresses for each subnet, if the number of equal sized subnets
required is 4.
Answer
• Since 4 subnets are required, we need 2 bits from the host ID part to
identify each subnet. Thus, the new subnet mask now becomes (/28).
• Number of variable bits left = 32 -28 = 4 bits. Thus, the total number of
addresses in each subnet= 24= 16.

Subnet First Address Last Address


No (Network ID) (Broadcast ID)
1 121.37.10.64 121.37.10.79
2 121.37.10.80 121.37.10.95
3 121.37.10.96 121.37.10.111
4 121.37.10.112 121.37.10.127
3/08/2024 Computer Networks 24
FLSM
Method1
• The number of addresses in the block is found as N = 232−n
• To find the first address, we keep the n leftmost bits and set the (32 − n)
rightmost bits all to 0s.
• To find the last address, we keep the n leftmost bits and set the (32 − n)
rightmost bits all to 1s.

Method2
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)].

3/08/2024 Computer Networks 25


FLSM
Example 3
An organization is granted the block 130.56.0.0/16. The administrator wants
to create 1024 subnets.
a. Find the number of addresses in each subnet.
b. Find the subnet prefix.
c. Find the first and the last address in the first subnet.
d. Find the first and the last address in the last subnet.
Solution
Given the block 130.56.0.0/16, let's break down the process to answer the
questions.
a. Number of Addresses in Each Subnet
1. Total Addresses in the Block: The /16 block means that the first 16 bits
are used for the network, and the remaining 16 bits are used for hosts. 2 16 =
65,536 addresses.
2. Number of Subnets: The administrator wants to create 1024 subnets

3/08/2024 Computer Networks 26


FLSM
3. Bits Needed for Subnetting: To create 1024 subnets, you need enough
bits to represent 1024 different subnets.
log⁡2(1024)=10 bits
4. Number of Addresses per Subnet: With 10 bits used for the subnet, the
remaining bits for the host addresse are:32−(16+10) = 6 bits
So, the number of addresses in each subnet is:26=64. Therefore, each
subnet will have 64 addresses.
b. Subnet Prefix
1. Original Prefix: /16
2. Additional Bits for Subnets: 10 bits
3. New Prefix Length:16+10=26. So, the new subnet prefix is /26.
c. First and Last Address in the First Subnet
1. First Subnet: Starting with the block 130.56.0.0/16 and using the /26
prefix for subnetting.
– First Subnet Address: 130.56.0.0/26
– Number of Addresses in Each Subnet: 64 addresses
3/08/2024 Computer Networks 27
FLSM
2. Calculate Address Range:
• First Address: 130.56.0.0
• Last Address: To find the last address, calculate the address range by
adding 63 to the first address in decimal:
• Last Address = First Address + 64 - 1
= 130.56.0.0 + 63 = 130.56.0.63
So, the first address in the first subnet is 130.56.0.0 and the last address is
130.56.0.63.
d. First and Last Address in the Last Subnet
• Last Subnet: Since each subnet has 64 addresses, and there are 1024
subnets, the last subnet starts right before the end of the address space.
• First Address in Last Subnet: To find the first address in the last
subnet, calculate the start of the last subnet:
• The address space for the last subnet can be calculated by:
• Last Subnet Start Address=130.56.0.0 + 64 × (1024−1)

3/08/2024 Computer Networks 28


FLSM
Last Subnet Start Address=130.56.0.0+64×(1024−1)
• =130.56.0.0+64×1023
• =130.56.0.0+65,472 = 130.56.255.192
Last Address in Last Subnet: Calculate the last address by adding 63 to
the first address of the last subnet:
Last Address=130.56.255.192+63 = 130.56.255.255
So, the first address in the last subnet is 130.56.255.192 and the last
address is 130.56.255.255.
Summary
Number of Addresses in Each Subnet: 64 addresses
Subnet Prefix: /26
First Address in the First Subnet: 130.56.0.0
Last Address in the First Subnet: 130.56.0.63
First Address in the Last Subnet: 130.56.255.192
Last Address in the Last Subnet: 130.56.255.255

3/08/2024 Computer Networks 29


Classless Addressing

• In classless addressing, variable-length blocks are used that


belong to no classes.
• We can have a block of 1 address, 2 addresses, 4 addresses,
128 addresses, and so on.
• The whole address space is divided into variable length
blocks.
• The prefix in an address defines the block (network); the
suffix defines the node (device/host).
• The no. of addresses in a block needs to be a power of 2.

3/08/2024 Computer Networks 30


Classless Addressing

Prefix Length: Slash Notation


How to find the prefix length if an IP address is given.
• We need to separately give the length of the prefix for this
case.
• Here, the prefix length, n, is added to the address,
separated by a slash.
• The notation is informally referred to as slash notation and
formally as classless interd.omain routing or CIDR

3/08/2024 Computer Networks 31


Classless Addressing

Extracting Information from an Address


• Given any address in the block, we 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.
• Since the value of prefix length, n, is given, we can easily
find these three pieces of information

3/08/2024 Computer Networks 32


Classless Addressing

Extracting Information from an Address (Method 1)


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.

3/08/2024 Computer Networks 33


Classless Addressing

Example
• A classless address is given as 167.199.170.82/27.
• We can find the above three pieces of information as
follows.
– The number of addresses in the network is 232 − n = 25 = 32
addresses
– The first address can be found by keeping the first 27 bits and
changing the rest of the bits to 0s

– The last address can be found by keeping the first 27 bits and
changing the rest of the bits to 1s.

3/08/2024 Computer Networks 34


Classless Addressing

Address Mask (Method 2)


• 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.
• A computer can easily find the address mask because it is
the complement of (232 − n − 1).
• It can be used by a computer program to extract the
information in a block, using the three bit-wise operations
NOT, AND, and OR.

3/08/2024 Computer Networks 35


Classless Addressing

Address Mask
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)].
For the previous example, the address mask is: 256.256.256.224.
• Number of addresses in the block: N = NOT (mask) + 1=
0.0.0.31 + 1 = 32 addresses
• First address: First = (address) AND (mask) = 167.199.170.82
• Last address: Last = (address) OR (NOT mask) =
167.199.170.255
3/08/2024 Computer Networks 36
Classless Addressing

Block Allocation
• For the proper operation of the CIDR, two restrictions need
to be applied to the allocated block.

3/08/2024 Computer Networks 37


Forwarding of IP Addresses
Forwarding based on the destination address
• It requires a host or a router to have a forwarding table.
• When a host has a packet to send or when a router has received
a packet to be forwarded, it looks at this table to find the next
hop to deliver the packet to.
• The table needs to be searched based on the network address
(first address in the block). Unfortunately, the destination
address in the packet gives no clue about the network address.
• To solve the problem, we need to include the mask (/n) in the
table.
• A classless forwarding table needs to include four pieces of
information: the mask, the network address, the interface
number, and the IP address of the next router (needed to find
the link-layer address of the next hop)
3/08/2024 Computer Networks 38
Forwarding of IP Addresses

Forwarding based on the destination address

3/08/2024 Computer Networks 39


Forwarding of IP Addresses

• The job of the forwarding module is to search the table, row by


row. In each row, the n leftmost bits of the destination address
(prefix) are kept and the rest of the bits (suffix) are set to 0s.
• If the resulting address (which we call the network address),
matches with the address in the first column, the information in
the next two columns is extracted; otherwise the search
continues.
• Normally, the last row has a default value in the first column,
which indicates all destination addresses that did not match the
previous rows.

3/08/2024 Computer Networks 40


Forwarding of IP Addresses

• Make a forwarding table for router R1 using the configuration


shown in the figure
Forwarding table for router R1

3/08/2024 Computer Networks 41


Forwarding of IP Addresses

• When a packet arrives whose leftmost 26 bits in the destination


address match the bits in the first row, the packet is sent out from
interface m2.
• When a packet arrives whose leftmost 25 bits in the address match
the bits in the second row, the packet is sent out from interface
m0, and so on.
• The table clearly shows that the first row has the longest prefix and
the fourth row has the shortest prefix.
• The longer prefix means a smaller range of addresses; the shorter
prefix means a larger range of addresses.

3/08/2024 Computer Networks 42


Forwarding of IP Addresses

Example
• Show the forwarding process if a packet arrives at R1 in the same
Figure with the destination address 180.70.65.140.
Solution
• The router performs the following steps:
1. The first mask (/26) is applied to the destination address. The
result is 180.70.65.128, which does not match the corresponding
network address.
2. The second mask (/25) is applied to the destination address. The
result is 180.70.65.128, which matches the corresponding
network address.
• The next-hop address and the interface number m0 are extracted
for forwarding the packet

3/08/2024 Computer Networks 43


Designing Subnets - VLSM
• 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.
• The steps for the proper operation of the subnetworks are:
– The number of addresses in each subnetwork should be a power of 2
– The prefix length for each subnetwork is find using the formula:
first address = (prefix in decimal) × 232 − n = (prefix in decimal) × N.
nsub = 32 − log2Nsub
– The starting address in each subnetwork should be divisible by the
number of addresses in that subnetwork.
– This can be achieved if we first assign addresses to larger subnetworks.

3/08/2024 Computer Networks 44


Designing Subnets - VLSM
VLSM Example
• An organization is granted a block of addresses with the beginning
address 14.24.74.0/24. Then, it needs to have 3 subblocks of addresses
to use in its three subnets:
– one subnet block of 10 addresses,
– one subnet block of 60 addresses, and
– one subnet block of 120 addresses.
• Design the subnet blocks
Solution
• There are 232 – 24 = 256 addresses in this block. The first address is
14.24.74.0/24; the last address is 14.24.74.255/24.
• To satisfy the third requirement, we assign addresses to subblocks,
starting with the largest and ending with the smallest one.

3/08/2024 Computer Networks 45


Designing Subnets - VLSM
• The number of addresses in the largest subblock, which requires
120 addresses, is not a power of 2. so, take the nearest 2n >=120
• We allocate 128 addresses. The subnet mask for this subnet can
be found as n1 = 32 − log2128 = 25. The first address in this block
is 14.24.74.0/25; the last address is 14.24.74.127/25.
• The number of addresses in the second largest subblock, which
requires 60 addresses, is not a power of 2 either.
• We allocate 64 addresses. The subnet mask for this subnet can be
found as n2 = 32 − log264 = 26. The first address in this block is
14.24.74.128/26; the last address is 14.24.74.191/26.
• The number of addresses in the smallest subblock, which requires
10 addresses, is not a power of 2 either.
• We allocate 16 addresses. The subnet mask for this subnet can be
found as n3 = 32 − log216 = 28. The first address in this block is
14.24.74.192/28; the last address
3/08/2024 is 14.24.74.207/28.
Computer Networks 46
Designing Subnets - VLSM
• If we add all addresses in the previous subblocks, the result is 208
addresses, which means 48 addresses are left in reserve.

3/08/2024 Computer Networks 47


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.

3/08/2024 Computer Networks 48


Address Aggregation

Example
• Above figure shows how four small blocks of addresses are
assigned to four organizations by an ISP.
• The ISP combines these four blocks into one single block and
advertises the larger block to the rest of the world.
• Any packet destined for this larger block should be sent to this
ISP.
• It is the responsibility of the ISP to forward the packet to the
appropriate organization.
• This is similar to routing we can find in a postal network. All
packages coming from outside a country are sent first to the
capital and then distributed to the corresponding destination.

3/08/2024 Computer Networks 49


Special IP Addresses

Five special addresses that are used for special purposes:


• this-host address,
• limited-broadcast address,
• loopback address,
• private addresses, and
• multicast addresses.
This-host Address
• 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.

3/08/2024 Computer Networks 50


Special IP Addresses

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.
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 the host.
• Any address in the block is used to test a piece of software in the
machine.
• For example, we can write and test a client and a server program
in which one of the addresses in the block is used as the server
address
3/08/2024 Computer Networks 51
Special IP Addresses

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
• The block 224.0.0.0/4 is reserved for multicast addresses.

3/08/2024 Computer Networks 52


Network Address Translation (NAT)

• A technology that can provide the mapping between the private


addresses and universal addresses, and at the same time support
virtual private networks, is called as the Network Address
Translation.
• 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.
• The site must have only one connection to the global Internet
through a NAT-capable router that runs NAT software.

3/08/2024 Computer Networks 53


Network Address Translation (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.
• Example

3/08/2024 Computer Networks 54


Network Address Translation (NAT)
Translation Table
• How does the NAT router know the destination address for a
packet coming from the Internet? There may be hundreds of
private IP addresses, each belonging to one specific host. The
problem is solved if the NAT router has a translation table.
Using One IP Address
• A translation table has only two columns: the private address and
• the external address (destination address of the packet).
• When the router translates the source address of the outgoing
packet, it also makes note of the destination address—where the
packet is going.
• When the response comes back from the destination, the router
uses the source address of the packet (as the external address) to
find the private address of the packet.
3/08/2024 Computer Networks 55
Network Address Translation (NAT)
Translation

3/08/2024 Computer Networks 56


Network Address Translation (NAT)
• In this strategy, communication must always be initiated by the
private network.
• The NAT mechanism described requires that the private network
start the communication.
• NAT is used mostly by ISPs that assign a single address to a
customer. The customer, however, may be a member of a private
network that has many private addresses.
• In this case, communication with the Internet is always initiated
from the customer site, using a client program such as HTTP,
TELNET, or FTP to access the corresponding server program.
• For example, when e-mail that originates from outside the
network site is received by the ISP e-mail server, it is stored in the
mailbox of the customer until retrieved with a protocol such as
POP.
3/08/2024 Computer Networks 57
Network Address Translation (NAT)

Using a Pool of IP Addresses


• The use of only one global address by the NAT router allows only
one private-network host to access a given external host.
• To remove this restriction, the NAT router can use a pool of global
addresses.
• For example, instead of using only one global address (200.24.5.8),
the NAT router can use four addresses (200.24.5.8, 200.24.5.9,
200.24.5.10, and 200.24.5.11).
• In this case, four private-network hosts can communicate with the
same external host at the same time because each pair of
addresses defines a separate connection.

3/08/2024 Computer Networks 58


Network Address Translation (NAT)
Using a Pool of IP Addresses
• However, there are still some drawbacks. No more than four
connections can be made to the same destination.
• No private-network host can access two external server programs
(e.g., HTTP and TELNET) at the same time.
• Two private-network hosts cannot access the same external server
program (e.g., HTTP or TELNET) at the same time

3/08/2024 Computer Networks 59


Network Address Translation (NAT)
Using Both IP Addresses and Port Addresses
• To allow a many-to-many relationship between private-network
hosts and external server programs, we need more information in
the translation table.
• For example, suppose two hosts inside a private network with
addresses 172.18.3.1 and 172.18.3.2 need to access the HTTP
server on external host 25.8.3.2.

3/08/2024 Computer Networks 60


Network Address Translation (NAT)
Using Both IP Addresses and Port Addresses
• If the translation table has five columns, instead of two, that
include the source and destination port addresses and the
transport-layer protocol, the ambiguity is eliminated.
• Note that when the response from HTTP comes back, the
combination of source address (25.8.3.2) and destination port
address (1401) defines the private network host to which the
response should be directed.
• Note also that for this translation to work, the ephemeral port
addresses (1400 and 1401) must be unique.

3/08/2024 Computer Networks 61


Network Devices
Network Devices also known as networking hardware, are physical
devices that allow hardware on a computer network to communicate
and interact with one another. For example Repeater, Hub, Bridge,
Switch, Routers, Gateway, Brouter, and NIC, etc.
• Repeater – It operates at the physical layer. Its job is to amplifies
(i.e., regenerates) the signal over the same network before the
signal becomes too weak or corrupted to extend the length to
which the signal can be transmitted over the same network. When
the signal becomes weak, they copy it bit by bit and regenerate it
at its star topology connectors connecting following the original
strength. It is a 2-port device.

3/08/2024 Computer Networks 62


Network Devices
• A hub is a basically multi-port repeater. It connects multiple wires
coming from different branches, for example, the connector in star
topology which connects different stations.
• Hubs cannot filter data, so data packets are sent to all connected
devices. In other words, it is a collision domain.
• Also, they do not have the intelligence to find out the best path
for data packets which leads to inefficiencies and wastage.
Types of Hub
• Active Hub:- These are the hubs that have their power supply and
can clean, boost, and relay the signal along with the network.
• Passive Hub:- These are the hubs that collect wiring from nodes
and power supply from the active hub.
• Intelligent Hub:- It works like an active hub and includes remote
management capabilities.
3/08/2024 Computer Networks 63
Network Devices
• A bridge operates at the data link layer. A bridge is a repeater, with
add on the functionality of filtering content by reading the MAC
addresses of the source and destination.
• It is also used for interconnecting two LANs working on the same
protocol. It has a single input and single output port, thus making
it a 2 port device.
Types of Bridges
• Transparent Bridges:- These are the bridge in which the stations
are completely unaware of the bridge’s existence i.e. whether or
not a bridge is added or deleted from the network, reconfiguration
of the stations is unnecessary.
• These bridges make use of two processes i.e. bridge forwarding
and bridge learning.

3/08/2024 Computer Networks 64


Network Devices
• Source Routing Bridges:- In these bridges, routing operation is
performed by the source station and the frame specifies which
route to follow.
• The host can discover the frame by sending a special frame called
the discovery frame, which spreads through the entire network
using all possible paths to the destination.

3/08/2024 Computer Networks 65


Network Devices
• A switch is a multiport bridge with a buffer and a design that can
boost its efficiency (a large number of ports imply less traffic) and
performance.
• A switch is a data link layer device. The switch can perform error
checking before forwarding data, which makes it very efficient as it
does not forward packets that have errors and forward good
packets selectively to the correct port only.
• In other words, the switch divides the collision domain of hosts,
but the broadcast domain remains the same.

3/08/2024 Computer Networks 66


Network Devices
• A router is a device like a switch that routes data packets based on
their IP addresses.
• The router is mainly a Network Layer device.
• Routers normally connect LANs and WANs and have a dynamically
updating routing table based on which they make decisions on
routing the data packets. The router divides the broadcast domains
of hosts connected through it.
• A gateway is a passage to connect two networks that may work
upon different networking models.
• They work as messenger agents that take data from one system,
interpret it, and transfer it to another system.
• Gateways are also called protocol converters and can operate at
any network layer. Gateways are generally more complex than
switches or routers.
3/08/2024 Computer Networks 67
End of Unit II

3/08/2024 Computer Networks 68

You might also like