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

TCP-IP Intro Subnetting

Uploaded by

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

TCP-IP Intro Subnetting

Uploaded by

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

Volume 1 • Issue 8

September–October 2000

EXTENSION
Introduction to
Industrial Ethernet, Part 5.

Part 4 was featured in Issue 6,


MAY–JUNE 2000. If you would like
the
a copy, please send your request to
[email protected] A Technical Supplement to c o n t r o l NETWORK
© 2000 Contemporary Control Systems, Inc.

INTRODUCTION TO SUBNETTING
How to maximize network addresses.
By George Thomas,
Contemporary Controls

INTRODUCTION address to distinguish it from the Class Addressing


other computers. With IP
In a previous article we discussed addressing, servers and IPv4 is called a classful system
the Internet Protocol and the workstations are all termed hosts under RFC 761 with IP addresses
structure of IP addresses. An IP but each address not only identifies being defined as belonging to one
address identifies the source and a host but the address of the of five classes A, B, C, D or E.
destination of a directed or unicast network on which the host resides. Classes A, B and C define different
message and is defined in RFC 761. possible combinations of network
This is because IP is an
IPv4 is the most common version and host addresses. Class D is
internetworking protocol that not
of IP addressing requiring 32-bit reserved for multicasting.
only allows communication
addresses. Although IPv6, the 128- Multicasting is the ability of one
between hosts on the same
bit version, will be used in the host to communicate with many
network, but communication
future, this article will restrict the other hosts with one transmission
between hosts on different
discussion to IPv4. IPv6 was and is beyond the scope of this
networks as well. The 32-bit IP
developed because the explosive article. Class E is reserved for future
address identifies a particular host use. The classes of interest to
growth of the Internet will soon along with the network on which
deplete the inventory of available subnetting are A, B and C.
the host resides. The structure of IP
addresses. At one time, 32-bit
addressing is defined so that any With class A addresses, the first byte
addresses seemed to provide more
host on the public Internet can be of the address identifies the network
than enough addresses but there
found by any other host. address while the three remaining
was much waste in initial
bytes identify the host. With class B
assignments and the class structure The format of the 32-bit address is addresses, the first two bytes
of IP addresses was inefficient. In <netid, hostid> and it is usually identify the network address while
order to make more efficient usage shown as four bytes of data. the remaining two identify the host
of IP address, the concept of Although each byte could be address. With class C addresses, the
subnetting was introduced with represented as a binary, decimal or first three bytes identify the network
RFC 950. This article introduces hexadecimal number, the decimal- address while the last byte identifies
this concept. dot-decimal notation is the most the host. That seems simple enough
popular. Therefore, the range of IP but how do you know you are
addresses can span 0.0.0.0 to looking at either an A, B, C, D or E
Networks and Hosts 255.255.255.255. For example address?
193.5.8.254 is a valid IP address but
When we talk about a network we The four-byte IP address is viewed
it is difficult to determine which part
usually envision a cluster of from left to right with the first byte
of the address is the network ID
workstations with one or more on the left. This is the most
and which part is the host ID. To
servers connected to a local area significant byte. The first few bits
understand the two you need to
network. Each server and (most significant) of that byte
know about class addressing.
workstation would have a unique identify the class of address. For a

1
class A address, the left most bit SUBNETTING mask. Only those bits that are set as
must be a zero. For a class B a 1 will be considered when
address, the first two bits must be a Subnetting creates additional defining a network address. In this
10. For a class C address, the first network IDs at the expense of host case, all the bits in the first byte of
three bits must be a 110. For a IDs and can be used with either A, the IP address will be considered.
class D address, the first four bits B or C class addresses. If you look The natural mask for a class B
must be a 1110. For a class E at figure 2, you will notice that a address is 255.255.0.0 and for a class
address, the first four bits must be a class B address uses 14 bits for C address it is 255.255.255.0. In
1111. Therefore, it is only necessary network addressing and 16 bits for order to create more network
to observe the first byte of the IP host addressing. By simply addresses (subnets) we need to
address to determine its class. reassigning one of the host bits to a move the mask bits to the right
Figure 1 shows the decimal value of network bit, you would double the (changing 0 bits into 1s) in order to
the first byte for each class. number of available network convert host bits into network bits.
addresses but halve the number of The best way to understand the
host addresses. Carrying the concept is to use an example.
Reserved Addresses argument further, move eight of the
host bits (actually the complete third
There are some reserved IP address byte) to the network side. The result
besides those identified as classes D is 22 bits for network addressing Class A 1-126
and E. For example, the class A and eight bits for host addressing Class B 128-191
network address 0.X.X.X cannot be which is quite similar to a class C
Class C 192-223
used since it is used to indicate address. These additional network
“this” network. Class A address addresses are called subnets and not Class D 224-239
127.X.X.X is reserved for loop back networks because to the Internet, Class E 240-254
testing. With the host portion of the the original address is still a class B
address, you cannot have an all 0s network address but locally the Figure 1. The class of an IP address
host, which refers to the network class B network address can be can be quickly identified by
address where the hosts reside. broken down to manageable observing only the first byte.
Likewise you cannot use the all 1s subnets that function as actual
host address because that indicates network addresses. Why use
a broadcast which is a message to subnets? Subnets are interconnected
all hosts on the network. Therefore, using routers, and routers improve Assume we begin with IP address
with any host addressing on either a network performance by reducing 165.10.0.0. From figure 1 we know
class A, B or C network, you lose 2 traffic and minimizing disruption that this is a class B address with a
host addresses. Still with 4 billion due to broadcast messages. Large network address of 165.10 with the
possible addresses from a 32-bit networks become more manageable capability of assigning up to 65,534
address space, you would think when subnets are deployed. hosts. We do not want 65,534 hosts
there are plenty of addresses even on one network but would like to
with reserved addresses. The have up to 500 hosts on each
problem is that there was much subnet. In order to have 500 hosts
MASKING on one subnet, we need to have 9
waste when addresses were
originally assigned. For example, a To create subnets you need a bits of host addressing. Currently,
class A address can handle 16 subnet mask that defines which bits we have 16 bits of host addressing
million hosts per one network ID. will be used to create the new since we possess a class B address.
That is an enormous amount of network address out of the 32-bit IP That means that we can reassign 7
hosts for just one network. Even a addresses. By “ANDing” the 32-bit of those bits to signify subnet bits.
class B address can handle 65 IP address with a 32-bit mask, we Therefore, the subnet mask would
thousand hosts per network ID. A create a 32-IP address that be 255.255.254.0. In binary it
class C address can handle only 254 represents <netid, subnetid> would be:
hosts per network ID which may be becoming our new network address. 11111111.11111111.11111110.00000000
too little for some networks. A What do these masks look like? If
scheme was needed to obtain a we start with a basic class A address The natural mask for a class B
better balance between network and and do not define any subnets, the address is 255.255.0.0 so in order to
host assignments and that is called mask would look like 255.0.0.0 create subnets we moved mask bits
subnetting. which is called a natural or default to the right in order to convert more

2
host bits to network bits. It must be Address Network Address Host Address
remembered that these mask bits Identifier
must be contiguous from the left. 7 bits of network address 24 bits of host address
Class A 0
For example, the above mask allows First byte Last three bytes

up to 510 host assignments. 14 bits of network address 16 bits of host address


Class B 10 First two bytes Last two bytes
Remember that we cannot use
either an all 0s or all 1s host Class C 110 21 bits of network address 8 bits of host address
First three bytes Last byte
address. The next jump would be
to allow up to 1022 host addresses. Class D 1110 Multicast address in the range of 224.0.0.0 – 239.255.255.255
What would be the subnet mask? It
would be 255.255.252.0. The 1s are Class E 1111 Class E – Reserved for future use
still contiguous from the left. This
approach creates many subnets, but Figure 2. Address classes define the split between network and host IDs.
it is recommended that neither an
all 0s nor all 1s subnet be used. figure it out using this single addressing. The natural mask for a
This could cause a problem on notation which tells us exactly class B address is 255.255.0.0 which,
some networks. How many mask where the subnet mask separates with CIDR notation, would be /16
bits can you have? You need to the network and host addresses. but the above class B addresses
have some hosts on a network and have only 12 mask bits of
two host addresses are unusable so For example, in a previous article contiguous 1s. This seems to violate
the maximum number of mask bits we mentioned that there were one our rule for subnetting and it does.
is 30 leaving two valid host A, 32 B and 256 C addresses that With subnetting you move the bits
addresses. were strictly private and cannot be to the right of the natural mask
accessed through the Internet. These thereby consuming host bits. Instead
are as follows: we are moving the mask to the left
NOTATION 10.0.0.0 to 10.255.255.255 of the natural mask (changing 1 bits
to 0s) consuming network bits. This
Using the last subnet mask in the 172.16.0.0 to is called supernetting which requires
above example, we have 1022 host contiguous network addresses and
addresses. What if our computer 172.31.255.255 will be discussed shortly. By moving
actually had host address 768 on the mask to the left by four bits
subnet 4? What would be our actual 192.168.0.0 to 192.168.255.255
from the natural mask, we can gain
IP address? We cannot say it is Notice that the first range is a more host addresses at the expense
165.10.4.768 since with decimal single A address with 24 bits of of 16 contiguous network addresses.
notation no byte can be more than host addressing, the second are B Therefore, the notation 172.16.0.0/12
255. The actual IP address would be addresses with 16 bits of host is short for indicating a range of
165.10.7.0 so you do need to know addressing and the third are C contiguous network addresses from
the subnet mask before determining addresses with 8 bits of host 172.16.0.0 to 172.31.0.0. The same is
the actual subnet address and host addressing. Using CIDR notation true for the last example which are
address. these same address ranges can be C class addresses. The natural mask
There is a simpler way of displayed as follows: for a C address is /24. Instead the
representing the actual IP address CIDR notation is a /16 meaning
10.0.0.0/8 eight less mask bits thereby yielding
and that is by using the Classless
InterDomain Routing (CIDR) 172.16.0.0/12 a range of network addresses from
scheme. With this scheme the 192.168.0.0 to 192.168.255.0.
concept of A, B and C classes is 192.168.0.0/16
eliminated, but the concept of The natural mark for a class A
subnetting is retained. In the above address is 255.0.0.0 which means SUPERNETTING
example, we use a total of 22 bits of eight contiguous 1s from the left so
contiguous 1s in our mask so we The inverse of subnetting is
10.0.0.0/8 represents the natural supernetting. Instead of moving
would display our IP address as mask for a class A address. This is
165.10.7.0/22. Although it is still not mask bits to the right of the natural
what we would expect. A single mask for subnetting, we move mask
obvious that we are host 768 on class A network address with
subnet 4 of network 165.10, we can bits to the left for supernetting. With
provisions for 24 bits of host subnetting we create more network

3
addresses at the expense of host SUMMARY
addresses. With supernetting we
create more host addresses at the Although a 32-bit IP address offers
expense of network addresses. an extremely large number of
Supernetting is not for users since it addresses, the A, B, C, class
would be difficult for users to be structure does not make efficient
granted a range of contiguous use of <netid, hostid> assignments.
network addresses. Supernetting is Subnetting improves the situation by
for Internet Service Providers (ISPs) allowing a finer split between
who are attempting to obtain the network and host assignments while
most efficient allocation of IP improving the performance and
addresses using the A, B, C class maintainability of large networks.
scheme.

SUBNETTING A CLASS C ADDRESS


Subnet mask CIDR # Subnets # Host

11111111.11111111.11111111.00000000 /24 0 254


11111111.11111111.11111111.11000000 /26 2 62
11111111.11111111.11111111.11100000 /27 6 30
11111111.11111111.11111111.11110000 /28 14 14
11111111.11111111.11111111.11111000 /29 30 6
11111111.11111111.11111111.11111100 /30 62 2

The natural mask for a class C address is 255.255.255.000 which provides


for up to 254 host addresses. By moving the mask bits to the right
(replacing 0s for 1s), subnets are created at the expense of host bits. Not
shown are masks /25 and /31 since they are not allowed. Similar charts
can be made for class A and class B addressing. Class A subnetting begins
at /10 and class B at /18. Both end at /30.

REFERENCES
Illustrated TCP/IP, Matthew Naugle, 1998, Wiley Computer Publishing

Practical Networking With Ethernet, Charles E. Spurgeon, 1997,


International Thomson Computer Press

International Standard ISO/IEC 8802-3 ANSI/IEEE std 802.3, 1996,


The Institute of Electrical and Electronic Engineers, Inc.

TCP/IP Clearly Explained, Pete Loshin, 1997, Academic Press

TCP/IP Illustrated, Volume 1, The Protocols, W. Richard Stevens, 1994,


Addison-Wesley Publishing Company

www.ccontrol.com

You might also like