Introduction to Subnetting - Contemporary Controls

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

23 Οκτ 2013 (πριν από 3 χρόνια και 9 μήνες)

270 εμφανίσεις

Volume 1 • Issue 8
September–October 2000
Introduction to
Industrial Ethernet, Part 5.
Part 4 was featured in Issue 6,
MAY–JUNE 2000. If you would like
a copy, please send your request to
A Technical Supplement to control NETWORK
© 2000 Contemporary Control Systems, Inc.
How to maximize network addresses.
By George Thomas,
Contemporary Controls
address to distinguish it from the
Class Addressing
other computers. With IP
IPv4 is called a classful system
In a previous article we discussed
addressing, servers and
under RFC 761 with IP addresses
the Internet Protocol and the
workstations are all termed hosts
being defined as belonging to one
structure of IP addresses. An IP
but each address not only identifies
of five classes A, B, C, D or E.
address identifies the source and
a host but the address of the
Classes A, B and C define different
destination of a directed or unicast
network on which the host resides.
possible combinations of network
message and is defined in RFC 761.
This is because IP is an
and host addresses. Class D is
IPv4 is the most common version
internetworking protocol that not
reserved for multicasting.
of IP addressing requiring 32-bit
only allows communication
Multicasting is the ability of one
addresses. Although IPv6, the 128-
between hosts on the same
host to communicate with many
bit version, will be used in the
network, but communication
other hosts with one transmission
future, this article will restrict the
between hosts on different
and is beyond the scope of this
discussion to IPv4. IPv6 was
networks as well. The 32-bit IP
article. Class E is reserved for future
developed because the explosive
address identifies a particular host
use. The classes of interest to
growth of the Internet will soon
along with the network on which
subnetting are A, B and C.
deplete the inventory of available
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
of the address identifies the network
host on the public Internet can be
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 to
looking at either an A, B, C, D or E
Networks and Hosts For example address? 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.
identify the class of address. For a
workstation would have a unique
1class A address, the left most bit 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 and for a class
address, the first four bits must be a class B address uses 14 bits for C address it is 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.
argument further, move eight of the
Reserved Addresses
host bits (actually the complete third
There are some reserved IP address byte) to the network side. The result
Class A 1-126
besides those identified as classes D is 22 bits for network addressing
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
Class D 224-239
“this” network. Class A address addresses are called subnets and not
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
Assume we begin with IP address
all hosts on the network. Therefore, using routers, and routers improve From figure 1 we know
with any host addressing on either a network performance by reducing
that this is a class B address with a
class A, B or C network, you lose 2 traffic and minimizing disruption
network address of 165.10 with the
host addresses. Still with 4 billion due to broadcast messages. Large
capability of assigning up to 65,534
possible addresses from a 32-bit networks become more manageable
hosts. We do not want 65,534 hosts
address space, you would think when subnets are deployed.
on one network but would like to
there are plenty of addresses even
have up to 500 hosts on each
with reserved addresses. The
subnet. In order to have 500 hosts
problem is that there was much
on one subnet, we need to have 9
waste when addresses were
bits of host addressing. Currently,
originally assigned. For example, a To create subnets you need a
we have 16 bits of host addressing
class A address can handle 16 subnet mask that defines which bits
since we possess a class B address.
million hosts per one network ID. will be used to create the new
That means that we can reassign 7
That is an enormous amount of network address out of the 32-bit IP
of those bits to signify subnet bits.
hosts for just one network. Even a addresses. By “ANDing” the 32-bit
Therefore, the subnet mask would
class B address can handle 65 IP address with a 32-bit mask, we
be In binary it
thousand hosts per network ID. A create a 32-IP address that
would be:
class C address can handle only 254 represents <netid, subnetid>
hosts per network ID which may be becoming our new network address.
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 so in order to
host assignments and that is called mask would look like create subnets we moved mask bits
subnetting. which is called a natural or default to the right in order to convert more
2host bits to network bits. It must be
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
First byte Last three bytes
For example, the above mask allows
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
21 bits of network address 8 bits of host address
Class C 110
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 –
What would be the subnet mask? It
would be The 1s are Class E 1111 Class E – Reserved for future use
still contiguous from the left. This
Figure 2. Address classes define the split between network and host IDs.
approach creates many subnets, but
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 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
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
of the natural mask (changing 1 bits to
to 0s) consuming network bits. This
Using the last subnet mask in the to is called supernetting which requires
above example, we have 1022 host
contiguous network addresses and
addresses. What if our computer
will be discussed shortly. By moving
actually had host address 768 on
the mask to the left by four bits to
subnet 4? What would be our actual
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 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
255. The actual IP address would be
addresses with 16 bits of host is short for indicating a range of 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 to The same is
the actual subnet address and host
addressing. Using CIDR notation true for the last example which are
these same address ranges can be C class addresses. The natural mask
displayed as follows: for a C address is /24. Instead the
There is a simpler way of
CIDR notation is a /16 meaning
representing the actual IP address
eight less mask bits thereby yielding
and that is by using the Classless
a range of network addresses from
InterDomain Routing (CIDR) to
scheme. With this scheme the
concept of A, B and C classes is
eliminated, but the concept of
The natural mark for a class A
subnetting is retained. In the above SUPERNETTING
address is which means
example, we use a total of 22 bits of
eight contiguous 1s from the left so
The inverse of subnetting is
contiguous 1s in our mask so we represents the natural
supernetting. Instead of moving
would display our IP address as
mask for a class A address. This is
mask bits to the right of the natural Although it is still not
what we would expect. A single
mask for subnetting, we move mask
obvious that we are host 768 on
class A network address with
bits to the left for supernetting. With
subnet 4 of network 165.10, we can
provisions for 24 bits of host
subnetting we create more network
3addresses at the expense of host
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.
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 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.
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