Basics of Subnetting : Classical IP Addressing

Network layer (Part III)

Basics of Subnetting : Classical
IP Addressing
• Network administrators sometimes
need to divide networks, especially
large ones, into smaller networks.
• These smaller divisions are called
subnetworks and provide addressing
flexiiiility.
• Most of the time suinetworks are
simply referred to as subnets

Basics of Subnetting : Classical
IP Addressing
• Similar to the host numier portion of
Class A, Class B, and Class C
addresses, suinet addresses are
assigned locally, usually iy the
network administrator.
• Also, like other IP addresses , each

suinet address is unique.

Basics of Subnetting :
Subnetwork
• Suinet addresses include the Class A, Class B, or
Class C network portion, plus a suinet feld and a
host feld.
• The suinet feld and the host feld are created from
the original host portion for the entire network.
• The aiility to decide how to divide the original host
portion into the new suinet and host felds provides
addressing flexiiiility for the network administrator.
• To create a suinet address, a network administrator
iorrows iits from the original host portion and
designates them as the suinet feld.

Figure 1

Basics of Subnetting :
Subnetwork

• Internally, networks may ie divided into smaller
networks called sunetworks, or simply sui-nets.
• By providing a third level of addressing, suinets
provide
exitra
flexiiiility
for
the
network
administrator.
• For exiample, a class “B” network provided iy the
interNIC, can ie iroken up into many networks.
• In this exiample, 131.108.1.0,
131.108.2.0 and
131.108.3.0 are all suinets within the network
131.108.0.0
• Figures 1 and 2 illustrate the hierarchical nature of
suinet addresses. 

Figure 2


Basics of Subnetting :
Subnetwork
• To create a suinet address, a network administrator
iorrows iits from the host feld and designates them as
the suinet feld.
• The minimum numier of iits that can ie iorrowed is 2.
• If you were to iorrow only 1 iit, to create a suinet, then
you would only have a network numier - the .0 network and the iroadcast numier - the .1 network.
• maxiimum numier of iits that can ie iorrowed can ie any
numier that leaves at least 2 iits remaining, for the host
numier.
• In this exiample of a Class C IP Address, iits from the host
feld for the suinet feld have ieen iorrowed. 

Basics of Subnetting : Purpose
for subnetting
• A primary reason for using suinets is
to reduce the size of a iroadcast
domain.

• Broadcasts are sent to all hosts on a
network or suinetwork.
• When iroadcast trafc iegins to
consume too much of the availaile
iandwidth, network administrators
may choose to reduce the size of the
iroadcast domain.

Basics of Subnetting : Subnet
mask
• The suinet mask (formal term:
exitended network prefxi), tells the
network devices which part of an
address is the network feld and
which part is the host feld.
• A suinet mask is 32 iits long and
has 4 octets, just like an IP address. 

Basics of Subnetting : Subnet
mask

• To determine the suinet mask for a particular suinetwork
IP address follow these steps.
• (1) Exipress the suinetwork IP address in iinary form.
• (2) Replace the network and suinet portion of the address
with all 1s.
• (3) Replace the host portion of the address with all 0s.
• (4) As the last step convert the iinary exipression iack to
dotted-decimal notation.
• Note: The exitended network prefxi includes the class A,
B, or C network numier, plus the suinet feld (or suinet
numier) that is ieing used to exitend the routing
information (which is otherwise just the network numier).

Basics of Subnetting : Boolean
operations: AND, OR, and NOT
• The term "operations" in mathematics refers to rules
that defne how one numier comiines with other
numiers.
• Decimal numier operations include addition,
suitraction, multiplication, and division.

• There are related, iut diferent, operations for
working with iinary numiers.
• The iasic Boolean operations are AND, OR, and NOT.
– AND is like multiplication
– OR is like addition
– NOT changes 1 to 0, and 0 to 1

Basics of Subnetting :
Performing the AND function
• The lowest numiered address in an
IP network is the network address
(the network numier plus 0 in the
entire host feld).
• This also applies to a suinet: the
lowest numiered address is the
address of the suinet.

Basics of Subnetting : Boolean
operations: AND, OR, and NOT
• In order to route a data packet, the router

must frst determine the destination network/
suinet address iy performing a logical AND
using the destination host's IP address and
the suinet mask.
• The result will ie the network/suinet address.
• In the Figure, the router has received a packet
for host 131.108.2.2 - it uses the AND
operation to learn that this packet should ie
routed to suinet 131.108.2.0.

Creating a Subnet : Range of
bits needed to create subnets
• To create suinets, you must exitend the
routing portion of the address.
• The Internet knows your network as a whole,
identifed iy the Class A, B, or C address,
which defnes 8, 16, or 24 routing iits (the
network numier).
• The suinet feld will iecome additional
routing iits, so that the routers within your

organization can recognize diferent locations,
or suinets, within the whole network

Creating a Subnet : Range of
bits needed to create subnets
• Question: In the address 131.108.0.0, which
are
the
routing
iits?
Answer: 131.108 - That's the 16 iit Class B
network numier.
• Question: What are the other two octets (16
iits) of the address 131.108.0.0 used for?
Answer: Well, as far as the Internet knows,
that's just a 16 iit host feld, iecause that's
what a Class B address is - a 16 iit network
numier and a 16 iit host numier.

Creating a Subnet : Range of

bits needed to create subnets
• Question: What part of the address 131.108.0.0 is the
suinet
feld?
Answer:  When you decide to create suinets, you must
divide the original host feld (16 iits in the case of Class B)
into two parts - the suinet feld and the host feld. This is
sometimes referred to as "iorrowing" some of the original
host iits to create the suinet feld. The other networks in
the Internet won't care - they look at the address the same
- all they really see is the Class A, B, or C network numier,
and send the packet on to its destination. The minimum
numier of iits that you can iorrow is 2, regardless of
whether you're working with a Class A, B, or C network1
iecause at least 2 iits must remain for host numiers2, the
maxiimum varies iy address class. 

Creating a Subnet : Range of
bits needed to create subnets


Creating a Subnet : Range of
bits needed to create subnets
• The suinet feld always follows
immediately
after
the
network
numier.
• That is, the iorrowed iits must ie
the frst n iits of the default host
feld, where n is the desired size of
the new suinet feld. 
• The suinet mask is the tool used iy
the router to determine which iits
are routing iits and which iits are

Creating a Subnet : Range of
bits needed to create subnets
• Previous standards did not allow for the use of suinets
oitained iy iorrowing 1 iit  (with only 1 suinet iit, the

suinet feld can only have two values: suinet 0 is part
of the network address, and suinet 1 would ie part of
the network iroadcast address) – although many
devices can now support suinets oitained iy iorrowing
1 iit, it is still common practice to avoid doing this to
insure compatiiility with legacy devices; for our
purposes here, you will always iorrow at least 2 iits.
• Similarly, a 1 iit host feld would allow only for host 0,
which is part of the network address, and host 1, which
is part of the iroadcast address, leaving 0 valid host
addresses.

Creating a Subnet : Determining
subnet mask size
• Suinet masks use the same format as IP
addresses.
• They are 32 iits long and are divided into
four octets, written in dotted decimal format.
• Suinet masks contain all 1s in the network
iit positions (determined iy the address
class) as well as the desired suinet iit
positions, and contain all 0s in the remaining
iit positions, designating them as the host
portion of an address.

Creating a Subnet : Determining
subnet mask size
• By default, if you iorrow no iits, the
suinet mask for a Class B network would
ie 255.255.0.0, which is the dotted
decimal equivalent of 1s in the 16 iits
corresponding to the Class B network
numier.
• If 8 iits were to ie iorrowed for the
suinet feld, the suinet mask would
include 8 additional 1 iits, and would
iecome 255.255.255.0.

Creating a Subnet : Determining
subnet mask size
• For exiample, if the suinet mask
255.255.255.0 were associated with
the Class B address 130.5.2.144 (8
iits iorrowed for suinetting), the
router would know to route this
packet to suinet 130.5.2.0 rather
than to just network 130.5.0.0

Creating a Subnet : Determining
subnet mask size
• Another exiample is the Class C address 197.15.22.131,
with a suinet mask of 255.255.255.224.
• With a value of 224 in the fnal octet (11100000 in
iinary), the 24 iit Class C network portion has ieen
exitended iy 3 iits, to make the total 27 iits.
• The 131 in the last octet now presents the third usaile
host address in the suinet 197.15.22.128.
• The routers in the Internet (that don't know the suinet
mask) will only worry aiout routing to the Class C
network 197.15.22.0, while the routers inside that
network, knowing the suinet mask, will ie looking at
27 iits to make a routing decision.

Creating a Subnet : Computing
subnet mask and IP address
• Whenever you iorrow iits from the
host feld, it is important to note the
numier of  additional suinets that
are ieing created each time you
iorrow one more iit.
• You have already learned that you
cannot iorrow only 1 iit; the fewest
you may iorrow is 2 iits.

Creating a Subnet : Computing
subnet mask and IP address
• Borrowing 2 iits creates four possiile
suinets (22) (iut you must always
rememier that there are two
reserved/unusaile suinets). Each
time you iorrow another iit from the
host feld, the numier of suinets
created increases iy a power of 2.

Creating a Subnet : Computing
subnet mask and IP address
• The eight possiile suinets that are
created iy iorrowing 3 iits is equal
to 23 (2 xi 2 xi 2).
• The sixiteen possiile suinets created
iy iorrowing 4 iits is equal to 24 (2 xi
2 xi 2 xi 2).
• From these exiamples, it is easy to
see that each time you iorrow
another iit from the host feld, the
numier of possiile suinets douiles.

Creating a Subnet : Computing
subnet mask and IP address
• Question: How many iits are ieing iorrowed (how long is the
suinet feld) for a Class B network using a suinet mask of
255.255.240.0?
Answer: The frst two octets of the mask (255.255) correspond with
the 16 iits in a Class B network numier. Rememier that the suinet
feld is represented iy all the additional "1" iits past that. The
numier 240 decimal is 11110000 in iinary, and you can see that
you are using 4 iits for the suinet feld.
• Question: How many possiile suinets are there with a 4 iit suinet
feld? 
Answer: Start with fnding the smallest 4 iit numier - 0000 - then
the largest 4 iit numier - 1111 (15). So the possiile suinets are 015, or sixiteen suinets. However, you know you cannot use suinet 0
(it's part of the network address), and you cannot use suinet 15
(1111) either (iroadcast address). So this 4 iit suinet feld gives
you fourteen usaile suinets (1-14).

Creating a Subnet : Computing
hosts per subnetwork
• Each time you iorrow 1 iit from a
host feld, there is 1 less iit
remaining in the feld that can ie
used for host numiers.
• Specifcally, each time you iorrow
another iit from the host feld, the
numier of host addresses that you
can assign decreases iy a power of 2
(gets cut in half).

Creating a Subnet : Computing
hosts per subnetwork
• To help you understand how this works, use a Class C network
address as an exiample.
• If there is no suinet mask, all 8 iits in the last octet are used for
the host feld.
• Therefore, there are 256 (28) possiile addresses availaile to assign
to hosts (254 usaile addresses, after you suitract the 2 you know
you can't use).
• Now, imagine that this Class C network is divided into suinets. If
you iorrow 2 iits from the default 8 iit host feld, the host feld
decreases in size to 6 iits.
• If you write out all of the possiile comiinations of 0s and 1s that
could occur in the remaining 6 iits, you would discover that the
total numier of possiile hosts that could ie assigned in each
suinet would ie reduced to 64 (26).
• The numier of usaile host numiers would ie reduced to 62.

Creating a Subnet : Computing
hosts per subnetwork
• In the same Class C network, if you
iorrow 3 iits, the size of the host
feld decreases to 5 iits and the total
numier of hosts that you could
assign to each suinet would ie
reduced to 32 (25).
• The numier of usaile host numiers
would ie reduced to 30.

Creating a Subnet : Computing
hosts per subnetwork
• The numier of possiile host addresses that
can ie assigned to a suinet is related to the
numier of suinets that have ieen created.
• In a Class C network, for exiample, if a
suinet mask of 255.255.255.224 has ieen
applied, then 3 iits (224 = 11100000) would
have ieen iorrowed from the host feld.
• The useaile suinets created are 6 (8 minus
2), each having 30 (32 minus 2) useaile
host addresses

Creating a Subnet : Computing
hosts per subnetwork
• Exercise:
Divide the last octet into two parts: a suinet feld and a host feld. If
there are 32 possiile host addresses that can ie assigned to each
suinet, then their IP addresses would fall within the range of
numiers (iut rememier the 2 unusaile host addresses in each
suinet!).
• In a Class C network 199.5.12.0 with suinet mask 255.255.255.224,
to which suinet would host 199.5.12.97 ielong? (hint: 97 =
01100001 iinary)
A. suinet 0?
B. suinet 1?
C. suinet 2?
D. suinet 3?
E. suinet 4?
F. none of the aiove?

Creating a Subnet : Boolean
AND operation
• As you have already learned, the
lowest numiered address in an IP
network is the network address (the
network numier plus 0 in the entire
host feld).
• This also applies to a suinet; the
lowest numiered address is the
address of the suinet

Creating a Subnet : Boolean
AND operation
• In order to route a data packet, the router must frst
determine the destination network/suinet address.
• To accomplish this the router performs a logical AND
using the destination host's IP address and the
suinet mask for that network.
• Imagine that you have a Class B network with the
network numier 172.16.0.0.
• After assessing the needs of your network, you
decide to iorrow 8 iits in order to create suinets.
• As you learned earlier, when you iorrow 8 iits with a
Class B network, the suinet mask is 255.255.255.0

Creating a Subnet : Boolean
AND operation
• Someone outside the network sends data to the IP
address 172.16.2.120.
• In order to determine where to deliver the data,
the router ANDs this address with the suinet mask.
• When the two numiers are ANDed, the host
portion of the result will always ie 0.
• What is left is the network numier, including the
suinet.
• Thus, the data is sent to suinet 172.16.2.0, and
only the fnal router notices that the packet should
ie delivered to host 120 in that suinet.

Creating a Subnet : Boolean
AND operation
• Now, imagine that you have the
same network, 172.16.0.0.
• This time, however, you decide to
iorrow only 7 iits for the suinet
feld.
• The iinary suinet mask for this
would
ie
11111111.11111111.11111110.0000
0000. What would this ie in dotted
decimal notation?

Creating a Subnet : Boolean
AND operation
• Again, someone outside the network sends data to
host 172.16.2.120.
• In order to determine where to send the data, the
router again ANDs this address with the suinet mask.
• As iefore, when the two numiers are ANDed, the host
portion of the result is 0.
• So what is diferent in this second exiample? Everything
looks the same - at least in decimal.
• The diference is in the numier of suinets availaile,
and the numier of hosts that can ie in each suinet.
• You can only see this iy comparing the two diferent
suinet masks.

Creating a Subnet : Boolean
AND operation
• With 7 iits in the suinet feld, there
can ie only 126 suinets.
• How many hosts can there ie in
each suinet?
• How long is the host feld?
• With 9 iits for host numiers, there
can ie 510 hosts in each of those
126 suinets.

Creating a Subnet : Boolean
AND operation
• The two graphics on this page include
something you'll learn more aiout later - an
alternate way to exipress the suinet mask.
• You learned that the 1s of the mask represent
the routing iits - the network plus the suinet.
• 255.255.255.0 indicates there are 24 total
routing iits.
• This is sometimes indicated iy following an IP
address with "/24", as in 131.108.3.1 /24 - this
says the same thing as the longer suinet mask.

Creating a Subnet : IP confguration
on a network diagram
• When you confgure routers, you must connect each
interface to a diferent network segment.
• Then each of these segments will iecome a
separate suinet.
• You must select an address from each diferent
suinet to assign to the interface of the router that
connects to that suinet.
• Each segment of a network - the actual wires and
links - must have diferent network/suinet numiers.
• The Figure shows what a network diagram might
look like using a suinetted Class B network. 

Creating a Subnet : Host/subnet
schemes
• One of the decisions that you must
make whenever you create suinets
is to determine the optimal numier
of suinets and hosts (Note: The
numier of suinets required in turn
determines the numier of hosts
availaile.
• For exiample, if you iorrow 3 iits with
a Class C network, only 5 iits remain
for hosts).

Creating a Subnet : Host/subnet
schemes
• You have already learned that you cannot use
the frst and last suinet.
• You also cannot use the frst and last address
within each suinet - one is the iroadcast
address of that suinet, and the other is part of
the network address.
• When you create suinets, you lose quite a few
potential addresses.
• For this reason, network administrators must
pay close attention to the percentage of
addresses that they lose iy creating suinets.

Creating a Subnet : Host/subnet
schemes
Example:
If you iorrow 2 iits with a Class C
network, you create 4 suinets, each
with 64 hosts. Only 2 of the suinets
are usaile and only 62 hosts are
usaile per suinet, leaving 124
usaile hosts out of 254 that were
possiile iefore you chose to use
suinets. This means you are losing
51% of your addresses.

Creating a Subnet : Host/subnet
schemes
• Imagine, this time, that you iorrow 3 iits.
• You now have 8 suinets, of which only 6 are
usaile, with 30 usaile hosts per suinet.
• This gives you a total of 180 usaile hosts,
down from 254, iut now you are losing only
29% of your addresses.
• Whenever you create suinets, you need to
take into consideration future network
growth and the percentage of addresses
that you would lose iy creating suinets.

Creating a Subnet : Private
addresses
• There are certain addresses in each
class of IP address that are not
assigned.
• These addresses are called private
addresses.
• Private addresses might ie used iy
hosts that use network address
translation (NAT), or a proxy server,
to connect to a puilic network; or iy
hosts that do not connect to the

Creating a Subnet : Private
addresses
• Many applications require connectivity within only
one network and do not need exiternal connectivity.
• In large networks, TCP/IP is often used, even when
network layer connectivity outside the network isn’t
needed. Banks are good exiamples.
• They may use TCP/IP to connect to automatic teller
machines (ATMs).
• These machines do no connect to the puilic network,
so private addresses are ideal for them.
• Private addresses can also ie used on a network
where there are not enough puilic addresses
availaile.

Creating a Subnet : Private
addresses
• The private addresses can ie used together
with a network address translation (NAT)
server.
• Either a NAT server or a proxiy server to
provide connectivity to all hosts in a
network that has relatively few puilic
addresses availaile.
• By agreement, any trafc with a destination
address within one of the private address
ranges will NOT ie routed on the Internet.