# [Translation] IP subnet division

Source: Internet
Author: User

Original article title: IP subnetting made easy

IP network engineers need to have a solid understanding of how IP subnet division works. however, this topic is often ignored by instructors and the students are very confused and nervous about it. george ou developed a simple, graphical method to explain IP subnet division in a simple and easy-to-understand manner.

IP subnet division is a basic topic that IP network engineers need to understand, but in practice, it is difficult for students to master it. for many years, I have seen the struggle of students in school to practice and process subnet division, because no one has ever explained it to them in a way that is easy to learn. I used my graphical method to help countless students learn what subnet division is. Now I have summarized all my experiences in this article.

====================

Although IP supports the Internet protocol, it is actually a huge Internet communication protocol that is applicable to a small private network and a large world. an IP address is a unique identifier of a single device on an IP network. the IP address consists of 32 binary digits ranging from 0 to 4294967295. this means that theoretically the Internet can contain approximately 4.3 billion unique objects. however, in order to make such a large block easier to process, it is divided into four groups of 8 binary digits, or "Eight-bit group", which is used in the middle ". "To separate. 32 binary digits are hard to read. Instead, we divide them into four groups of numbers smaller than 256. an octal group consists of numbers ranging from 0 to 255. the following figures show how IP addresses grow.

0.0.0.0
0.0.0.1
... Increment 252 hosts...
0.0.0.254
0.0.0.255
0.0.1.0
0.0.1.1
... Increment 252 hosts...
0.0.1.254
0.0.1.255
0.0.2.0
0.0.2.1
... Increment 4 + billion hosts...
255.255.255.255

The subnet has a starting and ending number. The starting number is always an even number, and the ending number is always an odd number. the START number is "network ID", and the end number is "broadcast ID ". you cannot use these numbers because they both have special meanings that are created for special purposes. the network ID is the official address of a subnet. the broadcast ID is the broadcast address listened to by all devices on the subnet. whenever you want to reference a subnet, you can set the network ID and Its subnet mask. The subnet mask defines the size of the subnet. whenever you want to send data to all devices in the subnet, you can send your data to the specified broadcast ID. later, I will show you the mathematical and graphical methods for determining the network ID and broadcast ID.

Graphical subnet ruler

================

For many years, I have found that people have a headache in IP subnet division. I want a better way to teach this problem. I soon realized that many IT staff lacked the necessary mathematical background knowledge and had difficulty understanding the concept of binary numbers. to make up for this deficiency, I have shownChartTo illustrate the problem of subnet division. in this example, we observe the IP address range from 10.0.0.0 to 10.0.32.0. note that the ending IP address 10.0.32.0 is actually the starting address of the next subnet. here the network range ends in the previous one, that is, 10.0.31.255.

Chart

Note that the number of hosts doubles as the subnet size increases by one binary bit. the smallest step represents eight binary bits. The eight binary bits contain a subnet of 256 hosts. However, because you cannot use the first or last IP addresses, in fact, there are only 254 available hosts on the network. the easiest way to calculate the number of available hosts in a sub-network is to calculate 2.Number of binary digitsPower, and then 2. for example, if there are nine binary digits, We have 510 available hosts, because the 9 power of 2 is 512, but we need to remove the beginning and end. until 13 binary digits, We have 8190 available hosts on the entire ruler. (224d = 11100000b) (201710000224.0 = 11111111.111111.111160.00000000, of which 13 are 0)

Learn to divide subnets appropriately

======================

Subnets can be divided into smaller subnets, or even further smaller subnets. the most important thing about dividing subnets is that you cannot randomly select the start and end points. this Division must conform to the clean binary division. the best way to learn this is to look at my subnet ruler and see what a valid subnet looks like. inChart BThe green subnet is valid, and the red subnet is invalid.

Chart B

The structure of this ruler is similar to that of other rulers. We split it into two parts in the middle. then, we split the remaining parts, and then we continued a new round of this bipartite. in the above example, we have five rounds of binary. if you take a closer look at each green (valid) subnet block, you will notice that all the scales contained in the subnet are no larger than the scales on the edge. here is a mathematical reason. We will explain it later, but this graphic explanation makes it easier to understand the mathematical explanation later.

====================

The subnet mask plays a key role in defining the subnet size.Chart C. Pay attention to the mode. Pay special attention to the red numbers. at any time, when you are processing subnets, this table will come in handy sooner or later to help you recall eight special numbers used to process subnet masks. they are:255,254,252,248,240,224,192, And128. You will see these numbers again and again on the IP network. Remember that they will make your life easier.

Chart C

I have three types of dimensions. you will see the first two categories. The host length is usually from 0 to 16 binary digits. it is very common for DSL and T1 IP segments in the range of 0 to 8 binary. A private network typically works in the range of 8 to 24 binary bits.

Note how the number of zeros in the binary mask increases from right to left. in binary mode, the subnet mask is 1 on the left and 0 on the right. the number of zeros is the same as the length of the subnet. I only demonstrated the interesting part of the binary subnet mask in the eight-bit group, because all the eight-bit groups on the right are composed of 0, and the left is composed of 1. therefore, if we look at the subnet mask with 11 binary digits in length, the Complete Binary subnet mask is 11111111.111111111000.00000000. this binary subnet mask is converted to the 256 mode, and is directly converted to 255.255.248.0.

====================

The subnet mask not only determines the subnet size, but also helps you precisely locate the subnet end point without any IP addresses of a subnet. the reason it is named subnet "Mask" is that it literally masks the binary bit of the host, leaving only the subnet for the starting address, that is, the network ID. once you know how a subnet starts and how large the subnet is, you can determine the subnet endpoint, which is the broadcast ID.

To calculate the network ID, you only need to calculate the IP address and subnet mask in the subnet. let's use an IP address 10.20.237.15 and a subnet mask of 255.255.248.0 as an example. note that this can also be abbreviated10.20.237.15/21,BecauseSubnet Mask LengthIs 21 (21 in 255.255.248 ).Chart DAndChart EDisplays the decimal and binary versions of operations.

Chart D

Decimal version

Chart E

The binary version shows how so many zeros are used as masks to mask the top IP addresses. in the masking box, 0 changes all the numbers at the top to 0, No matter what number it is. if you convert the result back to decimal, you will get10.20.232.0This network ID.

During the course of teaching the subnet division, I always felt uncomfortable: the students did not have access to simple methods to bypass and perform binary conversions during operations. I even saw it workers in related fields use this slow and troublesome method to convert to binary values, and then perform and computation. After calculation, the Windows Calculator is used to convert back to decimal. in fact, there is indeed a simple shortcut to use the Windows Calculator, because operations can work directly in decimal format. press "237", Press "and" 248 ", and then type" 232. I don't understand why I don't explain this to students, because using a calculator makes the computing mask much easier.

Because the subnet mask has 11 zeros, The subnet is the length of 11 binary. This means that there can be a maximum of 2 ^ 11, that is, 2048 hosts in the subnet, And the last IP address of the subnet is10.20.239.255. You just need to glance at the Three Zeros In the third octal group, and you can quickly calculate this conclusion. This means that the IP addresses in the third octal group can be 2 ^ 3, 8 changes. therefore, the starting position of the next subnet is 10.20.0000+ 8.0, that is, 10.20.240.0. if we reduce it by 1, we get 10.20.239.255, which is the end point of the current subnet. to make you feel this visually, please refer to my subnet ruler.

Chart F

Introduction to IP types

==================

To classify IP subnets, the Internet creators choose to divide the Internet into several categories. note that this classification is not as important as subnet computing. It only shows how the Internet is opened. the Internet is divided into five categories: A, B, C, D, and E. class A accounts for half of the Internet, Class B accounts for half of the remaining half, Class C accounts for half of Class B, and Class D (Multi-broadcast) take half of the remaining half, and the rest is Class E. my students told me that they have been plagued by memory IP classification until they seeChart G.This is because you actually don't need to remember anything. You just need to learn how to use half of the available range to build a ruler.

Chart G

Remember, all subnets start from an even number and all subnet endpoints are odd. note that 0.0.0.0 to 0.255.255.255 (0.0.0.0/8) is not used, and 127.0.0.0 to 127.255.255.255 (127.0.0.0/8) is used for loop address.

127.0.0.0/8 is interpreted as: the network ID is 127.0.0.0, The subnet mask is eight 1 on the left, and a bunch of 0 subnets on the right

The values of the first octal group of all Class A addresses are between 1 and 126, Because 127 is reserved as a loop address. a subnet is 24 bits long, meaning that the subnet mask is only 8 binary bits long. for example, GE owns the 3.0.0.0/8 subnet (that is, the network ID of 3.0.0.0, 11111111.0.0.0 is a subnet mask). Because GE is lucky enough, it has long been assigned 16.8 million addresses. u. s. the army owns 6.0.0.0/8. level 3 communications have 8.0.0.0/8. IBM has 9.0.0.0/8. at&t owns 12.0.0.0/8. xerox has 13.0.0.0/8. HP has 15.0.0.0/8 and 16.0.0.0/8. apple has 17.0.0.0/8.

The value of the first octal group of all Class B addresses ranges from 128 to 191. A Class B subnet is 16 bits long, meaning that the subnet mask is 16 bits long. for example, BBN communications have 128.1.0.0/16, that is, 128.1.0.0 to 128.1.255.255. carnegie Mellon University owns 128.2.0.0/16.

The first eight-digit iweizude value of all Class C addresses ranges from 192 to 233. the Class C subnet is 8 bits long, so the subnet mask is only 24 bits long. note that Arin (the organization responsible for managing Inernet addresses) only sells four class C addresses to a separate company, and the company must prove that it actually needs 1024 public IP addresses. if you need to run BGP to use multiple ISPs for redundancy, you have to own your own IP address block. it should also be noted that, not in the early years, Class A addresses of 16.8 million hosts in the early years should be allocated at no cost. now you need to pay an annual fee for a subnet IP block with 1024 IP addresses (the subnet mask is 255.255.252.0, of which 22 are 1.

The concept of subnet category can cause problems in actual operations. I have seen people forget how to turn the classification off from the old Cisco router, and when a write router is added in, vrouters with huge subnets configured as dynamic routing are hijacked. this is because the Cisco router assumes that the subnet mask is full/8 or/16 or/24, even if you define a value within these ranges. all new Cisco IOS software versions disable the concept of subnet classification and use the default classless routing mode. this is done through the default "IP No category" command.

============================

The following IP addresses are all assigned to the private network.

• 10.0.0.0/8 (10.0.0.0 to 10.255.255.255)
• 172.16.0.0/12 (172.16.0.0 to 172.31.255.255)
• 192.168.0.0/16 (192.168.0.0 to 192.168.255.255)
• 169.254.0.0/16 (169.254.0.0 to 169.254.255.255 )*

* Note that 169.254.0.0/16 is a private IP address block. When the DHCP server is unavailable, it is used as an automatically assigned IP address.

Under normal conditions, 10.0.0.0/8 is used on a large network, because approximately 16.8 million IP addresses in this block are available. they can be divided into many smaller subnet groups for networks in different geographical locations. These groups can be further divided into smaller subnets. a smaller company typically uses the 172.16.0.0/12 range as its own private IP address, and then divides it into smaller subnets, although there is no reason not to allow them to use 10.0.0.0/8, if they want to use it, they can still. the home network generally uses a subnet mask of 24 1 subnets within 192.168.0.0/16.

Related Keywords:

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.