IP Subnet Partitioning

Source: Internet
Author: User

IP Sub-network Division

n IP address and subnet mask

The IP address is made up of 32-bit binary numbers, which are generally expressed in dotted decimal notation.

1. Classification of IP addresses

The IP address consists of two parts: the network section (NetID) and the host part (HostID). The network section is used to identify different networks, and the host part is used to identify specific hosts in a network. The network portion of the IP address is distributed uniformly by the IANA (Internet Assigned number authority,internet address assignment authority) to guarantee the uniqueness of the IP address. In order to facilitate distribution and management, IANA divides IP address into a, B, C, D, e a total of five classes, according to the binary representation method, based on the IP address of the first few bits, you can determine the IP address belongs to which class. Currently the most used IP address on the internet is a, B, C of these three categories, IANA according to the specific needs of organizations or organizations assigned to a, B, C network address, the specific host IP address by a network address of the agency or organization decide how to allocate.

The network and host parts of each category have rules, and classes D and e do not divide the network part and the host part.

1) class A address

In the Class A address, the first eight-bit group is the network part, the remaining three eight-bit group is the host part, namely: Class A address = Net + Master + Master + master.

The first few bits of the IP address are referred to as the boot bit, and the 1th bit of a eight-bit group is 0 for a-class address. So it's the first eight-bit group range is 00000000-01111111, converted to decimal is 0-127, where 127 is a more special address, we used to test the native address is 127.0.0.1.

Because the first address block of Class A addresses (network number 0) and the last Address block (network number 127) is reserved for use, that is, full 0 represents the local network, and all 1 represents reserved for diagnostic purposes. Therefore, the valid network range for Class A addresses is 1-126. There are only 126 class A networks in the world, and each class A network can have a combined number of 24 bits, 224. The host part is not all 0 or all 1, all 0 represents the network ID, all 1 represents the broadcast address of the network, so each class A network has a maximum number of hosts is 224-2 (the formula is 2n-2,n is the IP address of the host part of the number of bits). Class A addresses are intended for use in large networks.

Note:172.0.0.1 is also known as a native loopback address, and it is common to check that the TCP/IP protocol is installed correctly by using the ping address on this computer. And all the IP addresses starting with 127 represent the local machine, except for the broadcast address 127.255.255.255.

2) class B address

In the Class B address, the first two eight-bit group is the network part, the latter two eight-bit group is the host part, namely: Class B address = Net + Net + Master + Master.

The first two bits of a class B address as the boot bit must be 10, so its network portion is 10000000.00000000-10111111.11111111, where the 1th eight-bit group is converted to decimal is 128-191. The effective network range for Class B addresses is the combination of the latter 14 bits in the network section, which is 214. Each class B address has a maximum number of hosts of 216-2. Class B addresses are intended for use in medium-sized networks.

3) class C address

In class C addresses, the first three eight-bit groups are part of the network, and the last eight-bit group is the host part. That is: Class C address = Net + Net + Net + Master.

The first three bits of a class C address as the boot bit must be 110, So the scope of its network part is 11000000.00000000.00000000-11011111.11111111.11111111, where the 1th eight-bit group is converted to a decimal 192-223. The valid network range for Class C addresses is the combination of the latter 21 bits in the network section, which is 221, and the maximum number of hosts per class C address is 28-2. Class C addresses are intended for use in small and medium-sized networks where the number of hosts is relatively small.

Note: Class D addresses are addresses used for multicast communications, and E-addresses are reserved addresses for scientific research, and they cannot be used as node addresses on the Internet, and for more information please refer to the relevant information.

4) Legitimate IP addresses on the Internet

Currently on the Internet only use a, B, c these three types of addresses, and in order to meet the needs of enterprise users on the Internet, from A, B, C of the three categories of addresses to be used in the enterprise internal network, this part of the address is called a private address, Private addresses are not available on the Internet. Private addresses include the following three groups:

? 10.0.0.0-10.255.255.255

? 172.16.0.0-172.31.255.255

? 192.168.0.0-192.168.255.255

2. Subnet Mask

The communication between different hosts in the network can be divided into the following two kinds:

? Communication between two hosts in the same network segment

? Communication between two hosts in different network segments

Note: an IP address with the same network address is called an IP address for a network segment.

If the two hosts in the same network segment communicate, the host sends the data directly to another host, and if the two hosts in the same network segment are not communicating, the host sends the data to the gateway, which is then forwarded by the Gateway.

In order to differentiate between these two situations, the computer that communicates is required to obtain the network segment portion of the remote host IP address to make a judgment.

? If the source host's network address = The destination host's network address, the communication between the same network segment hosts.

? If the source host's network address ≠ the destination host's network address, it is the communication between different network segment hosts.

Therefore, the key problem for a computer is how to obtain the network address information of the remote host IP address, which requires the use of the subnet mask (Netmask).

As with the IP address, the subnet mask is also composed of 32 bits, the corresponding IP address of the network portion with 1, the corresponding IP address of the host part is represented by 0, usually also four points separated by a decimal number. When assigning IP addresses to nodes in an IP network, the subnet mask used by each node is also given. The default subnet mask is typically used for all three types of addresses, a, B, and C.

? The default subnet mask for Class A addresses is 255.0.0.0

? The default subnet mask for Class B addresses is 255.255.0.0

? The default subnet mask for Class C addresses is 255.255.255.0

With the subnet mask, as long as the IP address and subnet mask for the logical "and" operation, the result is the IP address of the network address.

The network ID can be calculated to determine whether different IP addresses are located in the same network segment.

It is cumbersome to use dotted decimal notation for mask writing, and a bit count form is often used to represent masks for easy writing. For the Count form is the address followed by "/", "/" followed by the number of bits in the network portion, that is, the number of 1 in the binary mask. For example: IP address 192.168.1.100, mask 255.255.255.0, can be represented as 192.168.1.100/24.

reasons for the partitioning of n subnets

Although the Class A, B, and C IP addresses can provide approximately 3.7 billion host addresses, the network number is not many. Previously learned IP address can provide Class A network 126, Class B network about 1600, C class network about 2 million, so with the rapid development of the Internet, access to the Internet more and more sites, resulting in fewer IP address resources, In order to make better use of the existing IP address resources and reduce waste, the IP address can be further divided into smaller networks, that is, sub-network division. In order to create subnets, the host in the mask needs to be partitioned into network bits, a process that is often called borrow or leased.

After subnetting, the subnet mask of the IP address is no longer a mask with a standard IP address, and the IP address can be divided into two classes: a class address and an no-class address.

? There are class addresses: standard IP addresses (classes A, B, c three) belong to a class address. For example: Class A address mask 8 bits, Class B address Mask 16 bits, Class C address mask 24 bits, all belong to a class address.

? No class Address: In order to use the IP address more flexibly, the IP address needs to be divided according to the need, so that the divided IP address no longer have the characteristics of the class address, these addresses are called non-class address.

Apart from having the full use of IP resources and a bit of ease of management, subnetting can provide basic security for LANs.

N class C Address Division

The number of subnets and the number of hosts after a subnet with a class address can be calculated by the following formula:

? Number of subnets =2n, where n is the subnet portion of Bits

? Host number =2n-2, where n is the host partial number of bits

/25,/26,/27,/28,/29,/30 The case of a Class C address is divided into subnets as shown in the following table:

Subnet mask network number of hosts available

/25 2 128 126

/26 4 64 62

/27 8 32 30

/28 16 16 14

/29 32 8 6

/30 64 4 2

Attention:

? In general, a mask of/31 is not used, and a mask of/32 is typically used when configuring the loopback interface address as the device management address, which saves the address.

? It is necessary to pay attention to the dividing point of network segment in subnetting.

N class B Address Division

The subnet division of A and Class B addresses is similar to the Class C address, except that the subnets are divided into eight bits at different locations.

n determine the available IP addresses

The subnet address and broadcast address calculation process is as follows:

(1) write out the subnet mask in binary form

(2) write out the IP address in binary form

(3) Determine the subnet section, draw a line between the network bit and the subnet bit, and then draw a line between the subnet bit and the host bit, and then look at the mask, where 0 represents the host bit, and 1 represents the network bit and subnet bit, so you can determine the 2nd line, the middle of the two lines is the subnet part.

(4) The binary representation of the IP address is divided into the network part, subnet part and host part, set the host bit is all 0, the address is the host address belongs to the subnet address.

(5) The host bit in the IP address is set to 1, and the address is the broadcast address of the subnet.

In fact, only need to indicate the host bit can get the subnet address and broadcast address, the host for all set to 0 is the subnet portion, all set to 1 is the broadcast address.

In practice, subnetting is often too complex, so if the subnet address or broadcast address is assigned to the host, and the subnet address or broadcast address is not a valid host address, it can cause a network failure. The method of calculating the subnet address and broadcast address above can quickly determine if this address is a valid host address, thereby troubleshooting.

N Sub-network Division example

1. "soft" rules

Planning IP addresses can follow some "soft" rules. The so-called "soft" rule, is a number of auxiliary rules, its purpose is to facilitate the unified management of network administrators. It can assist in assigning IP addresses with information such as office numbers and floor numbers.

This "soft rule" is inconclusive and should be used flexibly. Therefore, planning the completion of documentation is essential. When documenting, the department, VLAN ID, wiring rack port, switch port, and other IP addresses are mapped, and even some companies associate employee names with IP addresses. In short, no matter what correspondence is recorded, the more detailed the document is, the more effort is made to maintain it later.

2. "hard" rules

The so-called "hard" rules, that is, how to make the appropriate division method according to the actual situation.

(1) Review the network design, including the number of hosts per section, the number of devices that require an IP address, and which devices need to be configured for the connected address.

(2) Determine the number of subnets required

(3) Determine the number of IP addresses required for each subnet and the masks used

Note: since network segments need to communicate with each other, each network segment needs to use a valid host address as the gateway.

n IP address planning and application

1. Principles of IP address planning

IP address planning mainly conforms to four principles: uniqueness, extensibility, continuity, notional.

? Uniqueness: The IP address is the identity of the host and the device in the network, and an IP network cannot have two hosts with the same IP address, otherwise it will not be addressable.

? Scalability : in IP address allocation, there must be a certain amount of headroom to meet the needs of network expansion. 、

? Continuity: the allocation of successive IP addresses to facilitate management and address summarization, continuous IP address easy to route summary, reduce the path by the table, improve the efficiency of the route.

? notional: When assigning an IP address, as far as possible to make the assigned IP address has a certain practical significance, so that when the person sees the IP address can know that the IP address assigned to which department or region.

When assigning IP addresses, you need to be aware of the following points, which can save IP addresses as follows:

? When configuring a loopback address, use a subnet mask of 32

? When configuring an interconnect address, use a subnet mask of 30

? Unified settings for each business gateway, such as unifying all gateways into x.x.x.254

After the IP address planning is complete, the company can either configure a static IP address or use a DHCP server to dynamically assign an IP address.

IP Subnet Partitioning

Contact Us

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.