A 1.IP address consists of two fixed fields (network number + host number). After dividing the subnet (the part of the host number is re-divided), to become (network number + subnet number + host number), but the external still appear as a network. such as Class B ip:145.13.0.0. Divided into three subnet 145.13.3.0,145.13.7.0,145.13.21.0. After the datagram (the destination address is 145.13.3.10) arrives at the router, according to the network number, the subnet number, find the destination subnet, delivered to it.
Summary above is the 145.13.0.0 is an ordinary Class B network, arrived at the router into the network, saw the division after the many subnets.
2. However, from the header of the IP datagram (the destination address is 145.13.3.10), it is not possible to see whether the network of the destination host is subnetting, and who is not known to be forwarded. So there's a subnet mask. The subnet mask corresponds to 1 (network number + subnet number), and 0 in the subnet mask corresponds to the host number so that the corresponding destination subnet can be found. If the subnet is not partitioned, the subnet mask for that network uses the default subnet mask (for example, Class B 255.255.0.0).
The above means that the subnet mask is used to cut network addresses and host addresses.
3. To make different computers in the same network segment, as long as the network identity is the same. Instead of saying that the first three paragraphs of IP are the same. For example:
Put ip:192.168.0.1. Subnet Mask: 255.255.255.0 do an example.
Turn them into binary:
IP 11000000.10101000.00000000.00000001
Subnet Mask 11111111.11111111.11111111.00000000
The IP and subnet mask each bit corresponding to do and operation, get: 11000000.10101000.00000000.00000000, this is the network identifier, turn into binary 192.168.0.0.
Then the net mask is reversed, the result and the IP do and operations, get the host identification.
Subnet mask take anti-00000000.00000000.00000000.11111111
IP 11000000.10101000.00000000.00000001
The result is 00000000.00000000.00000000.00000001, converted to binary, obtained 0.0.0.1.
The network identity is the same on the same network segment. All kinds of IP network identification algorithm is not the same, Class A only counted the first paragraph, Class B only counted one or two paragraphs, C class 123 paragraph.
4. Ask for the number of hosts. The algorithm is 2^m. M is the number of zeros in the subnet mask. Minus 0 and 255.
5. Seek the number of subnets. Is the opposite of the number of hosts.
Dividing subnets and subnet masks