Cn Unit2ppt
Cn Unit2ppt
SCHOOL OF COMPUTING
DEPARTMENT OF COMPUTING TECHNOLOGIES
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
• 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
• 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
• 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
• 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
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
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.
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.
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)].
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.
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.
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
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.
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.
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