IP address and subnet mask
First, IP address and network classification
(1) IP address
We know that different physical network technologies have different addressing methods; hosts in different physical networks, there are different physical networks
address. Internet technology is a high-level software technology that will be unified in different physical network technologies. Internet technology uses a global universal
Address format, allocated a network address for each network and each host, to shield the difference in physical network addresses.
The IP protocol provides an address format of all Internet networks and is assigned under unified management to ensure that one address corresponds to one.
The grid network host (including gateway), which is blocked by the IP layer. The address used by the IP layer is called the network address,
Also called an IP address. It consists of two parts: the network number and host number, all hosts in the unified network use the same network number, the host number is only
One.
The IP address is a 32-binary number, divided into 4 fields, 8 bits per field.
(2) Three types of major network addresses
We know that from LAN to WAN, different types of network scale varies greatly, and must take a difference. So according to the size of the network,
The network address is divided into three types, as follows:
Class A:
0 1 2 3 8 16 24
3 1 0 Network host number
Class B:
1 0 Network host number
Class C:
1 1 0 Network host number
Class A address is used for a small amount of large (up to 27) hosts greater than 216, each A network can accommodate up to 224 primary
Machine; Class B address is used for the number of middle networks between 28-216, the number B network is up to 214; Class C is used
Each network can only accommodate a large number of small networks of 28 hosts, and the C class network is up to 221.
In addition to the three primary types of the above A, B, C, there are two other types of addresses, as follows:
Class D:
1 1 1 0
Class E:
1 1 1 0 after staying
Among them, multicast address is a multi-point transfer address slightly weaker than broadcast addresses to support multi-purpose transmission technology.
The E-address is used for future extensions.
(3) TCP / IP specified network address
In addition to generally identifying a host, there are several special forms with special meaning.
* Broadcast address
TCP / IP regulations, host numbers are all "
1"
The network address is used for broadcasting, called broadcast addresses. So-called broadcast, refers to
All hosts are sent to messages online.
* Limited broadcast
The broadcast address mentioned earlier contains a valid network number and host number, which is technically called direct broadcast (Directed)
Boradcasting) Address. At any point on the Internet, you can broadcast directly to any other network, but directly broadcast
One disadvantage is to know the network number of the Subtock Network.
Sometimes it is necessary to broadcast within this network, but I don't know the network number. TCP / IP specification, 32-bit "1" network
The network address is used for this broadcast, which is called a limited broadcast address (Limited
Broadcast address.
"
0 "
address
TCP / IP protocol regulations, all of them are "
0 "
The network number is interpreted as "this" network.
* Return address
Class A network address 127 is a reserved address for network software testing and local machine processes, called return addresses.
(Loopback
Address. Regardless of the program, once the return address is used, the protocol software returns it immediately, and no network is not performed.
transmission.
TCP / IP protocol regulations, one, packets with network number 127 cannot appear on any network; Second, the host and gateway cannot broadcast any finding information for the address. It can be seen from the above provisions that the host number "0" full "1" has a special meaning in the TCP / IP protocol.
It cannot be used as a valid address of a host.
Second, subnet mask
(1) Subnet TCP / IP Internet Technology is generated in large mainstream environments, which can develop to today's scale is the original designer
Standard. The rapid expansion of the network network size to the IP address mode is not the uniqueness of the host address, but will
Bring two bearings: First, huge network address management overhead; second, the gateway is drastically expanded. The second point is particularly prominent.
The expansion of the finding table will not only reduce the rationality of the gateway (or even overflowing the finding table, thus causing a diameter failure), but more importantly
Increase the overhead of the internal and external path refresh, thereby increasing the network burden.
Therefore, there is an urgent need to seek new technologies to deal with problems brought about by gross scale growth. Take a closer analysis, network network size
The growth is mainly manifested for the increase or decrease of network addresses, so solving problems focus on: How to reduce network addresses. So IP network
Network
Multiple reuse techniques of the address came into being. Through multiplexing technology, a number of physical networks share the same IP network address, which will undoubtedly
Less network address number.
Subnet Addressing Technology, also called subnet search path (SUBNet
Routing, English abbreviation Subnetting is the most widely used IP network address multiplexing method, which is currently standardized, and
Be part of the IP address mode.
In general, 32-bit IP addresses are divided into two parts, namely the network number and host number, we call them "networks respectively"
Net section "and" local part ". Subnet addressing technology further divided into" physical network "and" host "part,
Figure:
Network network part physical network host
| ← Network part → | ← ──────────────── → |
Among them, "physical network" is used to identify different physical networks under the same IP network address, both "subnet".
(2) Subnet mask IP protocol standard stipulates that each of the outlets that use the subnet select a 32-bit bit mode, in the mode
A location 1, the corresponding IP address is one of the network addresses (including the network part and physical network number);
of
A bit 0, the corresponding IP address is one of the host addresses. For example, bit mode:
11111111 11111111 11111111
00000000, the top three bytes all 1, represent the highest number of three bytes corresponding to the IP address as the network address; the next byte is 0,
Represents the last byte of the corresponding IP address as the host address. This mode is called subnet model (SUBNet
Mask or "subnet mask".
For the convenience of use, it is often used to represent an IP address and subnet mask, such as a Class B address.
Mask 13111111 11111111
1111111100000000)
255.255.25.0
IP protocols provide an interesting flexibility about the definition of subnet mask, allowing the subnet mask.
0 "
with"
1"
The bit is discontinuous.
However, such subnet masks bring certain difficulties to allocating host addresses and understanding of the diameter, and very little router supports in subnet
Using low sequence or disorderly bits, therefore in practical applications usually use a continuous subnet mask. Subnet mask like 255.255.255.64 and 255.255.255.160 is not recommended.
(3) The subnet mask is used in conjunction with the IP address subnet mask to distinguish between network numbers and hosts of a network address.
number.
For example: There is a C class address:
192.9.200.13 The default subnet mask is:
255.255.255.0 The network number and host number can be obtained as follows:
1 Convert IP address 192.9.200.13 to binary 1100000000001001 11001000 00001101
2 Convert the subnet mask 255.255.255.0 to binary 11111111 11111111 11111111 000000
3 The result obtained after two binary logic and (and) operations is network part
11000000 00001001 11001000 00001101 and 11111111 11111111 11111111
00000000
11000000 00001001 11001000 00000000 The result is 192.9.200.0, that is, the network number is 192.9.200.0.
4 The result of the subnet mask to retrore and the IP address logic and (AND) are the host part
11000000 00001001 11001000 00001101 and 00000000000000001000002
11111111 =
00000000 00000000 00000000 00001101 results
0.0.0
.13, the host number is 13.
(4) The subnet mask is used in conjunction with the IP address subnet mask to the IP address to distinguish between a network number and host number of a network address.
For example: There is a C class address:
192.9.200.13 The default subnet mask is:
255.255.255.0 The network number and host number can be obtained as follows:
1 Convert IP address 192.9.200.13 to binary 1100000000001001 11001000 00001101
2 Convert the subnet mask 255.255.255.0 to binary 11111111 11111111 11111111 000000
3 The result obtained after two binary logic and (and) operations is network part
11000000 00001001 11001000 00001101 and 11111111 11111111 11111111
00000000 11000000 00001001 11001000
00000000 The result is 192.9.200.0, that is, the network number is 192.9.200.0.
4 The result of the subnet mask to retrore and the IP address logic and (AND) are the host part
11000000 00001001 11001000 00001101 and 00000000000000001000002
11111111 00000000 00000000 00000000 00001101 results
0.0.0
.13, the host number is 13.
Third, subnet division and examples are based on the above analysis, it is recommended to define subnet masks as follows and instances.
1. The number of subnets to be divided into 2 M times. To divide 8 subnets, 8 = 23.
2. Take the Power of the M-Party Power of 2 of the number of 2 points to be divided. Such as 23, ie m = 3.3, the power m determined by the previous step is converted into a decimal by pressing the host address M bit. Such as m is 3
Then 11100000, converted to decimal 224, which is the final identified subnet mask. If it is a C-class, the subnet mask is
255.255.255.224; If it is a B network, the subnet mask is 2555.255.224.0; if it is a C-network, the subnet mask is
255.224.0.0.
Here, the number of subnets and the number of occupied host address bits are established:
2M
= n. Where m represents the bit of the host address
Number; n represents the number of subnets divided. According to these principles, a Class C network is divided into 4 subnets. If we use the network number
192.9.200, the host IP address in this C-network network is 192.9.200.1 ~ 192.9.200.254 (because all "
0 "
All
1"
The host address has special meanings, not as a valid IP address), is now divided into 4 parts, follow the steps:
4 = 22, the power of 22, that is, 2, the binary is 11, the high order of the occupation host address is 11000000, and the converted to decimal
To 192. This makes it possible to determine that the subnet mask is: 192.9.200.192, the IP address range of 4 subnets is:
Binary decimal
1 11000000 00001001 11001000 00000001
11000000 00001001 11001000 00111110
192.9.200.1
192.9.200.62
2 11000000 00001001 11001000 01000001
11000000 00001001 11001000 01111110
192.9.200.65
192.9.200.126
3 11000000 00001001 11001000 10000001
11000000 00001001 11001000 10111110
192.9.200.129
192.9.200.190
4 11000000 00001001 11001000 11000001
11000000 00001001 11001000 11111110
192.9.200.193
192.9.200.254
The number of A, B, and Class C class network subnets and a conversion table of the subnet mask is listed for reference.
Class A:
Number of subnets occupies the number of hosts in the net net
21255.128.0.08, 388, 606
42255.192.0.04, 194, 302
83255.224.0.02, 097, 150
164255.240.0.01, 048, 574
325255.248.0.0524, 286
646255.252.0.0262,142
1287255.254.0.0131,070
1288255.255.0.065, 534B class:
Number of subnets occupies the number of hosts in the net net
21255.255.128.032766
42255.255.192.016382
83255.255.224.08190
164255.255.240.04094
325255.255.248.02046
646255.255.252.01022
1287255.255.254.0510
2568255.255.255.0254
Class C:
Number of subnets occupies the number of hosts in the net net
21255.255.255.128126
42255.255.255.19262
83255.255.255.22430
164255.255.255.24014
325255.255.255.2486
646255.255.255.2522