I have made many attempts to find a resource summary for the principle of router IP addresses. Can not clearly handle their own needs, so in the following article, there should be a satisfactory harvest.
In a routable network layer protocol, the protocol address must contain two parts: the network address and the host address. The most obvious way to store this information is to use two separated domains. In this way, we must consider the maximum length of the two domains. Some protocols (such as IPX) are like this, it works well in Small and Medium-sized networks.
Another solution is to reduce the length of the host address domain, such as 24-bit network address and 8-bit host address. In this way, a large number of network segments are available, but the number of hosts in each network segment is small. In this way, for networks with more than 256 hosts, multiple network segments must be allocated. The problem is that many networks impose an unbearable burden on routers.
The IP address is packed together with the host address in a 32-bit domain. Sometimes the host address is very short and sometimes very long. This can effectively use the address space and reduce the length of the IP address, the number of networks is not large. There are two ways to separate host addresses: class-based addresses and classless addresses.
Router IP address principle: Host and gateway
The difference between the host and the gateway is often confused, because the significance of the host changes. In RFC (1122/3 and 1009), a host is a device connected to one or more networks. It can send and receive data from any network, but it never transmits data from one network to another.
A gateway is a device connected to more than one network. It selectively forwards data from one network to another. In other words, in the past, the concept of a host and a gateway was separated by a human region, when the computer was not capable of simultaneously using the host and gateway. A host is a user's computer or a file server. The capabilities of modern computers are sufficient to assume these two roles at the same time. Therefore, modern hosts should be defined as follows:
A host is a device connected to one or more networks. It can send and receive data from any network. It can also be used as a gateway, but this is not its sole purpose. A vro is a dedicated gateway. Its hardware is specially designed to forward large amounts of data with minimal latency. However, the gateway can also be a standard computer with multiple NICs, and the network layer of its operating system can forward data. Because dedicated Routing hardware is cheaper, computers are rarely seen as gateways. Computers may also be used as non-dedicated gateways in small sites with only one dial-up connection.
Router IP address principle: class-based IP Address
◆ When the IP address is initially designed, the address is divided into several categories based on the first byte:
◆ 0: Reserved
◆ 1-126: Class A (Network Address: 1 byte, host address: 3 byte)
◆ 127: Reserved
◆ 128-191: Class B (Network Address: 2 bytes, host address: 2 bytes)
◆192-223: class C (Network Address: 3 bytes, host address: 1 byte)
◆ 224-255: Reserved
Router IP address principle: subnet division
Although the class-based address system works well for Internet service providers, it cannot do any routing within a network, and its purpose is to use Layer 2 (bridging/switching) to guide data in the network. In A large class A network, this becomes A special problem, because it is very difficult to manage only bridging/switching in A large network.
Logically, the solution is to divide a large network into several small networks, but this is impossible in a class-based address system. To solve this problem, a new domain: subnet mask appears. The subnet mask specifies the network address and host address. In the subnet mask, binary 1 indicates the network address bit, and binary 0 indicates the host address bit. The subnet mask of traditional IP addresses is:
◆ Class A: 255.0.0.0
◆ Class B: 255.255.0.0
◆ Class C: 255.255.255.0
◆ If you want to use a Class B network address as a class C address, you can use mask 255.255.255.0.
Dividing a network into multiple networks with a long subnet mask is called dividing subnets. Note that some old software does not support subnets because they do not understand subnet masks. For example, the UNIX routed routing daemon usually uses the RIP Protocol of version 1, which is designed before the appearance of the subnet mask.
The preceding section only describes three subnet masks: 255.0.0.0, 255.255.0.0, and 255.255.255.0. They are byte-aligned subnet masks. However, you can also divide the data in the middle of the byte. For more information, see related TCP/IP books.
Subnet allows us to have a new network of scale, including a small network used for point-to-point connection, such as a mask 255.255.255.252, 30-bit network address, Two-Bit host address: the subnet of two hosts), or a medium-sized network such as 255.255.240.0, 20-bit network address, 12-bit host address: The subnet of 4094 hosts ). Note that DNS is designed to only allow byte-aligned IP networks (in in-addr.arpa. domain ).
Router IP address principle: supernetting)
Supernetwork is similar to subnet-IP addresses are divided into independent network addresses and host addresses according to the subnet mask. However, unlike a subnet that divides a large network into several small networks, it combines some small networks into a large network-a supernetwork. Assume that there are 16 class C networks, from 201.66.32.0 to 201.66.47.0. They can be uniformly represented as the network in 201.66.32.0 using the subnet mask 255.255.240.0.
Router IP address principle: Not any address group can do this. For example, a unified network cannot be formed for 16 class C networks from 201.66.71.0 to 201.66.86.0. However, this does not matter. As long as the policy is proper, you can always find a suitable group of addresses.
Vro IP address principle: Variable Length Subnet Mask (VLSM)
If you want to divide your network into multiple subnets of different sizes, you can use a variable length subnet mask, each subnet can use a different length subnet mask. For example, if you divide networks by department, some network masks can be 255.255.255.0 (most departments), and others can be 255.255.252.0 (larger departments ).
Router IP address principle: classless IP address (CIDR)
The increase in the number of hosts on the Internet exceeded the original expectation. Although it is far from reaching 232, the address is scarce. RFC1519 published in 1993 -- Classless Inter-Domain Routing (Classless Inter-Domain Routing) is a method to solve this problem.
CIDR tries to prolong the service life of IPv4. Unlike IPv6 with a 128-bit address, it cannot solve the depletion of address space, but IPv6 is a huge task, the Internet is not ready yet. CIDR gives us the buffer preparation time. The class-based address system works well. It makes a good compromise between valid address usage and a small number of networks. However, as the Internet unexpectedly grows, there are two major problems:
The increase in the number of allocated networks makes it difficult to manage route tables, which reduces the processing speed of routers to a considerable extent. The rigid Address Allocation Scheme wastes a lot of addresses, especially class B addresses. To solve the second problem, you can allocate multiple smaller networks. For example, you can use multiple Class C networks instead of one class B network. Although this can effectively allocate addresses, it makes the expansion of the route table the first problem ).
In CIDR, addresses are allocated according to the network topology. A continuous set of network addresses can be assigned to a service provider so that the whole group of addresses as a network address may use the supernetwork technology ). For example, a service provider is allocated with 256 Class C addresses, from 213.79.0.0 to 213.79.255.0. The service provider assigns each user a class C address, however, the external route table of the service provider identifies these routes only through a table entry-network 213.79.0.0 with a mask of 255.255.0.0.
This method significantly reduces the growth of Route tables. The author of cidr rfc estimates that if 90% of service providers use CIDR, the route tables will increase by 54% every three years, if CIDR is not used, the growth rate is 776%. If you can reorganize the existing address, the number of router broadcasts on the Internet backbone will be greatly reduced. But this is actually not feasible, because it will bring a huge management burden.