Sie sind auf Seite 1von 23

IP Addressing and Subnetting for New

Users
Updated:August 10, 2016
Document ID:1456953685377642

Contents
Introduction
Prerequisites
Requirements
Components Used
Additional Information
Understand IP Addresses
Network Masks
Understand Subnetting
Examples
Sample Exercise 1
Sample Exercise 2
VLSM Example
VLSM Example
CIDR
Appendix
Sample Config
Router A
Router B
Host/Subnet Quantities Table
Related Information

Introduction
This document provides basic information needed in order to configure your router for
routing IP, such as how addresses are broken down and how subnetting works. You learn
how to assign each interface on the router an IP address with a unique subnet. There are
examples included in order to help tie everything together.

Prerequisites
Requirements

Cisco recommends that you have a basic understanding of binary and decimal numbers.

Components Used

This document is not restricted to specific software and hardware versions.


The information in this document was created from the devices in a specific lab environment.
All of the devices used in this document started with a cleared (default) configuration. If your
network is live, make sure that you understand the potential impact of any command.

Additional Information

If definitions are helpful to you, use these vocabulary terms in order to get you started:

 Address - The unique number ID assigned to one host or interface in a network.


 Subnet - A portion of a network that shares a particular subnet address.
 Subnet mask - A 32-bit combination used to describe which portion of an address
refers to the subnet and which part refers to the host.
 Interface - A network connection.

If you have already received your legitimate address(es) from the Internet Network
Information Center (InterNIC), you are ready to begin. If you do not plan to connect to the
Internet, Cisco strongly suggests that you use reserved addresses from RFC 1918 .

Understand IP Addresses
An IP address is an address used in order to uniquely identify a device on an IP network. The
address is made up of 32 binary bits, which can be divisible into a network portion and host
portion with the help of a subnet mask. The 32 binary bits are broken into four octets (1 octet
= 8 bits). Each octet is converted to decimal and separated by a period (dot). For this reason,
an IP address is said to be expressed in dotted decimal format (for example, 172.16.81.100).
The value in each octet ranges from 0 to 255 decimal, or 00000000 - 11111111 binary.

Here is how binary octets convert to decimal: The right most bit, or least significant bit, of an
octet holds a value of 20. The bit just to the left of that holds a value of 21. This continues
until the left-most bit, or most significant bit, which holds a value of 27. So if all binary bits
are a one, the decimal equivalent would be 255 as shown here:

1 1 1 1 1 1 1 1
128 64 32 16 8 4 2 1 (128+64+32+16+8+4+2+1=255)

Here is a sample octet conversion when not all of the bits are set to 1.

0 1 0 0 0 0 0 1
0 64 0 0 0 0 0 1 (0+64+0+0+0+0+0+1=65)

And this sample shows an IP address represented in both binary and decimal.

10. 1. 23. 19 (decimal)


00001010.00000001.00010111.00010011 (binary)

These octets are broken down to provide an addressing scheme that can accommodate large
and small networks. There are five different classes of networks, A to E. This document
focuses on classes A to C, since classes D and E are reserved and discussion of them is
beyond the scope of this document.
Note: Also note that the terms "Class A, Class B" and so on are used in this document in
order to help facilitate the understanding of IP addressing and subnetting. These terms are
rarely used in the industry anymore because of the introduction of classless interdomain
routing (CIDR).

Given an IP address, its class can be determined from the three high-order bits (the three left-
most bits in the first octet). Figure 1 shows the significance in the three high order bits and
the range of addresses that fall into each class. For informational purposes, Class D and Class
E addresses are also shown.

Figure 1

In a Class A address, the first octet is the network portion, so the Class A example in Figure 1
has a major network address of 1.0.0.0 - 127.255.255.255. Octets 2, 3, and 4 (the next 24 bits)
are for the network manager to divide into subnets and hosts as he/she sees fit. Class A
addresses are used for networks that have more than 65,536 hosts (actually, up to 16777214
hosts!).

In a Class B address, the first two octets are the network portion, so the Class B example in
Figure 1 has a major network address of 128.0.0.0 - 191.255.255.255. Octets 3 and 4 (16 bits)
are for local subnets and hosts. Class B addresses are used for networks that have between
256 and 65534 hosts.
In a Class C address, the first three octets are the network portion. The Class C example in
Figure 1 has a major network address of 192.0.0.0 - 223.255.255.255. Octet 4 (8 bits) is for
local subnets and hosts - perfect for networks with less than 254 hosts.

Network Masks
A network mask helps you know which portion of the address identifies the network and
which portion of the address identifies the node. Class A, B, and C networks have default
masks, also known as natural masks, as shown here:

Class A: 255.0.0.0
Class B: 255.255.0.0
Class C: 255.255.255.0

An IP address on a Class A network that has not been subnetted would have an address/mask
pair similar to: 8.20.15.1 255.0.0.0. In order to see how the mask helps you identify the
network and node parts of the address, convert the address and mask to binary numbers.

8.20.15.1 = 00001000.00010100.00001111.00000001
255.0.0.0 = 11111111.00000000.00000000.00000000

Once you have the address and the mask represented in binary, then identification of the
network and host ID is easier. Any address bits which have corresponding mask bits set to 1
represent the network ID. Any address bits that have corresponding mask bits set to 0
represent the node ID.

8.20.15.1 = 00001000.00010100.00001111.00000001
255.0.0.0 = 11111111.00000000.00000000.00000000
-----------------------------------
net id | host id

netid = 00001000 = 8
hostid = 00010100.00001111.00000001 = 20.15.1

Understand Subnetting
Subnetting allows you to create multiple logical networks that exist within a single Class A,
B, or C network. If you do not subnet, you are only able to use one network from your Class
A, B, or C network, which is unrealistic.

Each data link on a network must have a unique network ID, with every node on that link
being a member of the same network. If you break a major network (Class A, B, or C) into
smaller subnetworks, it allows you to create a network of interconnecting subnetworks. Each
data link on this network would then have a unique network/subnetwork ID. Any device, or
gateway, that connects n networks/subnetworks has n distinct IP addresses, one for each
network / subnetwork that it interconnects.

In order to subnet a network, extend the natural mask with some of the bits from the host ID
portion of the address in order to create a subnetwork ID. For example, given a Class C
network of 204.17.5.0 which has a natural mask of 255.255.255.0, you can create subnets in
this manner:
204.17.5.0 - 11001100.00010001.00000101.00000000
255.255.255.224 - 11111111.11111111.11111111.11100000
--------------------------|sub|----

By extending the mask to be 255.255.255.224, you have taken three bits (indicated by "sub")
from the original host portion of the address and used them to make subnets. With these three
bits, it is possible to create eight subnets. With the remaining five host ID bits, each subnet
can have up to 32 host addresses, 30 of which can actually be assigned to a device since host
ids of all zeros or all ones are not allowed (it is very important to remember this). So, with
this in mind, these subnets have been created.

204.17.5.0 255.255.255.224 host address range 1 to 30


204.17.5.32 255.255.255.224 host address range 33 to 62
204.17.5.64 255.255.255.224 host address range 65 to 94
204.17.5.96 255.255.255.224 host address range 97 to 126
204.17.5.128 255.255.255.224 host address range 129 to 158
204.17.5.160 255.255.255.224 host address range 161 to 190
204.17.5.192 255.255.255.224 host address range 193 to 222
204.17.5.224 255.255.255.224 host address range 225 to 254

Note: There are two ways to denote these masks. First, since you use three bits more than the
"natural" Class C mask, you can denote these addresses as having a 3-bit subnet mask. Or,
secondly, the mask of 255.255.255.224 can also be denoted as /27 as there are 27 bits that are
set in the mask. This second method is used with CIDR. With this method, one of these
networks can be described with the notation prefix/length. For example, 204.17.5.32/27
denotes the network 204.17.5.32 255.255.255.224. When appropriate, the prefix/length
notation is used to denote the mask throughout the rest of this document.

The network subnetting scheme in this section allows for eight subnets, and the network
might appear as:

Figure 2

Notice that each of the routers in Figure 2 is attached to four subnetworks, one subnetwork is
common to both routers. Also, each router has an IP address for each subnetwork to which it
is attached. Each subnetwork could potentially support up to 30 host addresses.

This brings up an interesting point. The more host bits you use for a subnet mask, the more
subnets you have available. However, the more subnets available, the less host addresses
available per subnet. For example, a Class C network of 204.17.5.0 and a mask of
255.255.255.224 (/27) allows you to have eight subnets, each with 32 host addresses (30 of
which could be assigned to devices). If you use a mask of 255.255.255.240 (/28), the break
down is:

204.17.5.0 - 11001100.00010001.00000101.00000000
255.255.255.240 - 11111111.11111111.11111111.11110000
--------------------------|sub |---

Since you now have four bits to make subnets with, you only have four bits left for host
addresses. So in this case you can have up to 16 subnets, each of which can have up to 16
host addresses (14 of which can be assigned to devices).

Take a look at how a Class B network might be subnetted. If you have network 172.16.0.0
,then you know that its natural mask is 255.255.0.0 or 172.16.0.0/16. Extending the mask to
anything beyond 255.255.0.0 means you are subnetting. You can quickly see that you have
the ability to create a lot more subnets than with the Class C network. If you use a mask of
255.255.248.0 (/21), how many subnets and hosts per subnet does this allow for?

172.16.0.0 - 10101100.00010000.00000000.00000000
255.255.248.0 - 11111111.11111111.11111000.00000000
-----------------| sub |-----------

You use five bits from the original host bits for subnets. This allows you to have 32 subnets
(25). After using the five bits for subnetting, you are left with 11 bits for host addresses. This
allows each subnet so have 2048 host addresses (211), 2046 of which could be assigned to
devices.

Note: In the past, there were limitations to the use of a subnet 0 (all subnet bits are set to
zero) and all ones subnet (all subnet bits set to one). Some devices would not allow the use of
these subnets. Cisco Systems devices allow the use of these subnets when the ip subnet zero
command is configured.

Examples
Sample Exercise 1

Now that you have an understanding of subnetting, put this knowledge to use. In this
example, you are given two address / mask combinations, written with the prefix/length
notation, which have been assigned to two devices. Your task is to determine if these devices
are on the same subnet or different subnets. You can use the address and mask of each device
in order to determine to which subnet each address belongs.

DeviceA: 172.16.17.30/20
DeviceB: 172.16.28.15/20

Determine the Subnet for DeviceA:

172.16.17.30 - 10101100.00010000.00010001.00011110
255.255.240.0 - 11111111.11111111.11110000.00000000
-----------------| sub|------------
subnet = 10101100.00010000.00010000.00000000 = 172.16.16.0

Looking at the address bits that have a corresponding mask bit set to one, and setting all the
other address bits to zero (this is equivalent to performing a logical "AND" between the mask
and address), shows you to which subnet this address belongs. In this case, DeviceA belongs
to subnet 172.16.16.0.

Determine the Subnet for DeviceB:

172.16.28.15 - 10101100.00010000.00011100.00001111
255.255.240.0 - 11111111.11111111.11110000.00000000
-----------------| sub|------------
subnet = 10101100.00010000.00010000.00000000 = 172.16.16.0

From these determinations, DeviceA and DeviceB have addresses that are part of the same
subnet.

Sample Exercise 2

Given the Class C network of 204.15.5.0/24, subnet the network in order to create the
network in Figure 3 with the host requirements shown.

Figure 3

Looking at the network shown in Figure 3, you can see that you are required to create five
subnets. The largest subnet must support 28 host addresses. Is this possible with a Class C
network? and if so, then how?

You can start by looking at the subnet requirement. In order to create the five needed subnets
you would need to use three bits from the Class C host bits. Two bits would only allow you
four subnets (22).

Since you need three subnet bits, that leaves you with five bits for the host portion of the
address. How many hosts does this support? 25 = 32 (30 usable). This meets the requirement.

Therefore you have determined that it is possible to create this network with a Class C
network. An example of how you might assign the subnetworks is:

netA: 204.15.5.0/27 host address range 1 to 30


netB: 204.15.5.32/27 host address range 33 to 62
netC: 204.15.5.64/27 host address range 65 to 94
netD: 204.15.5.96/27 host address range 97 to 126
netE: 204.15.5.128/27 host address range 129 to 158

VLSM Example
In all of the previous examples of subnetting, notice that the same subnet mask was applied
for all the subnets. This means that each subnet has the same number of available host
addresses. You can need this in some cases, but, in most cases, having the same subnet mask
for all subnets ends up wasting address space. For example, in the Sample Exercise 2 section,
a class C network was split into eight equal-size subnets; however, each subnet did not utilize
all available host addresses, which results in wasted address space. Figure 4 illustrates this
wasted address space.

Figure 4

Figure 4 illustrates that of the subnets that are being used, NetA, NetC, and NetD have a lot
of unused host address space. It is possible that this was a deliberate design accounting for
future growth, but in many cases this is just wasted address space due to the fact that the
same subnet mask is used for all the subnets.

Variable Length Subnet Masks (VLSM) allows you to use different masks for each subnet,
thereby using address space efficiently.
VLSM Example

Given the same network and requirements as in Sample Exercise 2 develop a subnetting
scheme with the use of VLSM, given:

netA: must support 14 hosts


netB: must support 28 hosts
netC: must support 2 hosts
netD: must support 7 hosts
netE: must support 28 host

Determine what mask allows the required number of hosts.

netA: requires a /28 (255.255.255.240) mask to support 14 hosts


netB: requires a /27 (255.255.255.224) mask to support 28 hosts
netC: requires a /30 (255.255.255.252) mask to support 2 hosts
netD*: requires a /28 (255.255.255.240) mask to support 7 hosts
netE: requires a /27 (255.255.255.224) mask to support 28 hosts

* a /29 (255.255.255.248) would only allow 6 usable host addresses


therefore netD requires a /28 mask.

The easiest way to assign the subnets is to assign the largest first. For example, you can
assign in this manner:

netB: 204.15.5.0/27 host address range 1 to 30


netE: 204.15.5.32/27 host address range 33 to 62
netA: 204.15.5.64/28 host address range 65 to 78
netD: 204.15.5.80/28 host address range 81 to 94
netC: 204.15.5.96/30 host address range 97 to 98

This can be graphically represented as shown in Figure 5:

Figure 5
Figure 5 illustrates how using VLSM helped save more than half of the address space.

CIDR
Classless Interdomain Routing (CIDR) was introduced in order to improve both address
space utilization and routing scalability in the Internet. It was needed because of the rapid
growth of the Internet and growth of the IP routing tables held in the Internet routers.

CIDR moves way from the traditional IP classes (Class A, Class B, Class C, and so on). In
CIDR , an IP network is represented by a prefix, which is an IP address and some indication
of the length of the mask. Length means the number of left-most contiguous mask bits that
are set to one. So network 172.16.0.0 255.255.0.0 can be represented as 172.16.0.0/16. CIDR
also depicts a more hierarchical Internet architecture, where each domain takes its IP
addresses from a higher level. This allows for the summarization of the domains to be done at
the higher level. For example, if an ISP owns network 172.16.0.0/16, then the ISP can offer
172.16.1.0/24, 172.16.2.0/24, and so on to customers. Yet, when advertising to other
providers, the ISP only needs to advertise 172.16.0.0/16.

For more information on CIDR, see RFC 1518 and RFC 1519 .

Appendix
Sample Config

Routers A and B are connected via serial interface.


Router A

hostname routera
!
ip routing
!
int e 0
ip address 172.16.50.1 255.255.255.0
!(subnet 50)
int e 1 ip address 172.16.55.1 255.255.255.0
!(subnet 55)
int s 0 ip address 172.16.60.1 255.255.255.0
!(subnet 60) int s 0
ip address 172.16.65.1 255.255.255.0 (subnet 65)
!S 0 connects to router B
router rip
network 172.16.0.0

Router B

hostname routerb
!
ip routing
!
int e 0
ip address 192.1.10.200 255.255.255.240
!(subnet 192)
int e 1
ip address 192.1.10.66 255.255.255.240
!(subnet 64)
int s 0
ip address 172.16.65.2 (same subnet as router A's s 0)
!Int s 0 connects to router A
router rip
network 192.1.10.0
network 172.16.0.0

Host/Subnet Quantities Table


Class B Effective Effective
# bits Mask Subnets Hosts
------- --------------- --------- ---------
1 255.255.128.0 2 32766
2 255.255.192.0 4 16382
3 255.255.224.0 8 8190
4 255.255.240.0 16 4094
5 255.255.248.0 32 2046
6 255.255.252.0 64 1022
7 255.255.254.0 128 510
8 255.255.255.0 256 254
9 255.255.255.128 512 126
10 255.255.255.192 1024 62
11 255.255.255.224 2048 30
12 255.255.255.240 4096 14
13 255.255.255.248 8192 6
14 255.255.255.252 16384 2

Class C Effective Effective


# bits Mask Subnets Hosts
------- --------------- --------- ---------
1 255.255.255.128 2 126
2 255.255.255.192 4 62
3 255.255.255.224 8 30
4 255.255.255.240 16 14
5 255.255.255.248 32 6
6 255.255.255.252 64 2

*Subnet all zeroes and all ones included. These


might not be supported on some legacy systems.
*Host all zeroes and all ones excluded.

Ultimate Subnet Cheat Sheet and


Subnetting Tutorial Guide
March 26, 2020

Subnetting can seem complicated, but with this subnet cheat sheet you should be well on your
way to creating and managing subnets with ease. The subnetting tutorial below contains key
tips for the process. After outlining what IP addresses are and how they work, we’ll take a
look at what subnetting is. I’ll cover key components and processes such as subnet classes
and subnet masking and organizing and managing subnets. All of the concepts in this
subnetting guide are broken down into small parts, to make this topic as digestible as
possible.

Table of Contents:

What Are Subnets Used For?


What Is an IP Address?
What Is an IP Class?
Subnet Mask Cheat Sheet: What Is Subnet Masking?
Using Subnets to Organize and Optimize Your Network
Subnetting Tutorial: Commonly Asked Questions
How Can Subnetting Be Managed More Easily?
Best Subnetting Tool

What Are Subnets Used for?


Subnets offer a way of organizing your network to help to reduce network congestion. When
you have a lot of traffic flowing between particular parts of your network, it can help to group
those parts in a single section, so the traffic doesn’t have to travel across the entire network to
get from place to place. Separating out small parts of your network into subnets allows traffic
to flow more quickly and to avoid taking unnecessary routes, adding traffic where it isn’t
needed.

In addition, subnetting helps in efficiently allocating IP addresses and prevents large numbers
of IP addresses from going unused. Subnets are usually set up geographically for particular
offices, or for particular teams within a business to allow their network traffic to stay within
the location.

What Is an IP Address?
Before we can start to understand how subnets work and how to manage them, it’s important
to have a strong grasp on how IP addresses work. An IP address is essentially an identifier for
any device connected to a network. There are two kinds of IP address: IPv4 (version 4) and
IPv6 (version 6). An example of an IPv4 address is:

216.27.61.137

An IPv4 address uses 32 binary bits to express the identifier of the device. To make the
binary bits expression easier to understand, the 32 bits are split into four groups of eight, and
then each group is turned into a decimal number. These four groups are separated by a dot, as
you can see in the example above.

IPv6 addresses are made up of 128 binary bits. These bits are separated into eight groups, and
each group is separated by a colon. An example of an IPv6 address is:
                2001:cdba:0000:0000:0000:0000:3257:9652 

In normal use, the groups consisting entirely of the number zero are removed and replaced by
a colon to shorten the IP address for ease of use.

IPv6 was created because 232 combinations were possible in IPv4, allowing up to 4.3 billion
unique IP addresses. As the internet and number of devices grew, new combinations of
numbers became necessary. IPv6 allows up to 2,128 combinations, which has expanded the
number of possible unique IP addresses significantly.

IP addresses can be shared with one other device, multicast to multiple other devices, or
broadcast to everyone—in other words, public. IP addresses can also be dynamic or static. A
static IP address means a particular device has an IP address assigned to it, which doesn’t
change. A dynamic IP address means when a device joins a network it’s assigned an available
IP address, which could change each time the device connects.

Back to top

What Is an IP Class?
Now that we’ve looked at what an IP address is, the next thing to consider is IP classes, as
these are essential for understanding how subnets work.

Say you’re trying to find one particular IP address, or organize IP addresses on your network.
This would be an impossible task without some kind of system. IP addresses are divided into
numerical sections to help you find what you’re looking for more quickly. These sections are
called classes. IP addresses are divided into three classes: A, B, and C.

 Class A: IP addresses are those between 0.0.0.0 and 127.255.255.255.


 Class B: IP addresses are those between 128.0.0.0 and 191.255.255.255.
 Class C: IP addresses are those between 192.0.0.0 and 223.255.255.255.

If you’re trying to determine the class of an IP address, you need to look at the first number.
If the first number is 1 through 127, it’ll be a class A address. If the first number is 128
through 191, it’s a class B address. Finally, if it’s 192 through 223, it’s a class C address.

Depending on the IP address class, different portions of the IP address are used to designate
the network and the host. For example, class A only uses 8 bits of the IP address for the
network, leaving 24 for the host. So, using the example 126.27.61.137, the network IP
address would be 126.0.0.0 and the host address would be 0.27.61.137.

For a class C address, 24 bits are used for the network, and eight remain for the host. Using
200.23.65.1 as an example, this would result in 200.23.65.0 for the network and 0.0.0.10 for
the host.

For networks such as a TCP/IP network to function, the routers passing information
throughout the network don’t need to know the exact host address. They only need to know
the network portion of the IP address; then, once the packet is delivered to the host’s network,
it can get to the right host.
Subnet Mask Cheat Sheet: What Is Subnet Masking?
Each IP address class has a matching “subnet mask,” which is an easy way of identifying
which part of the IP address relates to the network and which part relates to the host. This is
essential to ensure packets traveling through the network get to the right place.

The default matching subnet masks for each subnet class are as follows:

 Class A:0.0.0
 Class B:255.0.0
 Class C:255.255.0

When we look at the subnet masks and convert the decimal numbers back into binary, we can
see which bits of the IP address are allocated to the network and which are allocated to the
host.

In binary, 255 is 11111111, and 0 is 0. So a subnet mask of 255.255.255.0 would be


converted to:

                11111111.11111111.11111111.0000000

When you match this with an IP address, such as 192.168.123.132, you can determine the
network portion and the host portion of the IP address. Each “1” in the subnet mask exists for
the bit portions of the IP address allocated to the network, and each “0” exists for when a bit
portion is allocated to the host. Here is an example:

11111111.11111111.11111111.0000000 (subnet mask)

11000000.10101000.01111011.10000100 (IP address 192.168.123.132 in binary)

This means the network portion of the subnet is 192.168.123, and the .132 is allocated to the
host. When information arrives on the 192.168.123.0 network, it’ll be processed as part of the
network and then delivered to the 0.0.0.132 host.

Back to top

Using Subnets to Organize and Optimize Your Network


Essentially, a subnet is a smaller portion of the network within class A, B, or C. Creating and
using subnets can help to keep your network organized and functional.

Let’s suppose a business wants to use four different IP address blocks for the different
segments of its network, with 50 hosts per segment. The business uses the following IP
address blocks:

200.1.0.0

200.1.1.0
200.1.2.0

200.1.3.0

Each IP address block can create 254 IP addresses, which allows 254 x 4 total IP addresses to
be created for use in the network. This amounts to 1,016 IP addresses. But the business only
wants 50 hosts on each block, so it’ll have 816 IP addresses that don’t get used at all. This is
a waste of IP addresses that could be used by other devices. Subnetting is a way to divide an
IP address block into smaller portions, so fewer IP addresses are wasted.

We know for the first IP address, 200.1.0.0, 200.1.0 is the network portion, and .0 is the host
portion. The full IP address in the 32 binary bits would look like:

11001000.00000001.00000000.00000000

But we know we don’t need all 254 hosts created by this IP address block, so we can borrow
some of the host “bits” to create a new “subnetwork,” or subnet.

Using the 11001000.00000001.00000000.00000000 example, we would borrow one “bit”


from the host portion to create a subnet.

So:

                11001000.00000001.00000000.00000000

  would become:

11001000.00000001.00000000.10000000

  As a result, the new decimal IP address would become:

200.1.0.128

Borrowing this one bit from the host portion of the IP address still leaves seven bits in the
host portion. Seven bits in the host portion allow 128 IP addresses to be created, which is still
more than enough for the business’s needs. If we follow through the process and borrow
another bit from the host portion of the IP address, four subnets can be created:

11001000.00000001.00000000.00000000                   200.1.0.0

11001000.00000001.00000000.01000000                   200.1.0.64

11001000.00000001.00000000.10000000                   200.1.0.128

11001000.00000001.00000000.11000000                   200.1.0.192

These four subnets allow 64 IP addresses to be created, and there’s far less wastage than in
the example above.
There are two hosts reserved for the IP addresses needed for the network identity itself (the
first IP) and the broadcast address (the last IP). So for each IP address block, only 12 IP
addresses are wasted.

This is where subnet masks come back in. If you’ve “borrowed” bits from the host portion of
the IP address, it can be hard to tell where the network portion ends and the host portion
begins. With a subnet mask, you can specify which portions of the subnet are the network and
which portions are the host.

For example, for the IP address 200.1.0.64 created above, the subnet mask would be:

11111111.11111111.11111111.1100000 (subnet mask 255.255.255.192) 

11001000.00000001.00000000.01000000 (IP address 200.1.0.64 in binary)

The “11” at the beginning of the final portion of the subnet mask, resulting in the “192”
portion, shows the first two bits of the host portion of the IP address belong to the subnet,
instead of the host.

Back to top

Subnetting Tutorial: Commonly Asked Questions


Building on this understanding of subnets and how they work, the following subnetting cheat
sheet will address how to navigate, understand, and manage them.

How Many Hosts Can You Have in Your Subnet?

Determining how many hosts you can have in your subnet is important, as you don’t want to
end up with a subnet too small to host all the IP addresses you need, or one too large and
resulting in a lot of wastage.

You can figure out how many hosts you can have in your subnet by subtracting the number of
network bits from the number of total bits: in other words, 32 total bits, minus the number of
network bits. Let’s use 26 as an example.

A subnet with 26 network bits has six bits available for the host IP addresses. You then also
need to subtract 2 IP addresses for the network IP itself and the broadcast address.

So, the formula is as follows:

2^32-26 – 2 = 2^6 – 2 = 62

You can use this with any number of network bits to determine how many bits you have
available to create hosts for your subnet. 

How Do You Know What Subnet an Address Is On? 

You also might want to quickly determine the subnet a given IP address is a part of.
Let’s look at the IP address 156.67.154.75/28. First, you need to determine how many of the
bits are allocated to the network and how many to the host. We already know, in this IP
address, 28 are used for the network and four are for the host.

Then, you need to determine how big the subnet is, by taking the number of bits allocated to
the host, and raising 2two to the power of that number. In the above example this is 2^4, or
16. This is called the “block size,” because it refers to the size of the subnet blocks into which
the network has been divided. You can use this block size to count up from zero to determine
which subnet block the IP address belongs to.

For 156.67.154.75, you would start at 156.67.154.0 and go up by 16 at a time, as follows:

156.67.154.0/28

156.67.154.16/28

156.67.154.32/28

156.67.154.48/28

  When counting further up, you can see 156.67.154.75 falls in between the two subnet
blocks:

156.67.154.64/28

156.67.154.80/28

  This means the 156.67.154.75 IP address is in the subnet beginning with 156.67.154.64,
because .80 would be too high.

This can take a bit of practice. Just remember to first determine the number of bits in the IP
address allocated to the hosts, then take the number two and raise it by the number of bits
allocated to hosts. Whatever number you get is the block size, and you can then count up
within the IP address by the block size, until you find two blocks the IP address falls
between. The IP address is in the lower subnet of those two blocks.

How Do You Determine Whether Two Addresses Are in the Same Subnet? 

You may want to figure out whether two addresses are in the same subnet. The first step in
doing so entails determining the size of the subnet block. Then, you calculate the valid host
range to see if the second address falls within the same range.

Here’s an example of this process, using the following two IP addresses:

10.21.45.137/13

10.23.156.198/13

You can see the number of network bits is 13, which means the subnet must be set up in the
second octet, or the second part of the IP address.
So, we can begin with the IP address 10.0.0.0/13.

We can also determine the subnet block size, by taking the number of bits allocated to the
host and raising two to the power of that number. So, with a maximum of 16 bits in the first
two octets, the subnet block size is 2^(16-13) = 8.

You can then work through the subnet blocks, increasing by eight at a time:

10.0.0.0/13

10.8.0.0/13

10.16.0.0/13

10.24.0.0/13

Since 10.21.45.137/13 and 10.23.156.198/13 are both between 10.16.0.0/13 and 10.24.0.0/13,
they are both on the same subnet.

Back to top

How Can Subnetting Be Managed More Easily?


One way to simplify the process of managing your subnets is by using a tool. My
recommendation is SolarWinds® IP Address Manager (IPAM), which has several features to
automate and streamline this process.
IPAM includes an automated subnet discovery wizard allowing you to discover and collect
information on all of your subnets, showing you which IP addresses are part of each one. If
you have all of your subnet and IP address information in spreadsheets, IPAM can easily
import these.

It also includes a subnet allocation wizard, which looks at the traffic and size of your
network, and then optimizes your IP addresses into subnets suiting your needs. The interface
allows you to group and organize your subnets and IP addresses in a way that makes it easy
to find the information you need.

For creating subnets, IPAM gives you the ability to simply select a network, group, or
supernet you want to subnet. Through an easy-to-use interface, you can choose to name the
subnet, give it an address, and give it custom properties if you want. This simplifies the
subnetting creation process and helps you to customize and organize your subnets from the
outset.

SolarWinds IPAM includes a dashboard showing you the scope of your IP subnet and its
utilization and can create alerts to let you know when a subnet is getting full or when you
have a subnet with a huge amount of unused space. Using the IP address view, network view,
or chart view, you can gain different perspectives on how your network is functioning and
how your IP addresses are allocated. This can help you to optimize your subnets and reduce
IP address wastage.

Best Subnetting Tool


I hope my IP subnet cheat sheet has given you a greater understanding of subnetting. This
subnetting guide has covered how subnets work, the core concepts behind them, and the
basics of subnetting. It has also answered some key questions about issues with subnets and
looked at how tools can help you to manage your subnets more easily. My recommended tool
for this purpose is SolarWinds IP Address Manager, a robust software enabling you to
allocate IP addresses into subnets, and monitor and manage them, with efficiency. A 30-day
free trial lets you try the fully functional program without risk.

How to Calculate Subnets With Microsoft


Excel
 Small Business

 Accounting & Bookkeeping

 Excel

By Ryan Menezes






Related

 How to Use Windows 7 to Transcribe Audio


 How to Address WAN Connections Between Routers
 How to Insert Microsoft SQL
 How to Install a Linksys Router With a Bridged Modem & Static IP
 How to Populate a Website From an Excel Database

IP addresses on your company network consist of three parts: the network address, the host
address and the subnet mask. The network address identifies your broad network, and host
addresses identify individual workstations on the network. The subnet mask relates these two
addresses using bitwise operations. System administrators at your company can use Microsoft
Excel's Visual Basic editor to calculate subnetworks, generating host addresses by combining
network addresses and subnet masks.

Open Excel and type your host address into cells A1 through A4, typing each byte into a
separate cell. For example, to calculate the network address when a subnet address of
255.255.255.224 masks a host address of 192.168.1.161, type "192" into cell A1, "168" into
A2, "1" into A3 and "161" into A4.

2
Type your subnet mask into cells B1 through B4, tying each byte into a separate cell.
Continuing the example, type "255" into cell B1, "255" into B2, "255" into B3 and "224" into
B4.

Click "Insert" in the ribbon's developer tab and click the icon for a button. Click and drag
over your worksheet to add a button and open the Assign Macro dialog box.

Click "Tools" and "Macros" to open the Create New Macro dialog box. Type "mcrSubnet"
into the Macro Name text box and then click "Create."

Type "mcrSubnet" into the Macro Name text field and then click "New" to launch Excel's
Visual Basic editor.

Type the following after "Sub mcrSubnet()" to fetch the values in cells A1 and B1:

host1 = Range("A1").Value subnet1 = Range("A2").Value

Type the following to perform an AND function on the two values:

network1 = host1 And subnet1

Type the following to insert the result into the sheet:

Range("A3").Value = network1

Type the following to repeat this operation with the addresses' other bytes:

host2 = Range("B1").Value subnet2 = Range("B2").Value network2 = host2 And subnet2


Range("B3").Value = network2 host3 = Range("C1").Value subnet3 = Range("C2").Value
network3 = host3 And subnet3 Range("C3").Value = network3 host4 = Range("D1").Value
subnet4 = Range("D2").Value network4 = host4 And subnet4 Range("D3").Value =
network4

10
Return to the main Excel window and click the button that you added to insert the network
address into cells C1 through C4. With this example, Excel inserts "191" into A3, "168" into
B3, "1" into C3 and "160" into D3. This corresponds with a network address of
"191.168.1.160."

Das könnte Ihnen auch gefallen