Subnet division of network foundation

I Basic knowledge of ip address

1.1 structure and classification of IP address

According to tcp / ip protocol, every device connected to the internet must have an ip address. It is a 32-bit binary number, which can also be expressed in dotted decimal system. Every group of eight bits is expressed in decimal system, i.e. 0 ~ 255, and each group is expressed in "." Separate, e.g.


ip address representation


After fixing the network bit and host bit in the ip address, the ip address is divided into different accumulation: Class A, class B, class C, class D and class E

!!!At first, all kinds of classification were for the convenience of research and management, but now A, B, C The division of this class is a historical concept, It has no meaning in practice, 

First of all, we know that internet If you want to be accessed by other terminals, you need a unique terminal ip Address. Question: how ip What about the address? How is this process? Through the router, there is a routing table in the routing equipment, which records all ip The location of the address, so that the packet can be forwarded. If we don't distinguish the network address, all the information in this routing table should be saved IP The routing table will be large according to the direction of the address, as described below: if the router's routing table is 32-bit address regardless of network bit and host bit, the routing table maintained by all routers will be large and the forwarding speed will be slow (because the query is slow). And all routers should have full access Internet Everyone's router should have enough performance to store the whole network address. It is estimated that such a Internet The cost is tens of thousands of times higher than now. It's estimated that you can't afford to pawn your family property on the Internet for several times in order to buy a router, and you can't ask this question at all. With the network address, the terminals with the same network address can be limited to the same range. Then the routing table only needs to maintain the direction of the network address to find the corresponding terminal(These terminals)Let's introduce it first A Class, B Class, C Class network address A class IP Address means, in IP Among the four segment numbers of the address, the first segment number is the network number, and the remaining three segment numbers are the number of the local computer. If expressed in binary IP Address, A class IP The address consists of a 1-byte network address and a 3-byte host address. The highest bit of the network address must be "0". A class IP The length of the network ID in the address is 7 bits, and the length of the host ID is 24 bits, A The number of such network addresses is small, which can be used in large networks with more than 16 million hosts. A Class takes up 50% of the entire address space%. However, only 126 organizations can be allocated A Class network address. Interestingly, each organization can be 16,000,000
Provide the address of each host. Very large organizations allocate the entire A Class address block. Today, there are still companies and government organizations A Class address. For example, Ge owns,Apple Computer owns,The United States Postal Service owns One B class IP Address means, in IP Among the four segment numbers of the address, the first two segment numbers are the network numbers, and the remaining two segment numbers are the numbers of the local computer. If expressed in binary IP Address, B class IP The address consists of a 2-byte network address and a 2-byte host address. The highest bit of the network address must be "10". B class IP The length of the network ID in the address is 14 bits, and the length of the host ID is 16 bits, B This kind of network address is suitable for medium-sized networks. Each network can accommodate more than 60000 computers. B Class takes up 25% of the entire address space%. Up to 16,384 Organizations can be assigned B Class network address, each network can support 65,534 Hosts.
Only those big companies
/Organizations or government departments may use all 65,000 An address. And A Similar to similar networks, B Class address space wastes a lot IP Address. One C class IP Address means, in IP Among the four segment numbers of the address, the first three segment numbers are the network numbers, and the remaining segment numbers are the numbers of the local computer. If expressed in binary IP Address, C class IP The address consists of a 3-byte network address and a 1-byte host address. The highest bit of the network address must be "110". C class IP The length of the network ID in the address is 21 bits, and the length of the host ID is 8 bits, C There are a large number of such network addresses, which are suitable for small-scale local area networks. Each network can only contain 254 computers at most. C Class takes up 12% of the entire address space.5%. Many organizations have access to C Class networks, but limited to the total number of hosts they can connect to. In fact, in many cases, C
Class addresses are usually too small for most medium-sized enterprises. In addition to the above three types IP In addition to the address, there are several special types IP Address, TCP
/IP The agreement provides that where IP The first byte in the address is in“ lll0"The initial address is called multicast address. Therefore, any first byte greater than 223 and less than 240 IP The address is a multicast address; IP An address where each byte in the address is 0 ("0").0.0.0")Corresponding to the current host; IP Every byte in the address is 1 IP Address ("")Is the broadcast address of the current subnet; IP In the address“ llll0"All addresses are reserved for special use in the future; IP Address cannot start with decimal "127", Is the loopback address, which refers to the local machine. It is generally used for testing. Loopback address (127).x.x.x)Is the local loopback address( Loopback Address),Host IP Internal stack IP Address is mainly used for network software testing and local machine interprocess communication. No matter what program, once the loopback address is used to send data, the protocol software will return it immediately without any network transmission. Belongs to reserved test address,Can't use the Internet at the same time ID The first 6-bit group of cannot be set to "0". All "0" indicates the local network. D Class sum E Class is used for multicast and reserved addresses. Next question: why A Class, B Class sum C Class? 1: It is estimated that it is caused by historical reasons, and now all A Class addresses are all in the United States 2: in the early stage, it was assumed that the scale of the Internet would not be so large. In order to make every terminal in the network obtain a public address as much as possible IP(Can be freely accessed by the Internet),It's separated A Class address such a huge address space, in fact A After the class address is divided, more sub network addresses will be subdivided into the network address to the router, because it is impossible for such a large switch to connect all terminals. Even so, there are still many IP Address waste.


1.2 special ip address

  1. Network address: used to indicate the network itself. The ip address with normal network number and zero host number is called network address. For example, is a class B network address
  2. Broadcast address: used to broadcast to all devices in the network. An ip address with a normal network number and a host number of 1 (i.e. 255) is called a broadcast address. For example, is a class B network address
  3. Limited broadcast address: refers to the ip address of 32-bit full bit 1 (i.e. 255.255.255), which is used for broadcasting in this network
  4. Loopback address: the network address cannot start with 127 in decimal system. In the address, the number 127 is reserved for the system for diagnosis, which is called the welcome address. For example, is used for loop test
  5. Private address: ip addresses that can only be used in the LAN and cannot be used on the internet are called private ip addresses. Private ip addresses include:
    1. ~ indicates A class A address
    2. ~, indicating 16 class B addresses
    3. ~, indicating 256 class C addresses
    4. be careful!!!: These addresses will not be assigned by the Internet, so they will never be routed on the Internet. Although they cannot be directly connected to the Internet, they can still be used to communicate with the Internet. We can choose the appropriate address class according to our needs and boldly use these addresses as public IP addresses in the internal local area network. On the Internet, devices that do not need to communicate with the Internet, such as printers and manageable hubs, can also use these addresses to save IP address resources
  6. refers to the ip address that is no longer in the true sense. It refers to all unclear hosts and destination networks. Unclear here refers to that there is no specific entry in the local routing table indicating how to arrive
  7. more:

1.3 subnet mask

  1. The subnet mask is used to identify the network address and host address in the ip address.
  2. The subnet mask is also a 32-bit binary number. In the subnet mask, the part corresponding to the network address is represented by 1 and the host part is represented by 0
  3. The network prefix can also be used to represent the subnet mask, i.e. "/ < network address bits >". For example, indicates that the subnet mask of class B network is

1.4 ip address application

II Subnet Division

2.1 concept of subnet Division

Subnet division is realized by borrowing several host bits of ip address to fill the subnet address, so as to divide the original network into several isolated subnets

be careful:

  • arp protocol obtains the mac address of the target host through the ip address. This process uses the broadcast method. This broadcast address is calculated from the subnet address in the subnet mask. Only the calculated host in this subnet can receive this arp broadcast packet
  • Subnet division and vlan can isolate the broadcast domain, but subnet division is three-layer isolation and vlan is two-layer isolation

2.2 discussion on the division of class C subnet

2.3 subnet division steps

  • Determine the number of subnets to be divided and the number of hosts per subnet
  • Calculate the number of binary digits N corresponding to the number of subnets and the number of binary digits M corresponding to the number of hosts
  • For the atomic network mask of the ip address, the subnet mask after the ip address is divided into subnets is obtained by setting the first N position 1 (all the rest are set to 0) or the last M position 0 (all the rest are set to 1) of the host address part

Case sub network division

Divide class C network into five subnets

2 * * 2-2 < 5 < 2 * * 3-2, so 3-digit network number is required, and the host number is 8-3 = 5

The subnet mask is

Each subnet can accommodate 2 * * 5-2 = 30 hosts

2.5 precautions for subnet Division

  1. When dividing subnets, we should not only consider the current needs, but also understand the need to talk more about subnets and hosts in the future. The subnet mask uses more host bits to obtain more subnets and save ip address resources. If more subnets are needed in the future, there is no need to reassign ip addresses, but the number of hosts in each subnet is limited; On the contrary, the subnet mask uses fewer host bits, and the number of hosts per subnet allows greater growth, but the number of available subnets is limited
  2. Generally speaking, if there are too many nodes in a network, the network will be saturated due to broadcast communication, so the growth of the number of hosts in the network is limited, that is, if conditions permit, more host bits should be used for subnet bits

2.6 why subnet division and its advantages

2.6.1 why subnet division

Internet organizations define five IP addresses, including A, B and C addresses for hosts. There are 126 class A networks, and each class A network may have 16777214 hosts, which are in the same broadcast domain. It is impossible to have so many nodes in the same broadcast domain. The network will be saturated due to broadcast communication. As A result, most of the 16777214 addresses are not allocated, resulting in waste. On the other hand, with the continuous expansion of Internet applications, IP address resources are less and less. In order to achieve A smaller broadcast domain and make better use of each bit of the host address, the class based IP network can be further divided into smaller networks. Each subnet is defined and assigned A new subnet network address by the router. The subnet address is created by borrowing the host part of the class based network address. After the subnet is divided, the subnet is hidden by using the mask, so that the network does not change from the outside. This is the subnet mask.

To put it simply, A company cannot use 254 public network addresses. Company A wants to use 6 addresses and company B also wants to use 6 addresses. If the addresses of the two companies are placed in A large network segment, the addresses of the two companies can be directly interconnected

2.6.2 advantages of subnet Division

  • Reduce network traffic
  • Improve network performance
  • Simplify management
  • Easy to expand geographical scope

2.7 subnet division and vlan

After the subnet division is completed, computers linked to different subnets on the same switch belong to different LANs from the perspective of layer 3, but they are all connected to the same interactive machine. From the perspective of layer 2, they are the same LAN. In other words, the broadcast of a data packet will still be broadcast to all ports of the interactive machine. Therefore, subnet division is usually used in conjunction with vlan. The concept of vlan is as follows

Tags: computer

Posted by Calahan on Sun, 17 Apr 2022 07:59:34 +0930