NETW 110 Lab 04 Handout Subnetting IP Addresses

cursefarmΔίκτυα και Επικοινωνίες

24 Οκτ 2013 (πριν από 4 χρόνια και 8 μήνες)

111 εμφανίσεις

NETW 110 Lab 04 Handout - Subnetting IP Addresses

Page 1
Primary Address Classes
In order to provide the flexibility required to support different size networks, the designers decided that
the IP address space should be divided into three different address classes - Class A, Class B, and Class
C. This is often referred to as classful addressing because the address space is split into three
predefined classes, groupings, or categories. Each class fixes the boundary between the network-prefix
and the host-number at a different point within the 32-bit address. The formats of the fundamental
address classes are illustrated in Figure 1.

Figure 1: Principle Classful IP Address Formats
In classful IP addressing, each address contains a self-encoding key that identifies the dividing point
between the network-number and the host-number. For example, if the first two bits of an IP address
are 1-0, the dividing point falls between second and third byte (octet in dotted decimal). This
simplified the routing system during the early years of the Internet because the original routing
protocols did not supply a deciphering key or mask with each route to identify the length of the
network-prefix. IPv4 address space contains a maximum of 2

Class A Networks (/8 Prefixes)
Class A networks are now referred to as /8s (pronounced slash eight) since they have an 8-bit network-
prefix. Each Class A network address
♦ has an 8-bit network-prefix with the highest order bit set to 0 and a seven-bit network number,
followed by a 24-bit host-number
♦ defines a maximum of 126 (2
-2) /8 networks can be defined.
♦ supports a maximum of 16,777,214 (2
-2) hosts per network. The host calculation requires that 2
is subtracted because the all-0s (“this network”) and all-1s (“broadcast”) host-numbers may not be
assigned to individual hosts.
♦ the /8 address block contains 2
(2,147,483,648 ) individual addresses
♦ the /8 address space is 50% of the total IPv4 unicast address space.

Class B Networks (/16 Prefixes)
Class B networks are now referred to as /16’s since they have a 16-bit network-prefix. Each Class B
network address
♦ has a 16-bit network-prefix with the two highest order bits set to 1-0 and a 14-bit network number,
followed by a 16-bit host-number
♦ defies a maximum of 16,384 (2
) /16 networks can be defined with up to 65,534 (2
-2) hosts
per network
♦ supports a maximum of 2
(1,073,741,824) addresses
NETW 110 Lab 04 Handout - Subnetting IP Addresses

Page 2
♦ represents 25% of the total IPv4 unicast address space.

Class C Networks (/24 Prefixes)
Class C networks are now referred to as “/24s” since they have a 24-bit network-prefix. Each Class C
network address
♦ has a 24-bit network-prefix with the three highest order bits set to 1-1-0 and a 21-bit network
number, followed by an 8-bit host-number.
♦ Defines a maximum of 2,097,152 (2
) /24 networks can be defined with up to 254 (2
-2) hosts
per network
♦ Supports a maximum of 2
(536,870,912) addresses
♦ represents 12.5% (or 1/8th) of the total IPv4 unicast address space.

Other Classes
In addition to the three most popular classes, there are two additional classes.
♦ Class D addresses have their leading four-bits set to 1-1-1-0 and are used to support IP
♦ Class E addresses have their leading four-bits set to 1-1-1-1 and are reserved for experimental use.

Dotted-Decimal Notation
To make Internet addresses easier for human users to read and write, IP addresses are often expressed
as four decimal numbers, each separated by a dot, which is commonly referred to as dotted-decimal
notation. Dotted-decimal notation divides the 32-bit IP address space into four 8-bit (byte) fields, and
specifies the value of each field independently as a decimal number with the fields separated by dots.
The following shows how a typical Class B Internet address can be expressed in dotted decimal.
1001 0011 0000 1010 0010 1011 0110 0100
147 10 43 100
Figure 2: Dotted-Decimal Notation
For the example above, the IP Address is
Table 1 displays the range of valid dotted-decimal addresses that can be assigned to each of the three
principle address classes.
Address Class Address Range
Class A or /8 –
Class B or /16 –
Class C or /24 –
Valid Classful IP Address Range by Class
In the table above, the portion of the address represented by xxx is assigned by the network
administrator. Network addresses whose first octet is 0 or 127 may not be assigned. Address
is used for loopback testing

RFC 950 defines the procedure that supports subnetting, or division, of a single Class A, B, or C
network number into smaller pieces. Subnetting was introduced to overcome some of the problems that
NETW 110 Lab 04 Handout - Subnetting IP Addresses

Page 3
parts of the Internet were beginning to experience with the classful two-level addressing hierarchy
♦ Internet routing tables were beginning to grow.
♦ Local administrators had to request another network number from the Internet before a new
network could be installed at their site.
Subnetting supports a three-level address hierarchy as demonstrated in the following graphic. It divides
the standard classful host-number field into two parts - the subnet-number and the host-number on that
Network Number Host Number

 
Network Number Subnet Number Host Number
Subnetting eliminated problems associated with the expanding routing table problem by ensuring that
the subnet structure of a network is never visible outside of the organization’s private network. The
route from the Internet to any subnet of a given IP address is the same, no matter which subnet the
destination host is on. It overcame the registered number issue by assigning each organization one (or
at most a few) network number(s) from the IPv4 address space. The organization was then free to
assign a distinct subnetwork number for each of its internal networks. This allows the organization to
deploy additional subnets without needing to obtain a new network number from the Internet.

Internet routers use only the network-prefix of the destination address to route traffic to a subnetted
environment. Routers within the subnetted environment use the extended-network- prefix to route
traffic between the individual subnets. The extended-network-prefix is composed of the classful
network-prefix and the subnet-number.
Extended Network Prefix
Network Number Subnet Number Host Number
The extended-network-prefix has traditionally been called the subnet mask. For example, if you have
the /16 address of and you want to use the entire third octet to represent the subnet-number,
you specify a subnet mask of The bits in the subnet mask and the Internet address have
a one-to-one correspondence. The bits of the subnet mask are set to 1 if the system examining the
address should treat the corresponding bit in the IP address as part of the extended-network- prefix.
The bits in the mask are set to 0 if the system should treat the bit as part of the host-number.
The standards describing modern routing protocols often refer to the extended-network-prefix- length
rather than the subnet mask. The prefix length is equal to the number of contiguous one-bits in the
traditional subnet mask. This means that specifying the network address with a subnet
mask of can also be expressed as
However, modern routing protocols still carry the subnet mask. Since there are no Internet standard
routing protocols with a one-byte field in their header that contains the number of bits in the extended-
network prefix, each routing protocol is still required to carry the complete four-octet subnet mask.

Subnet Design Considerations
The deployment of an addressing plan requires careful thought on the part of the network
administrator. Four questions must be answered before any design should be undertaken:
1. How many total subnets does the organization need today?
NETW 110 Lab 04 Handout - Subnetting IP Addresses

Page 4
2. How many total subnets will the organization need in the future?
3. How many hosts are there on the organization’s largest subnet today?
4. How many hosts will there be on the organization’s largest subnet in the future?
Steps to create a Subnet
1. Determine the maximum number of subnets required and round up to the nearest power
of two.
Assume an organization needs 9 subnets. 2
(or 8) will not provide enough subnet addressing
space, so the network administrator will need to use 2
(or 16). Furthermore, it is critical that
the network administrator always allow adequate room for future growth. For example, if 14
subnets are required today, then 16 subnets might not be enough in two years when the 17th
subnet needs to be deployed. In this case, it might be wise to allow for more growth and select
(or 32) as the maximum number of subnets.
2. The second step is to make sure that there are enough host addresses for the
organization’s largest subnet.
If the largest subnet needs to support 50 host addresses today, 2
(or 32) will not provide
enough host address space so the network administrator will need to round up to 2
(or 64).
3. The final step is to make sure that the organization’s address allocation provides enough
bits to deploy the required subnet addressing plan.
For example, if the organization has a single /16, it could easily deploy 4-bits for the subnet-
number and 6-bits for the host number. If the organization has several /24s and it needs to
deploy 9 subnets, it may be required to subnet each of its /24s into four subnets (using 2 bits)
and build the Internet by combining the subnets of 3 different /24 network numbers.
An alternative solution would be to deploy network numbers from the private address space (RFC
1918) for internal connectivity and use a Network Address Translator (NAT) to provide external
Internet access. Private addresses are used for internal use, ones that will never be used for external IP
addresses are: → → →

Steps to Create an Extended Network Prefix
Address Class Address Range
Class A or /8 –
Class B or /16 –
Class C or /24 –
Valid Classful IP Address Range by Class
1. Identify the IP Address Class
2. Remove the part of the address that is associated with the Network Number (the first octet for
class A, the first two for class B, and the first three for class C) All bits of the network number
will be assigned 1 for the subnet mask.
3. Determine the number of bits that must be borrowed from the MSB of the highest remaining
octets of the host address using the equation 2
– 2 where n is the number of bits. These bits
will be set to 1 in the subnet mask.
NETW 110 Lab 04 Handout - Subnetting IP Addresses

Page 5
4. The remaining bits are the host address and are assigned 0 for the subnet mask.
To determine which subnet a host is on, the network router will AND the IP address with the subnet
mask. This is used internally on the destination network. This identifies the router and router port on
which the host resides.

Subnet Example #1
An organization has been assigned the network number by ARIN. It needs to define six
subnets, and the largest subnet is required to support 25 hosts.
Defining the Subnet Mask / Extended-Prefix Length
Based on the value in the first octet, this is a Class C IP Address.
1. The Extended Network Prefix and all host addresses must be contained in the last octet. The first
3 octets will be 255.255.255
2. Determine the number of bits required to define the six subnets AN 25 hosts per subnet. Since 2

= 8, 3 bits defines 8 subnets. So we need 3 bits for the ENP.
3. Since this is Class C, we only have 5 bits left for hosts on each subnet.
= 32 of which 30 are useable.
With 3 bits in the host address space for subnetting, and five bits for host, the subnet mask for the last
octet is 1110 0000 or 128 + 64 + 32 = 224. Since the octets associated with the network address are all
1’s, the ENP for this example is
Therefore, the IP address with ENP for the network is or with an ENP of

Range of IP Addresses by Subnet
Subnet Number Range of IP Addresses
000 →
001 →
010 →
011 →
100 →
101 →
110 →
111 →
Note: Host addresses that are all 0’s or all 1’s may not be assigned to hosts.

An example of how we find the subnet on which a host resides.
1. Assume the IP address is Represent the IP address in binary.
1100 0001 0000 0001 0000 0001 1000 1010
2. Represent the ENP in Binary
1111 1111 1111 1111 1111 1111 1110 0000
3. AND the IP with the ENP
NETW 110 Lab 04 Handout - Subnetting IP Addresses

Page 6
1100 0001 0000 0001 0000 0001 1000 1010 IP
1111 1111 1111 1111 1111 1111 1110 0000 ENP

1100 0001 0000 0001 0000 0001 1000 0000 Subnet Address
Therefore, looking at the host address remaining after ANDing the IP with the ENP, we see that the
host is on subnet 4 (100 for the subnet part of the last octet). This is used by the network routers to
route the packet to the subnet on which the host resides.

Classless Inter-Domain Routing (CIDR)
By 1992, the growth of the Internet was beginning to raise serious concerns among members of the
IETF (Internet Engineering Task Force) about the ability of the Internet's routing system to scale and
support future growth. These problems were related to:

The near-term exhaustion of the Class B network address space

The rapid growth in the size of the global Internet's routing tables

The eventual exhaustion of the 32-bit IPv4 address space
Projected Internet growth figures made it clear that the first two problems were likely to become
critical by 1994 or 1995. The response to these immediate challenges was the development of the
concept of Supernetting or Classless Inter-Domain Routing (CIDR). The third problem, which is of a
more long-term nature, is currently being explored by the IP Next Generation (IPng or IPv6) working
group of the IETF. Without the rapid deployment of CIDR in 1994 and 1995, the Internet routing
tables would have in excess of 70,000 routes instead of the current 30,000+.
CIDR was officially documented in September 1993 in RFC 1517, 1518, 1519, and 1520. CIDR
supports two important features that benefit the global Internet routing system:

CIDR eliminates the traditional concept of Class A, Class B, and Class C network addresses. This
enables the efficient allocation of the IPv4 address space that will allow the continued growth of
the Internet while IPv6 is deployed.

CIDR supports route aggregation where a single routing table entry can represent the address
space of perhaps thousands of traditional classful routes. This allows a single routing table entry to
specify how to route traffic to many individual network addresses. Route aggregation helps
control the amount of routing information in the Internet's backbone routers, reduces route
flapping (rapid changes in route availability), and eases the local administrative burden of
updating external routing information.

CIDR Promotes the Efficient Allocation of the IPv4 Address Space
CIDR eliminates the traditional concept of Class A, Class B, and Class C network addresses and
replaces them with the generalized concept of a network-prefix. Routers use the network-prefix, rather
than the first 3 bits of the IP address, to determine the dividing point between the network number and
the host number. As a result, CIDR supports the deployment of arbitrarily sized networks rather than
the standard 8-bit, 16- bit, or 24-bit network numbers associated with classful addressing.
In the CIDR model, routing information is advertised with a bit mask (or prefix-length). The prefix-
length is a way of specifying the number of leftmost contiguous bits in the network-portion of each
routing table entry. For example, a network with 20 bits of network-number and 12-bits of host-
number would be advertised with a 20-bit prefix length (a /20). The clever thing is that the IP address
advertised with the /20 prefix could be a former Class A, Class B, or Class C. Routers that support
CIDR do not make assumptions based on the first 3-bits of the address, they rely on the prefix-length
information provided with the route.

NETW 110 Lab 04 Handout - Subnetting IP Addresses

Page 7
Global Routing Tables at Capacity
A related problem was the sheer size of the Internet global routing tables. As the number of networks
on the Internet increased, so did the number of routes. A few years back it was forecasted that the
global backbone Internet routers were fast approaching their limit on the number of routes they could
support. Even using the latest router technology, the maximum theoretical routing table size is
approximately 60,000 routing table entries. If nothing was done the global routing tables would have
reached capacity by mid-1994 and all Internet growth would be halted. Two solutions were developed
and adopted by the global Internet community:
• Restructuring IP address assignments to increase efficiency
• Hierarchical routing aggregation to minimize route table entries

Restructuring IP Address Assignments
Classless Inter-Domain Routing (CIDR) is a replacement for the old process of assigning Class A, B
and C addresses with a generalized network prefix. Instead of being limited to network identifiers (or
prefixes) of 8, 16 or 24 bits, CIDR currently uses prefixes anywhere from 13 to 27 bits. Thus, blocks of
addresses can be assigned to networks as small as 32 hosts or to those with over 500,000 hosts. This
allows for address assignments that much more closely fit an organization's specific needs.
A CIDR address includes the standard 32-bit IP address and information on how many bits are used for
the network prefix. For example, in the CIDR address, the /25 indicates the first 25
bits are used to identify the unique network leaving the remaining bits to identify the specific host.
CIDR Block Prefix # Equivalent Class C # of Host Addresses
/27 1/8th of a Class C 32 hosts
/26 1/4th of a Class C 64 hosts
/25 1/2 of a Class C 128 hosts
/24 1 Class C 256 hosts
/23 2 Class C 512 hosts
/22 4 Class C 1,024 hosts
/21 8 Class C 2,048 hosts
/20 16 Class C 4,096 hosts
/19 32 Class C 8,192 hosts
/18 64 Class C 16,384 hosts
/17 128 Class C 32,768 hosts
/16 256 Class C (= 1 Class B) 65,536 hosts
/15 512 Class C 131,072 hosts
/14 1,024 Class C 262,144 hosts
/13 2,048 Class C 524,288 hosts

Hierarchical Routing Aggregation to Minimize Routing Table Entries
The CIDR addressing scheme also enables route aggregation in which a single high-level route entry
can represent many lower-level routes in the global routing tables.
The scheme is similar to the telephone network where the network is setup in a hierarchical structure.
A high level, backbone network node only looks at the area code information and then routes the call
NETW 110 Lab 04 Handout - Subnetting IP Addresses

Page 8
to the specific backbone node responsible for that area code. The receiving node then looks at the
phone number prefix and routes the call to its subtending network node responsible for that prefix and
so on. The backbone network nodes only need routing table entries for area codes, each representing
huge blocks of individual telephone numbers, not for every unique telephone number.
Currently, big blocks of addresses are assigned to the large Internet Service Providers (ISPs) who then
re-allocate portions of their address blocks to their customers. For example, Pacific Bell Internet has
been assigned a CIDR address block with a prefix of /15 (equivalent to 512 Class C addresses or
131,072 host addresses) and typically assigns its customers CIDR addresses with prefixes ranging from
/27 to /19. These customers, who may be smaller ISPs themselves, in turn re-allocate portions of their
address block to their users and/or customers. However, in the global routing tables all these different
networks and hosts can be represented by the single Pacific Bell Internet route entry. In this way, the
growth in the number of routing table entries at each level in the network hierarchy has been
significantly reduced. Currently, the global routing tables have approximately 35,000 entries.

User Impacts
The Internet is currently a mixture of both CIDR-ized addresses and old Class A, B and C addresses.
Almost all new routers support CIDR and the Internet authorities strongly encourage all users to
implement the CIDR addressing scheme.
The conversion to the CIDR addressing scheme and route aggregation has two major user impacts:
• Justifying IP Address Assignments
• Where To Get Address Assignments

Justifying IP Address Assignments
Even with the introduction of CIDR, the Internet is growing so fast that address assignments must
continue to be treated as a scarce resource. As such, customers are required to document, in detail,
their projected needs. Users may be required from time to time to document their internal address
assignments, particularly when requesting additional addresses. The current Internet guideline is to
assign addresses based on an organization's projected three month requirement with additional
addresses assigned as needed.

Where to Get Address Assignments
In the past, you would get a Class A, B or C address assignments directly from the appropriate Internet
Registry (i.e., the InterNIC). Under this scenario, you owned the address and could take it with you
even if you changed Internet Service Providers (ISPs). With the introduction of CIDR address
assignments and route aggregation, with a few exceptions, the recommended source for address
assignments is your ISP. Under this scenario, you are only renting the address and if you change ISPs
it is strongly recommended that you get a new address from your new ISP and renumber all of your
network devices.
While this can be a time-consuming task, it is critical for your address to be aggregated into your ISP's
larger address block and routed under their network address. There are still significant global routing
table issues and the smaller your network is, the greater your risk of being dropped from the global
routing tables. In fact, networks smaller than 8,192 devices will very likely be dropped. Neither the
InterNIC nor other ISPs have control over an individual ISP's decisions on how to manage their routing
tables. As an option to physically re-numbering each network device, some organizations are using
proxy servers to translate old network addresses to their new addresses. Users should be cautioned to
consider all the potential impacts carefully before using this type of solution.
NETW 110 Lab 04 Handout - Subnetting IP Addresses

Page 9
There is a new standard that has been defined, but only marginally implemented It is called IPv6 or
Next Generation Internet Addresses. Although IPv6 will not be used in this course, you should know
they exist, what format the addresses use, and how they handle IPv4 IP Addresses.

What do IPv6 addresses look like?
IPv6 addresses are 128 bits long. This number of bits generates very high decimal numbers with up to
39 digits:
-1: 340282366920938463463374607431768211455
Such numbers are not really addresses that can be memorized. Also the IPv6 address schema is bitwise
orientated (just like IPv4, but that's not often recognized). Therefore a better notation of such big
numbers is hexadecimal. In hexadecimal, 4 bits (also known as "nibble") are represented by a digit or
character from 0-9 and a-f (10-15). This format reduces the length of the IPv6 address to 32 characters.
-1: 0xffffffffffffffffffffffffffffffff
This representation is still not very convenient (possible mix-up or loss of single hexadecimal digits),
so the designers of IPv6 chose a hexadecimal format with a colon as separator after each block of 16
bits. In addition, the leading "0x" (a signifier for hexadecimal values used in programming languages)
is removed:
-1: ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
A usable address (see address types later) is e.g.:
For simplifications, leading zeros of each 16 bit block can be omitted:
3ffe:ffff:0100:f101:0210:a4ff:fee3:9566 ->
One sequence of 16 bit blocks containing only zeroes can be replaced with "::". But not more than one
at a time, otherwise it is no longer a unique representation.
3ffe:ffff:100:f101:0:0:0:1 -> 3ffe:ffff:100:f101::1
The biggest reduction is seen by the IPv6 localhost address:
0000:0000:0000:0000:0000:0000:0000:0001 -> ::1
Like IPv4, IPv6 addresses can be split into network and host parts using subnet masks. IPv4 has shown
that sometimes it would be nice, if more than one IP address can be assigned to an interface, each for a
different purpose (aliases, multi-cast). To remain extensible in the future, IPv6 is going further and
allows more than one IPv6 address to be assigned to an interface. There is currently no limit defined by
an RFC, only in the implementation of the IPv6 stack (to prevent DoS attacks).
Using this large number of bits for addresses, IPv6 defines address types based on some leading bits,
which are hopefully never going to be broken in the future (unlike IPv4 today and the history of class
A, B, and C).

Localhost Address
This is a special address for the loopback interface, similar to IPv4 with its Packets with this
address as source or destination should never leave the sending host. Under IPv6, the localhost address
NETW 110 Lab 04 Handout - Subnetting IP Addresses

Page 10
or compressed:

Unspecified address
This is a special address like "any" or "" in IPv4 . These addresses are mostly used/seen in
socket binding (to any IPv6 address) or routing tables. Note: the unspecified address cannot be used as
destination address.For IPv6 it's:

IPv6 address with embedded IPv4 address
There are two addresses that contain an IPv4 address.

IPv4-mapped IPv6 address
IPv4-only IPv6-compatible addresses are sometimes used/shown for sockets created by an IPv6-
enabled daemon, but only binding to an IPv4 address. These addresses are defined with a special prefix
of length 96 (a.b.c.d is the IPv4 address):
or in compressed format
For example, the IPv4 address looks like this:

IPv4-compatible IPv6 address
Used for automatic tunneling (RFC 2893 / Transition Mechanisms for IPv6 Hosts and Routers), which
is being replaced by 6to4 tunneling.
or in compressed format
NETW 110 Lab 04 Handout - Subnetting IP Addresses

Page 11
IP Addressing Questions
1. Given the IP network address, what subnet mask(s) will provide for a minimum of
100 subnets, each supporting at least 200 PC's? Using the subnet mask of your choice, what are
the subnet addresses, the ranges of host addresses for each subnet, and the broadcast addresses of
your subnets?
2. Comrade Network Engineer, of the Chernobyl nuclear-electric generating station has five nuclear
reactors (that have not, as of yet, melted down). In each reactor, seventeen independently
addressable Control Rod Drive Mechanisms move seventeen zirconium-clad hafnium control
rods (one rod per CRDM), to control the reactor. Given that Chernobyl Power & Light has an
assigned IP network address of, if each reactor needs its own subnet, and each CRDM
requires its own IP host address, what subnet mask(s) will meet CP&L's requirements? Based on
your recommendation for a subnet mask, what is the SCRAM (emergency shutdown) IP
broadcast address for each reactor, comrade?
3. Exponential Growth, Inc., has an IP network address of, with 47 subnets. The
maximum number of hosts they have on any one subnet is eleven. They plan to double the
number of hosts per subnet by the year 2008, and they are worried about running out of IP
addresses. They just called you in to analyze their IP network. Can you help them?
4. Given the following host addresses and subnet masks, find each subnet and its range of host
addresses and write the subnet mask in dotted decimal notation:
5. Given the following networks, numbers of subnets, and hosts per subnet, specify all possible
subnet masks in both dotted-decimal and CIDR notation:
Network Subnets Hosts/Subnet
----------- ------- ------------
a. 5 20
b. 100 200
c. 105 66
d. 3 15
e. 2000 300
f. 2 115
g. 60 2
h. 515 290