Tutorial on TCP/IP Subnet Mask
1. Default class A, B, and C addresses, subnet mask;
Ii. Role of subnet mask:
Code:
IP address 192.20.15.5 11000000 00010100 00001111 00000101
Subnet Mask 255.255.0.0 11111111 11111111 00000000 00000000
Network ID 192.255.0.0 11000000 00010100 00000000 00000000
Host ID 0.0.15.5 00001111 00000101
Calculate the number of hosts in this subnet: 2 ^ N-2 = 2 ^ 16-2 = 65534
Where: N indicates the number of digits occupied by the host ID; 2: 192.255.0.0 (indicating the current network); and 192.255.255.255 (indicating the subnet broadcast );
The IP address range of the host to which the subnet belongs: 192.20.0.1 ~ 192.00000000254
3. Implement Subnet
1. Reasons for dividing subnets:
① Remote LAN interconnection;
② Connect to the hybrid network technology;
③ Increase the number of hosts in the CIDR block;
④ Reduce network broadcast.
2. The following factors must be taken into account for subnet implementation:
① Determine the number of network IDS required, and be sure to leave room for future development;
Who needs to use a separate network ID?
▲Each subnet;
▲Each WAN connection;
② Determine the maximum number of computers in each subnet and consider future development;
Who needs to use a separate host ID?
▲Each TCP/IP computer Nic;
▲Each TCP/IP printer Nic;
▲Route interfaces on each subnet;
③ Consider the necessity of the growth plan:
Assume that you have applied for a network ID at InterNIC: 192.20.16.0, but you have two remote LANs that need to be interconnected, and each remote LAN has 60 hosts.
If you do not divide subnets, you can only use one network ID: 192.20.16.0, use the default subnet mask: 255.255.255.0, and the range of Host IDS that can be accommodated in this subnet is 1 92.20.16.1 ~ 192.20.16.254, that is, 254 hosts can be deployed.
Now, if you divide the subnet into two subnets as needed, that is, using two of the Host IDS as the network IDs, The subnet mask strain is: 255.255.255.255.192 (11000000) the purpose is to mask the borrowed bit used as the network I D. Let's take a look at the subnet:
▲192.20.16. 65 ~ 126
192.20.16.0000001 ~ 01111110
Number of hosts in this section (01): 2N-2 = 26-2 = 62 or 126-65 + 1 = 62
▲192.20.16. 129 ~ 190
192.20.16.0000001 ~ 10111110
Number of hosts in this segment (10 segment): 2N-2 = 26-2 = 62 or 190-129 + 1 = 62
▲If the subnet number 00 is all 0, it indicates the current network. If the subnet number 11 is all 1, it is subnet shielded and unavailable.
This solution can meet the current needs, but if you need to add a new network segment, you must re-divide more subnets (that is, use more host ID bits as the network ID ), or, if you need more hosts in each subnet in the future, you must use the network I d bit to ensure more hosts.
Iv. method for defining subnet numbers
If the network ID assigned to you by InterNIC is 129.255.0.0, when the default subnet mask 255.255.0.0 is used, you will only have one network ID and-2 hosts (range: 1 29.20.0.1 ~ 129.00000000254 ). You need to divide the network into four subnets.
1. manual calculation:
① Convert the number of subnets to binary.
4 → 00000100
② The number of digits required to represent the number of subnets in binary form is the number of digits added to the default Subnet Mask (the number of digits that should be borrowed from the host ID)
00000100 → 3
③ Determine the subnet mask
Default Value: 255.255.0.0
After the three digits of the host ID are used: Subnet Mask (11100000). 0, indicating that all bits are represented as 1 and used as the subnet mask.
④ Determine the available network ID
List all binary combinations caused by the additional bit, remove all combinations of 0 and 1
Code:
The actually obtained subnet ID of the combination
000 bytes
001 → 32 (00100000) 129.20.32.0
010 → 64 (01000000) 129.20.64.0
011 → 96 (01100000) 129.20.96.0
100 → 128 (10000000) 129.20.128.0
101 → 160 (10100000) 129.20.160.0
110 → 192 (11000000) 129.20.192.0
000 bytes
⑤ Determine the range of available Host IDS
Code:
The last IP address of the IP address starting from the subnet
129.20.32.0 129.20.32.1 129.20.63.254
129.20.64.0 129.20.64.1 129.20.95.254
129.20.96.0 129.20.96.1 129.20.127.254
129.20.128.0 129.20.128.1 129.20.159.254
129.20.160.0 129.20.160.1 129.20.191.254
129.20.192.0 129.20.192.1 129.20.223.254
2. Quick computing:
① Convert the number of subnets to binary.
4 → 00000100
② The number of digits required to represent the number of subnets in binary form is the number of digits added to the default Subnet Mask (the number of digits that should be borrowed from the host ID)
00000100 → 3
③ Determine the subnet mask
Default Value: 255.255.0.0
After the three digits of the host ID are used: Subnet Mask (11100000). 0, indicating that all bits are represented as 1 and used as the subnet mask.
④ Convert the rightmost "1" of 11100000 to decimal, that is, the increment between each subnet ID, recorded as Delta? ? = 32
⑤ The number of subnet IDs generated is 2m-2 (M: number of digits added to the default subnet mask)
Number of available subnet IDs: 23-2 = 6
⑥ Yes? Attached to the original network ID to form the first subnet network ID 129.20.32.0
7. Repeat 6th. What is the value of each subsequent subnet plus ?, Obtain all subnet network IDs.
129.20.32.0
129.20.64.0
129.20.96.0
129.20.128.0
129.20.160.0 129.20.192.0
129.20.224.0 → 224 is the same as the subnet mask and is an invalid network ID.