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

Unit-2 Notes

The document discusses classful IP addressing and subnetting. It describes the five classes of IP addresses (A, B, C, D, E), including their network and host ID bit lengths and address ranges. It notes problems with wasted addresses in classful addressing. Subnetting partitions a network into smaller subnetworks, while supernetting combines networks into larger spaces. The key difference is that subnetting moves mask bits right while supernetting moves them left.

Uploaded by

new world
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
219 views

Unit-2 Notes

The document discusses classful IP addressing and subnetting. It describes the five classes of IP addresses (A, B, C, D, E), including their network and host ID bit lengths and address ranges. It notes problems with wasted addresses in classful addressing. Subnetting partitions a network into smaller subnetworks, while supernetting combines networks into larger spaces. The key difference is that subnetting moves mask bits right while supernetting moves them left.

Uploaded by

new world
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Unit - II

Introduction of Classful IP Addressing


 Difficulty Level : Easy
 Last Updated : 10 Sep, 2021
IP address is an address having information about how to reach a specific host, especially
outside the LAN. An IP address is a 32 bit unique address having an address space of 2 32.
Generally, there are two notations in which IP address is written, dotted decimal notation
and hexadecimal notation.
Dotted Decimal Notation:

Hexadecimal Notation:

Some points to be noted about dotted decimal notation:


1. The value of any segment (byte) is between 0 and 255 (both included).
2. There are no zeroes preceding the value in any segment (054 is wrong, 54 is correct).
Classful Addressing
The 32 bit IP address is divided into five sub-classes. These are:
 Class A
 Class B
 Class C
 Class D
 Class E
Each of these classes has a valid range of IP addresses. Classes D and E are reserved for
multicast and experimental purposes respectively. The order of bits in the first octet
determines the classes of IP address.
IPv4 address is divided into two parts:
 Network ID
 Host ID
The class of IP address is used to determine the bits used for network ID and host ID and
the number of total networks and hosts possible in that particular class. Each ISP or
network administrator assigns IP address to each device that is connected to its network.

Note: IP addresses are globally managed by Internet Assigned Numbers Authority


(IANA) and regional Internet registries(RIR).
Note: While finding the total number of host IP addresses, 2 IP addresses are not counted
and are therefore, decreased from the total count because the first IP address of any
network is the network number and whereas the last IP address is reserved for broadcast
IP.
Class A:
IP address belonging to class A are assigned to the networks that contain a large number
of hosts.
 The network ID is 8 bits long.
 The host ID is 24 bits long.
The higher order bit of the first octet in class A is always set to 0. The remaining 7 bits in
first octet are used to determine network ID. The 24 bits of host ID are used to determine
the host in any network. The default subnet mask for class A is 255.x.x.x. Therefore,
class A has a total of:
 2^7-2= 126 network ID(Here 2 address is subtracted because 0.0.0.0 and 127.x.y.z are
special address. )
 2^24 – 2 = 16,777,214 host ID
IP addresses belonging to class A ranges from 1.x.x.x – 126.x.x.x

Class B:
IP address belonging to class B are assigned to the networks that ranges from medium-
sized to large-sized networks.
 The network ID is 16 bits long.
 The host ID is 16 bits long.
The higher order bits of the first octet of IP addresses of class B are always set to 10. The
remaining 14 bits are used to determine network ID. The 16 bits of host ID is used to
determine the host in any network. The default sub-net mask for class B is 255.255.x.x.
Class B has a total of:
 2^14 = 16384 network address
 2^16 – 2 = 65534 host address
IP addresses belonging to class B ranges from 128.0.x.x – 191.255.x.x.

Class C:
IP address belonging to class C are assigned to small-sized networks.
 The network ID is 24 bits long.
 The host ID is 8 bits long.
The higher order bits of the first octet of IP addresses of class C are always set to
110. The remaining 21 bits are used to determine network ID. The 8 bits of host
ID is used to determine the host in any network. The default sub-net mask for class
C is 255.255.255.x. Class C has a total of:
 2^21 = 2097152 network address
 2^8 – 2 = 254 host address
IP addresses belonging to class C ranges from 192.0.0.x – 223.255.255.x.

Class D:
IP address belonging to class D are reserved for multi-casting. The higher order
bits of the first octet of IP addresses belonging to class D are always set to 1110.
The remaining bits are for the address that interested hosts recognize.
Class D does not posses any sub-net mask. IP addresses belonging to class D
ranges from 224.0.0.0 – 239.255.255.255.

Class E:
IP addresses belonging to class E are reserved for experimental and research
purposes. IP addresses of class E ranges from 240.0.0.0 – 255.255.255.254. This
class doesn’t have any sub-net mask. The higher order bits of first octet of class E
are always set to 1111.

Range of special IP addresses:


169.254.0.0 – 169.254.0.16 : Link local addresses
127.0.0.0 – 127.0.0.8 : Loop-back addresses
0.0.0.0 – 0.0.0.8 : used to communicate within the current network.

Rules for assigning Host ID:


Host ID’s are used to identify a host within a network. The host ID are assigned
based on the following rules:
 Within any network, the host ID must be unique to that network.
 Host ID in which all bits are set to 0 cannot be assigned because this
host ID is used to represent the network ID of the IP address.
 Host ID in which all bits are set to 1 cannot be assigned because this
host ID is reserved as a broadcast address to send packets to all the hosts
present on that particular network.

Rules for assigning Network ID:


Hosts that are located on the same physical network are identified by the network
ID, as all host on the same physical network is assigned the same network ID. The
network ID is assigned based on the following rules:
 The network ID cannot start with 127 because 127 belongs to class A
address and is reserved for internal loop-back functions.
 All bits of network ID set to 1 are reserved for use as an IP broadcast
address and therefore, cannot be used.
 All bits of network ID set to 0 are used to denote a specific host on the
local network and are not routed and therefore, aren’t used.

Summary of Classful addressing:

Problems with Classful Addressing:


The problem with this classful addressing method is that millions of class A
address are wasted, many of the class B address are wasted, whereas, number of
addresses available in class C is so small that it cannot cater the needs of
organizations. Class D addresses are used for multicast routing and are therefore
available as a single block only. Class E addresses are reserved.

Difference between Sub netting and Super netting


Subnetting is the technique of partitioning a large network into smaller networks. On the
other hand, the supernetting is the method used for combining the smaller ranges of
addresses into larger space. Supernetting was devised to make the routing process more
convenient. Additionally, it reduces the size of routing table information so that it could
consume less space in the router’s memory. The well-defined method for the subnetting
is FLSM and VLSM while for supernetting CIDR is used.
Subnetting and supernetting are the techniques invented for resolving the problem of
address depletion. Although, the techniques were not able to eliminate the problem, but
certainly decreased the rate of address depletion. Supernetting is inverse process of
subnetting.
Comparison Chart

BASIS FOR
SUBNETTING SUPERNETTING
COMPARISON

Basic A process of dividing a A process of combining small


network into subnetworks. networks into a larger network.

Procedure The number of bits of The number of bits of host


network addresses is addresses is increased.
increased.

Mask bits are moved Right of the default mask. Left of the default mask.
towards

Implementation VLSM (Variable-length CIDR (Classless interdomain


subnet masking). routing).

Purpose Used to reduce the address To simplify and fasten the routing
depletion. process.
Definition of Subnetting
Subnetting is a technique of partitioning an individual physical network into several
small-sized logical sub-networks. These subnetworks are known as subnets. An IP
address is made up of the combination of the network segment and a host segment. A
subnet is constructed by accepting the bits from the IP address host portion which are
then used to assign a number of small-sized sub-networks in the original network. The
Subnetting basically converts the host bits into the network bits. As mentioned above the
subnetting strategy was initially devised for slowing down the depletion of the IP
addresses. The subnetting permits the administrator to partition a single class A, class B,
class C network into smaller parts. VLSM (Variable Length Subnet Mask) is a
technique which partitions IP address space into subnets of different sizes and prevent
memory wastage. Furthermore, when the number of hosts is same in subnets that is
known as FLSM (Fixed Length Subnet Mask).

Definition of Supernetting
Supernetting is inverse process of subnetting, in which several networks are merged into
a single network. While performing supernetting, the mask bits are moved toward the left
of the default mask. The supernetting is also known as router
summarization and aggregation. It results in the creation of more host addresses at the
expense of network addresses, where basically the network bits are converted into host
bits. The supernetting is performed by internet service provider rather than the normal
users, to achieve the most efficient IP address allocation. CIDR (Classless Inter-
Domain Routing) is scheme used to route the network traffic across the internet. CIDR
is a supernetting technique where the several subnets are combined together for the
network routing. In simpler words, CIDR allows the IP addresses to be organized in the
subnetworks independent of the value of
addresses.
Key Differences Between Subnetting and Supernetting

1. The strategy used to divide a huge network into smaller subnetworks is known as
subnetting. On the contrary, supernetting is the technique of merging multiple
networks into a single one.
2. The subnetting process involves the increment of network part bits from the IP
address. Conversely, in supernetting, the host part bits of the address are increased.
3. In order to perform subnetting the mask bits are repositioned towards the right of
the default mask. As against, in supernetting, the mask bits are moved left of the
default mask.
4. VLSM is a method of subnetting whereas CIDR is a supernetting technique.

Advantages of Subnetting

 Minimizes the network traffic through decreasing the volume of broadcasts.


 Increases addressing flexibility.
 Increases the number of allowed hosts in local area network.
 The network security can be readily employed between subnets rather than
employing it in the whole network.
 Subnets are easy to maintain and manage.
Advantages of Supernetting

 The size of the router memory table is minimized by summarizing several routing
information entries into a single entry.
 It also increases the speed of routing table lookup.
 Provision for the router to isolate the topology changes from the other routers.
 It also reduces the network traffic.
Disadvantages of Subnetting

 However, it is quite expensive.


 It requires trained administrator to perform subnetting.
Disadvantages of Supernetting

 The combination of blocks should be made in power 2; alternatively, if the three


blocks are required, then there must be assigned four blocks.
 The whole network should exist in the same class.
 When merged, it lacks covering different areas.

Difference between Subnetting and Supernetting


Subnetting:
Subnetting is the procedure to divide the network into sub-networks or small networks.
Supernetting:
Supernetting is the procedure to combine the small networks into larger space. In
subnetting, Network addresses’s bits are increased. on the other hand, in supernetting,
Host addresses’s bits are increased. Subnetting is implemented via Variable-length subnet
masking, While supernetting is implemented via Classless interdomain routing.
Difference between Subnetting and Supernetting:
S.N
O Subnetting Supernetting

Subnetting is the procedure to divide While supernetting is the procedure of


1. the network into sub-networks. combine the small networks.

In subnetting, Network addresses’s While in supernetting, Host


2. bits are increased. addresses’s bits are increased.

In subnetting, The mask bits are While In supernetting, The mask bits
3. moved towards right. are moved towards left.

Subnetting is implemented via While supernetting is implemented via


4. Variable-length subnet masking. Classless interdomain routing.

In subnetting, Address depletion is While It is used for simplify routing


5. reduced or removed. process.

BOOTP Packet Format:-


BOOTP requests and replies are encapsulated in UDP datagrams, as shown in Figure
16.1.

Figure 16.1. Encapsulation of BOOTP requests and replies within a UDP datagram.

Figure 16.2 shows the format of the 300-byte BOOTP request and reply.
Figure 16.2. Format of BOOTP request and reply.

Opcode is 1 for a request and 2 for a reply. The hardware type field is 1 for a 10
Mbits/sec Ethernet, the same value that is in the field of the same name in an ARP
request or reply (Figure 4.3). Similarly, the hardware address length is 6 bytes for
an Ethernet.
The hop count is set to 0 by the client, but can be used by a proxy server (described in
Section 16.5).

The transaction ID is a 32-bit integer set by the client and returned by the server.
This lets the client match a response with a request. The client should set this to a
random number for each request.

Number of seconds can be set by the client to the time since it started trying to
bootstrap. The servers can look at this value, and perhaps a secondary server for a
client won't respond until the number of seconds has exceeded some value,
implying that the client's primary server is down.

If the client already knows its IP address, it fills in the client IP address.
Otherwise, the client sets this to 0. In the latter case the server fills in your IP
address with the client's IP address. The server IP address is filled in by the
server. If a proxy server is used (Section 16.5), that proxy server fills in its
gateway IP address.

The client must set its client hardware address. Although this is the same value as in
the Ethernet header, by placing the field in the UDP datagram also, it is easily
available to any user process (e.g., a BOOTP server) that receives the datagram. It
is normally much harder (or impossible) for a process reading UDP datagrams to
determine the fields in the Ethernet header that carried the UDP datagram.

The server hostname is a null terminated string that is optionally filled in by the
server. The server can also fill in the boot filename with the fully qualified, null
terminated pathname of a file to bootstrap from.

The vendor-specific area is used for various extensions to BOOTP. Section 16.6
describes some of these extensions.

When a client is bootstrapping using BOOTP (an opcode of 1) the request is


normally a link-layer broadcast and the destination IP address in the IP header is
normally 255.255.255.255 (the limited broadcast, Section 12.2). The source IP
address is often 0.0.0.0 since the client does not know its own IP address yet. Recall
from Figure 3.9 that 0.0.0.0 is a valid source IP address when a system is
bootstrapping itself.

Port Numbers

There are two well-known ports for BOOTP: 67 for the server and 68 for the client.
This means the client does not choose an unused ephemeral port, but uses 68 instead.
The reason two port numbers were chosen
, instead of just one for the server, is that a server's reply can be (but normally isn't)
broadcast.

If the server's reply were broadcast, and if the client were to choose an ephemeral
port number, these broadcasts would also be received by other applications on
other hosts that happen to be using the same ephemeral port number. Hence, it is
considered bad form to broadcast to a random (i.e., ephemeral) portnumber.

If the client also used the server's well-known port (67) as its port, then all servers
on the network are awakened to look at each broadcast reply. (If all the servers
were awakened, they would examine the opcode, see that it's a reply and not a
request, and go back to sleep.) Therefore the choice was made to have all clients
use a single well-known port that differs from the server's well-known port.

If multiple clients are bootstrapping at the same time, and if the server broadcasts
the replies, each client sees the replies intended for the other clients. The clients can
use the transaction ID field in the BOOTP header to match replies with requests, or
the client can examine the returned client hardware address.
DHCP Packet Format

DHCP servers can interoperate with BOOTP clients.


DHCP options have the same format as BOOTP vendor extensions.
There are two primary differences between DHCP and BOOTP. First, DHCP
defines mechanisms through which clients can be assigned a network address for a
finite lease, allowing for serial reassignment of network addresses to different
clients. Second, DHCP provides the mechanism for a client to acquire all of the IP
configuration parameters that it needs in order to operate.

DHCP introduces a small change in terminology intended to clarify the meaning of


one of the fields. What was the "vendor extensions" field in BOOTP has been re-
named the "options" field in DHCP. Similarly, the tagged data items that were used
inside the BOOTP "vendor extensions" field, which were formerly referred to as
"vendor extensions," are now termed simply "options."

MAC IP UDP DHCP Data


header header header header :::

DHCP header:

0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
Hardware
Opcode Hardware type Hop count
address
length
Transaction ID
Number of seconds Flags
Client IP address
Your IP address
Server IP address
Gateway IP address
Client hardware address
:::
Server host name :::
Boot filename :::
Options :::
Opcode. 8 bits.

Valu Descriptio
e n
1 BOOTREQUEST, Boot request.
2 BOOTREPLY, Boot reply.
Hardware type. 8
bits.
Hardware
address length. 8
bits. Hop count. 8
bits.

This field is used by relay agents.


Transaction ID. 32 bits.
A random number chosen by the client, used by the client and server to
associate messages and responses between a client and a server.
Number of seconds. 16 bits.
The elapsed time in seconds since the client began an address acquisition or renewal
process.
Flags. 16 bits.

00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
B 0
B, Broadcast. 1 bit.
Client IP address. 32 bits.

Your IP address. 32 bits.

Server IP address. 32 bits.

Gateway IP address. 32 bits.

Client hardware address. 16 bytes.


Server host name. 64 bytes.
Boot filename. 128 bytes.
BOOTP/DHCP options. Variable length.

The first four bytes contain the (decimal) values 99, 130, 83 and 99. This is the
same magic cookie as has been defined for BOOTP. The remainder of the field
consists of a list of tagged parameters that are called options. All of the vendor
extensions used by BOOTP are also DHCP options.
Bootstrap Protocol (BootP) and DHCP:-
BootP:-
The problem with using Reverse Address Resolution Protocol (RARP) (RFC
903) for assigning IP addresses to clients is that it operates at the data link layer
and is therefore limited to the local LAN. Bootp however uses IP/UDP (port 67 for
the server destination port, and port 68 for the client source port) and can cross
routers. If a client does not know its own IP address when it boots up then it can
utilise a Bootp server to obtain its IP address. It will use a IP broadcast address of
255.255.255.255. This IP broadcast is transmitted in a link-layer broadcast of
FFFF.FFFF.FFFF. If the client is on the same LAN as the Bootp server, then the
Bootp server will respond to the broadcast, by using the MAC address of the client,
and the IP address will be given to the client. If the Bootp server is on another LAN
i.e. on the other side of a router then we are left with the situation whereby
broadcasts are being sent by the client and the router is designed not to pass
broadcasts. Consider the following scenario:

The client requires an IP address and a default gateway address so it sends out an IP
broadcast BOOTREQUEST.
1. No Bootp server exists locally so the router R1, which is configured to
forward Bootp/DHCP requests, sends a unicast with the source IP address
of it's LAN interface on which it received the initial broadcast. Note that
this is different from TCP connections which use the WAN IP address on
the router which owns the LAN interface from whence the packet came.
The unicast contains the IP address of the Bootp server which R1 knows
since this is part of the Bootp forwarding configuration.
2. R2 forwards the unicast to the Bootp server.
3. The server examines the packet and checks for the client's hardware
address in its database. If the MAC address has been entered then the
server can map the client MAC address to the IP address configured in
the database.
4. The server then looks to see if the client is requesting a configuration file (boot
file).
5. The server replies with a unicast BOOTREPLY containing the client's IP
address and details of the configuration file.
6. R1 recognizes the unicast reply and forwards the packet to the clients MAC
address.
7. The client's TCP/IP stack then pings the IP address to check that it is
not being used beforetaking it for itself.
8. The client then can use TFTP etc. to download the configuration file
including information such as the default gateway to the LAN interface
of R1.

Note that the TCP/IP stack needs to be in place on the client, since the client needs
to be able to send an IP broadcast (not a layer 2 broadcast!).

Below is the frame format which is used for both Bootp and DHCP:

Operation - indicates a request 1 or a reply 2.


Hardware Type - Ethernet is 1.
Hardware Length - length of the address
Hops - the client starts this off with 0 and then this increment by each
Bootp server if thepacket is passed on.
Transaction ID - diskless nodes use this number to match responses with the
requests.
Seconds - this gives the elapsed time since the client started the boot process
Client IP Address - if a client knows its IP address it puts it in here, otherwise it
is a 0.
Your IP Address - the server puts an IP address here if the Client IP address
field is 0.
Server IP Address - if the client knows this then the client can place the
server address in here, otherwise the server does.
Server Host Name - same as previously.
Gateway IP Address - the client initially sets this to 0. The router
receiving the packet will put the IP address of the interface on which the
packet was received (i.e. the LAN interface).
Client Hardware Address - so that the servers/routers know where to send
responses back to.
Server Host Name - if the client puts a specific server name in here then
it restricts itself to booting from that server alone. If no name is in here
then the client can boot from any server that responds to a bootp request.
Boot File Name - the client can request a specific boot filename.
Vendor Specific Area - up to 64 octets long for Bootp. This is called
the Options field in a DHCP packet and is up to 312 octets long. In
DHCP this field contains optional information that the server may wish
to give the client e.g. client identifier and server identifier.

DHCP (Dynamic Host Configuration Protocol)


DHCP works slightly differently from Bootp. The following steps occur when a client
retrieves IPconfiguration details from a DHCP server:
The client sends a DHCPDISCOVER IP broadcast to find available DHCP
servers on its subnet. This broadcast message could give indications of the
address required and the length of the lease.
A router configured with Bootp Relay agent forwards the request on to other
subnets specified inthe router configuration (e.g. Cisco's ip helper).
The DHCP server responds with a unicast DHCPOFFER containing an
available IP address in the 'Your IP Address' field and other configuration
parameters such as default gateway, subnet mask and lease time. This
occurs when the DHCPDISCOVER has a 0 in the Client IP address field.
The server should check that the IP address has not already been allocated.
Optionally, the server could be configured to reserve previously allocated IP
addresses. In the case of the server being on a different subnet to the client,
this DHCPOFFER is sent to the client's router's LAN IP address which is the
source of the original DHCPDISCOVER broadcast. Where the server and
the client sit on the same LAN, the MAC address of the client is sufficient,
being as it is the source of the broadcast.
The client examines the various offers it receives, picks
one and sends a DHCPREQUEST broadcast including the server
identifier of that particular server to obtain the offered configuration
parameters. The DHCPREQUEST broadcast is also used to renew a lease or
to decline an offer.
All servers receive this broadcast if they are on the LAN. If they are on
another subnet and a relay agent is configured on the router, then this
broadcast is unicast to the server identified by the server identifier. The
router is configured with the IP address of the desired server.
The chosen server replies with a unicast DHCPACK containing IP address,
duration for the lease of that IP address and the other configuration
parameters. The server commits to this IP address and it is passed to
persistent memory. A DHCPNACK is sent if the IP address happens to
have been allocated in the meantime.
The client receives the DHCPACK and checks the IP address is not being
used locally e.g. with an ARP request. If the IP address IS in use then the
client sends a DHCPDECLINE, waits at least 10 seconds and then restarts
the process.

You might also like