Class Notes Subnetting

Networking and Communications

Oct 24, 2013 (4 years and 6 months ago)

179 views

Class Notes
Subnetting

Classical Subnetting
As mentioned before, there are two things determines which part of the IP address is the network address
and the node address, The first was the CLASS of the IP network which was just discussed. The second is

Suppose in a Class C network, say network address 192.234.123.0., you did not have 254 nodes on this
network, but only 20 nodes. Instead of monopolizing the entire network address for only 20 nodes, it
would be better to create a separate network of your 20 computers and allow someone else to utilize the
remaining numbers in their own separate network (or subnetwork). In other words, there may be a
situation in which you want to subdivide a network address into smaller independent networks. This
practice is know as subnetting and a subnet mask is used to distinguish where one network ends and
another begins. It is the subnet mask that tells us which bits are used for the network address and which
are used for the node address.

Efficient in the use of IP addresses
Each subnet can be a collision domain segment

Example: Given the IP address of 190.10.20.0 and the subnet mask of 255.255.255.192
a) How many valid subnets?
b) How many possible hosts in each subnet?
c) What are the network address, the IP address of the first host, second host, last host, and broadcast

With a Class C address, you have the 1st 3 octets as the Network address and the last octet for host, or
N.N.N.n
Thus only the last octet can be used for subnetting.
Given a subnet mask of: 255.255.255.192, or
11111111.11111111.11111111.11000000

We see that 2 bits of the last octet (the node octet) will be used for subnetting and the remaining 6 bits will be
used to define the hosts. With 2 bits for subnetting, how many subnets can you have?
00 - not allowed since all subnet bits cannot be turned off at the same time
01 - valid subnet
10 - valid subnet
11 - not allowed since all subnet bits cannot be turned on at the same time

Thus there are only 2 valid subnets:
01000000=64 and 100000000=128

Note that the minimum number of bits you can use for subnetting is 2 bits. You cannot use 1 bit for
subnetting since this would automatically violate the rule that subnet bits cannot be all turned off or
on at the same time.

First Subnet

The valid hosts within each subnet is defined by 6 bits (64) minus 000000 and 111111. Remember that a
address (see reservedaddress above). Thus the first node in subnet 01 is 000001 (65) and the last node is
111110 (126).
Subnet 64 Host
01 000000 Refers to the network address
01 000001 Refers to the first host in the subnet
01 000010 Refers to the second host in the subnet
01 000011 Refers to the third host in the subnet
01 111110 Refers to the last host address in the subnet

Subnet 128 Host
10 000000 Refers to the network address
10 000001 Refers to the first host in the subnet
10 000010 Refers to the second host in the subnet
10 000011 Refers to the third host in the subnet
10 111110 Refers to the last host address in the subnet

Thus we see that:
1) the number of subnets is always 2
n
-2, where n is the number of bits used for subnetting.
2) the number of host in each subnet is always 2
h
-2, where h is the number of bits used to define the
hosts.

EXAMPLE: Given a network address 192.168.10.0 and the subnet mask is 255.255.255.224
or 1111111.1111111.11111111.11100000
a) How many possible subnets? 6 since 3 bits are used for subnetting 2
3
-2=6.
b) How many possible hosts for each subnet? 30 since 5 bits are used for hosts 2
5
-2=30.
c) What are the valid subnets?
00100000=32
01000000=64
01100000=96
10000000=128
10100000=160
11000000=192
each subnet?

Subnet#1 Subnet#2 Subnet#3
Network 192.168.10.32 192.168.10.64 192.168.10.96
First Host 192.168.10.33 192.168.10.65 192.168.10.97
Last Host 192.168.10.62 192.168.10.94 192.168.10.126

Subnet#4 Subnet#5 Subnet#6
Network 192.168.10.127 192.168.10.160 192.168.10.192
First Host 192.168.10.129 192.168.10.161 192.168.10.193
Last Host 192.168.10.158 192.168.10.190 192.168.10.222

EXAMPLE:
Given the Network Address 192.168.10.0 1100 0000.1010 1000.0000 1010.0000 0000
And the subnet mask 255.255.255.248 1111 1111.1111 1111.1111 1111.1111 1000

(1) Number of subnets = 2
5
-2=30
(2) Number of hosts = 2
3
-2=6
(3) Show the subnets:
00001 000 = 8 01011 000 = 88 10101 000 = 168
00010 000 = 16 01100 000 = 96 10110 000 = 176
00011 000 = 24 01101 000 = 104 10111 000 = 184
00100 000 = 32 01110 000 = 112 11000 000 = 192
00101 000 = 40 01111 000 = 120 11001 000 = 200
00110 000 = 48 10000 000 = 128 11010 000 = 208
00111 000 = 56 10001 000 = 136 11011 000 = 216
01000 000 = 64 10010 000 = 144 11100 000 = 224
01001 000 = 72 10011 000 = 152 11101 000 = 232
01010 000 = 80 10100 000 = 160 11110 000 = 240

Again, note that a subnet address of all 0’s and all 1’s cannot be used.

First Three Subnets
First host Address 192.168.10.9 192.168.10.17 192.168.10.25
Last host Address 192.168.10.14 192.168.10.22 192.168.10.30

Last Three Subnets
First host Address 192.168.10.225 192.168.10.233 192.168.10.241
Last host Address 192.168.10.230 192.168.10.238 192.168.10.246

A Class B IP address (N.N.n.n) can possibly use 16 bits for the Network address and 16 bits to define the
hosts.

EXAMPLE:
11111111.11111111.11000000.00000000
2 bits used for subnetting and 14 bits used for defining host
(1) Number of subnets = 2
2
-2=2
(2) Number of hosts = 2
14
-2=16,382
(3) List subnets 64,128

EXAMPLE:
11111111.11111111.11110000.00000000
4 bits used for subnetting and 12 bits used for defining host
(1) Number of subnets = 2
4
-2=14
(2) Number of hosts = 2
12
-2=4094
(3) List subnets 16,32,48,64,80????,…..224

Addresses Subnet 16 Subnet 32 Subnet 48
First host Address 172.16.16.1 172.16.32.1 172.16.48.1
Last host Address 172.16.31.254 172.16.47.254 172.16.63.254

Addresses Subnet 64 Subnet 80….. Subnet 224
First host Address 172.16.64.1 172.16.80.1 172.16.224.1
Last host Address 172.16.79.254 172.16.95.254 172.16.239.254

EXAMPLE:
11111111.11111111.11111110.00000000
7 bits used for subnetting and 9 bits used for defining host
(1) Number of subnets = 2
7
-2=126
(2) Number of hosts = 2
9
-2=510
(3) List subnets 2,4,6,8,…..252

Addresses Subnet 2 Subnet 4 Subnet 6
First host Address 172.16.2.1 172.16.4.1 172.16.6.1
Last host Address 172.16.3.254 172.16.5.254 172.16.7.254

Addresses Subnet 8 Subnet 10….. Subnet 252
First host Address 172.16.8.1 172.16.10.1 172.16.252.1
Last host Address 172.16.9.254 172.16.11.254 172.16.253.254

Examples of subnetting a Class A Address:
A Class A IP address (N.n.n.n) can possibly use 8 bits for the Network address and 24 bits to define the
hosts. 22 of the 24 node bits can be used for subnetting since at least 2 bits must be used for defining
hosts.

Exercises for subnetting:
1) Given a network address 195.1.168.0 and the subnet mask is 255.255.255.248
A) How many possible subnets?
B) How many possible hosts for each subnet?
C) For the first, second and last subnets find:
b) The IP address of the first host
c) The IP address of the 2nd host
d) The IP address of the last host

2) Given a network address 129.10.0.0 and the subnet mask is 255.255.248.0
A) How many possible subnets?
B) How many possible hosts for each subnet?
C) For the first, second and last subnets find:
b) The IP address of the first host
c) The IP address of the 2nd host
d) The IP address of the last host

A Subnetting Design Problem:
Configure the routers for a group of subnets associated with the Class C
IP# 207.207.7.0 with a subnet mask of 255.255.255.240.

255 255 255 240
11111111.11111111.11111111.11110000

Routers: Router have 3 basic ports: S0, S1, E0
Serial ports S0 and S1 - Routers are connected through these serial ports. The S0 port of 1 router is
connected to the S1 port of the next router. The protocol running between these two ports are OSI Layer
2, usually HDLC. The "wire" between these ports can be considered a subnet. Thus an IP address of this
subnet used for port S0 of a router and the next IP address of this subnet is used for port S1 of the next
router.

Ethernet ports E0 - connected to this port are the Ethernet local area network. A subnet address is also
associated with this Ethernet network. Thus the first IP address of this subnet is used for the E0 port. This
IP address is the Gateway IP Address which is used for TCP/IP configuration.

CIDR: New procedures for subnetting
From http://public.pacbell.net/dedicated/cidr.html

Classless Inter-Domain Routing (CIDR) is a new addressing scheme for the Internet which
allows for more efficient allocation of IP addresses than the old Class A, B, and C address
routers and corresponding software are CIDR compatible, while the older routers and software
may be only Classful compatible.

Why Do We Need CIDR?
With new networks constantly being brought on-line, the Internet was faced with two critical
problems:
1) Running out of IP addresses
2) Running out of capacity in the global routing tables

There is a maximum number of networks and hosts that can be assigned unique addresses using
Class A, Class B and Class C were the most common. Each address had two parts: one part to
identify a unique network and the second part to identify a unique host in that network. Another
way the old Class A, B, and C addresses were identified was by looking at the first 8 bits of the
address and converting it to its decimal equivalent.

Class A 8 bits 24 bits 1-126
Class B 16 bits 16 bits 128-191
Class C 24 bits 8 bits 192-223

Using the old Class A, B, and C addressing scheme the Internet could support the following:

1) 126 Class A networks that could include up to 16,777,214 hosts each
2) Plus 65,000 Class B networks that could include up to 65,534 hosts each
3) Plus over 2 million Class C networks that could include up to 254 hosts each

generally only assigned in these three sizes, there was a lot of wasted addresses. For example, if
you needed 100 addresses you would be assigned the smallest address (Class C), but that still
meant 154 unused addresses. The overall result was that while the Internet was running out of
unassigned addresses, only 3% of the assigned addresses were actually being used. CIDR was
developed to be a much more efficient method of assigning addresses.

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.

How Were These Problems Solved?
Two solutions were developed and adopted by the global Internet community:
1) Restructuring IP address assignments to increase efficiency
2) Hierarchical routing aggregation to minimize route table entries

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 also information on how many bits
are used for the network prefix. For example, in the CIDR address 206.13.01.48/25, 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 65,536 hosts
(= 1 Class B)
/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 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
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. (We recommend that any new router you
purchase should support CIDR).

The conversion to the CIDR addressing scheme and route aggregation has two major user
impacts:
2) Where To Get 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 will be required to
document, in detail, their projected needs. Users may be required from time to time to document
Internet guideline is to assign addresses based on an organization's projected three month

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 re-number 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 carefully consider all the potential impacts before using this type of solution.

For more detailed technical information on CIDR, go to
http://www.rfc-editor.org/rfcsearch.html
and type in the number of the CIDR RFC you are interested in:
RFC 1517: Applicability Statement for the Implementation of CIDR
RFC 1518: An Architecture for IP Address Allocation with CIDR
RFC 1519: CIDR: An Address Assignment and Aggregation Strategy
RFC 1520: Exchanging Routing Information Across Provider Boundaries
in the CIDR Environment
As mentioned before, there are a few exceptions where an organization would not use an ISP
The above information was taken from http://public.pacbell.net/dedicated/cidr.html

Classful Routing Vs Classless Routing

Classful Routing: We have seen that Classful IP routing rely on the Subnet Mask to differentiate
host addresses from network addresses. An underlying characteristic of Classful routing is that
the subnet mask is not carried in the periodic updates which are transferred between routers. This
means that every interface and host on a sub-network must use the same subnet mask. Said
another way, since subnet mask information is not interchanged within periods updates, then host
on a subnet will assume the same subnet mask. This results in wasted address space.
Example:
Suppose you are using IP# 207.207.7.0 with a subnet mask of 255.255.255.240.
255 255 255 240
11111111.11111111.11111111.11110000

207.207.7.32 207.207.7.64
---| Router A |---------------| Router B |-----------------| Router C|----

207.207.7.16 207.207.7.48

The subnet 207.207.7.32 is used for the connection between the two routers and therefore uses
only 2 IP addresses in that subnet. All other IP addresses are wasted.

Classless Routing
In contrast, Classless routing sends out the subnet mask information with periodic routing table
updates. This allows Variable Length Subnet Masks (VLSM) to be used on the network.

EXAMPLE: Use 207.207.7.16/28 on the Ethernet network and 207.207.7.32/30 on the
interconnection WAN between the two routers.

207.207.7.16/28 207.207.7.32/30

207.207.7.36/30 207.207.7.40/30

207.207.7.44/30 207.207.7.48/28