Summary of IP addresses and subnet masks

Source: Internet
Author: User


I. IP address and network Classification

1. IP Address
Different physical network technologies have different addressing methods. hosts in different physical networks have different physical network addresses. The inter-network technology is a high-level software technology that combines different physical network technologies. The internetcommunication technology adopts a globally common address format, which assigns an internetaddress to each network and each host across the network to shield the differences between physical network addresses.

The IP protocol provides an IP address format for the entire network. Address Allocation is performed under unified management to ensure that an IP address corresponds to an inter-network host (including a gateway ), in this way, the difference in physical addresses is blocked by the IP layer. The IP address used by the IP layer is the IP address of the inter-network. It consists of the network number and host number. All hosts in the network use the same network number, and the host number is unique.

The IP address is a 32-bit binary number, which is divided into four fields, each of which is 8 bits.

2. Three main network addresses

We know that different types of networks vary greatly from LAN to Wan and must be treated differently. Therefore, according to the network size, the network address is divided into three main types:

Class:

0 1 2 3 8 16 24

3 1 0 network No. Host No.

Class B:

1 0 network No. Host No.

Class C:

1 1 0 network No. Host No.

Class A addresses are used for a large network with a small number of (up to 27) hosts greater than 216. Each Class A network can accommodate a maximum of 224 hosts. Class B addresses are used for a host ranging from 28 ~ There are not many medium-sized networks in the range of 216, and a maximum of 214 Class B networks. Class C addresses are used for a large number of small networks with a maximum of 221 Class C networks.

In addition to the above three primary class addresses A, B, and C, there are two other types of addresses, as shown below:

Class D:

1 1 1 0 multi-object address

Class E:

1 1 1 1 0 reserved for later use

The multi-object address is a multicast address that is weaker than the broadcast address. It is used to support the multi-object transmission technology. Class E address is used for future extension.

3. TCP/IP network address

In addition to identifying a host, there are several special forms of significance.

* Broadcast address

According to TCP/IP rules, the network address with the host number "1" is used for broadcast. It is called a broadcast address. Broadcast refers to sending packets to all hosts on the Internet at the same time.

* Limited broadcast

The broadcast address mentioned above contains a valid network number and host number, technically called the Direct Broadcast (boradcasting) address. Any point on the inter-network can be directly broadcast to any other network, but direct broadcast has a disadvantage that you need to know the network number of the sink network.

Sometimes it is necessary to broadcast in the network, but do not know the network number. According to TCP/IP rules, 32-bit "1" inter-network IP address is used for this site broadcast. This address is called the limited broadcast address ).

* "0" Address

According to the TCP/IP protocol, all the "0" Network numbers are interpreted as "local" networks.

* Return address

Class A network address 127 is a reserved address for network software testing and communication between local processes. It is called loopback address ). WhateverProgramOnce data is sent using the return address, the protocol software returns immediately without any network

Transmission.

According to TCP/IP protocol, 1. Groups with network numbers 127 cannot appear on any network. 2. The host and gateway cannot broadcast any path information for this address. The preceding rules show that the addresses with host numbers "0" and "1" have special meanings in the TCP/IP protocol and cannot be used as valid addresses of a host.

Ii. Subnet Mask

1. The subnet TCP/IP Internetwork technology is developed in a large mainstream machine environment. It can grow to the scale that was not expected by the original designers. The rapid expansion of the network scale poses a threat to the IP address mode. It does not guarantee the uniqueness of the host address, but brings two burdens: first, huge network address management overhead; second, the gateway path is expanding rapidly. The second is particularly prominent. The expansion of the path finding table not only reduces the efficiency of the gateway path finding (or even overflows the path finding table, resulting in a path finding fault ), more importantly, it will increase the overhead for refreshing internal and external paths, thus increasing the network burden.

Therefore, it is urgent to seek new technologies to cope with the problems arising from the growth of the network size. After careful analysis, we found that the increase in the size of the network is mainly due to the increase or decrease of network addresses. Therefore, the solution focuses on how to reduce network addresses. So the IP Network

Address multiplexing technology came into being. By reusing technology, several physical networks share the same IP address.

The number of network addresses is small.

Subnet addressing (subnet Routing) is also called subnetting. It is the most widely used IP address multiplexing method and has been standardized, and become part of the IP address mode.

Generally, a 32-bit IP address is divided into two parts: the network number and the host number. We call them the "inter-network part" and "local part" of the IP address respectively ". The subnet addressing technology further divides the local part into "physical network" and "host,

Some physical network hosts

| Intranet part → | Internet part ── ─ local part ── ─ → |

The "physical network" is used to identify different physical networks under the same IP address. It is a "subnet ".

2.Subnet Mask IP protocol standard: each network that uses a subnet selects a 32-Bit mode, one of the corresponding IP addresses is one of the network addresses (including the inter-network and physical network numbers ).

If a location is 0, one of the corresponding IP addresses is one of the host addresses. For example, bit mode:

In 11111111 11111111 11111111 00000000, the first three bytes are all 1, indicating that the top three bytes of the corresponding IP address are the network address; the last byte is all 0, the last byte in the corresponding IP address is the host address. This bit mode is called subnet mask or "subnet mask ".

For ease of use, we often use "dot-and-integer notation" to represent an IP address and subnet mask. For example, the subnet mask of Class B addresses (11111111 11111111 1111111100000000) is:

255.255.25.0 IP provides an interesting flexibility for defining the subnet mask, allowing the "0" and "1" bits in the subnet mask to be discontinuous. However, this subnet mask makes it difficult to allocate host addresses and understand the path finding table. In addition, a very small number of routers support using low-order or unordered bits in subnets, therefore, in actual application, each network usually adopts a continuous subnet mask. It is not recommended to use subnet masks such as 255.255.255.255.255.64and 255.255.255.160.

3.The subnet mask can be used together with the IP address subnet mask to differentiate the network number and host number of a network address.

For example, there is a class C address:

192.9.200.13 the default subnet mask is:

255.255.255.0 the network and host numbers can be obtained as follows:

① Convert the IP address 192.9.200.13 to binary 11000000 00001001 11001000

② Convert subnet mask 255.255.255.0 to binary 11111111 11111111 11111111 00000000

③ The result obtained after two binary logic and (and) operations is the network part.

11000000 00001001 11001000 00001101 and 11111111 11111111 11111111 00000000

11000000 00001001 11001000 00000000 the result is 192.9.200.0, indicating that the network number is 192.9.200.0.

④ The result obtained after the subnet mask is reversed and the IP address logic and (and) is the host part.

11000000 00001001 11001000 00001101 and 00000000 00000000 00000000 11111111 =

00000000 00000000 00000000 00001101 the result is 0.0.0.13, that is, the host number is 13.

4The. subnet mask can be used together with the IP address subnet mask to differentiate the network number and host number of a network address.

For example, there is a class C address:

192.9.200.13 the default subnet mask is:

255.255.255.0 the network and host numbers can be obtained as follows:

① Convert the IP address 192.9.200.13 to binary 11000000 00001001 11001000

② Convert subnet mask 255.255.255.0 to binary 11111111 11111111 11111111 00000000

③ The result obtained after two binary logic and (and) operations is the network part.

11000000 00001001 11001000 00001101 and 11111111 11111111 11111111

00000000 11000000 00001001 11001000 00000000 the result is 192.9.200.0, indicating that the network number is 192.9.200.0.

④ The result obtained after the subnet mask is reversed and the IP address logic and (and) is the host part.

11000000 00001001 11001000 00001101 and 00000000 00000000 00000000

11111111 00000000 00000000 00000000 00001101 the result is 0.0.0.13, that is, the host number is 13.

Iii. subnet division and instance based on the above analysis, we recommend that you define the subnet mask according to the following steps and the instance.

1, The number of subnets to be divided into 2 to the power of M. If you want to divide 8 subnets, 8 = 23.

2The power of m to which the number of subnets to be divided is obtained. For example 23, M = 3.

3. Convert the power m defined in the previous step to the M-bit host address in descending order and convert it to decimal. For example, if M is 3, it is 11100000 and converted to decimal 224, which is the final subnet mask. For a class-C network, the subnet mask is 255.255.255.255.255.255.255.255.255.224.0. For a class-B network, the subnet mask is 255.255.255.224.0.0.

Here, there is an equation between the number of subnets and the number of addresses occupied by the Host: 2 M = n. M indicates the number of digits that occupy the host address, and N indicates the number of subnets. Based on these principles, a class C network is divided into four subnets. If the network number we use is 192.9.200, the IP address of the host in the class C network is 192.9.200.1 ~ 192.9.200.254 (because the host addresses of all "0" and "1" have special meanings and are not valid IP addresses), the Network is divided into four parts. follow these steps:

4 = 22, take the power of 22, that is, 2, then the binary is 11, the host address occupies the High Order is 11000000, is converted to decimal 192. In this way, we can determine that the subnet mask is 192.9.200.192, And the IP address ranges of the four subnets are:

Binary decimal

1 11000000 00001001 11001000 00000001

11000000 00001001 11001000 00111110

192.9.200.1

192.9.200.62

② 11000000 00001001 11001000 01000001

11000000 00001001 11001000 01111110

192.9.200.65

192.9.200.126

③ 11000000 00001001 11001000 10000001

11000000 00001001 11001000 10111110

192.9.200.129

192.9.200.190

④ 11000000 00001001 11001000 11000001

11000000 00001001 11001000 11111110

192.9.200.193

192.9.200.254

Here, we will list the conversion tables of the number of network subnets and subnet masks in class A, B, and C for your reference.

Class:

Number of subnets occupied by the number of digits subnet mask number of hosts in the subnet

2 1 Listen 128.0.0 8,388,606

4 2 listen 192.0.0 4,194,302

8 3 255.224.0.0 2,097,150

16 4 255.240.0.0 1,048,574

32 5 255.248.0.0 524,286

64 6 255.252.0.0 262,142

128 7 255.254.0.0 131,070

128 8 255.255.0.0 65,534

Class B:

Number of subnets occupied by the number of digits subnet mask number of hosts in the subnet

2 1 100000000128.0 32766

4 2 faster than 192.0 16382

8 3 running 255.224.0 8190

16 4 255.255.255.240.0 4094

32 5 running 255.248.0 2046

64 6 255.255.252.0 1022

128 7 255.255.254.0 510

256 8 255.255.255.0 254

Class C:

Number of subnets occupied by the number of digits subnet mask number of hosts in the subnet

2 1 Gbit/s 2017100000000128 126

4 2 rows without errors 192 62

8 3 running 30

16 4 Tib 201710000240 14

32 5 bytes 255.255.248 6

64 6 bytes 255.255.252 2

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.