SoFunction
Updated on 2025-04-12

The second detailed explanation of the basic knowledge of Cisco routing technology

Router <3>

3. IP address

In a routable network layer protocol, the protocol address must contain two parts of information: the network address and the host address. The most obvious way to store this information is to use two separate domains, so we have to consider the maximum length of the two domains. Some protocols (such as IPX) are like this, and it works well in small and medium networks.

Another solution is to reduce the length of the host address domain, such as a 24-bit network address and an 8-bit host address, so that there are more network segments, but there are very few hosts in each network segment. In this way, for networks with more than 256 hosts, multiple network segments must be allocated. The problem is that many networks have an unbearable burden on the router.

IP wraps the network address and the host address together in a 32-bit domain. Sometimes the host address part is very short and sometimes very long. This can effectively utilize the address space, reduce the length of the IP address, and the number of networks is not large. There are two ways to separate host addresses: class-based addresses and class-free addresses.

1. Host and gateway

The difference between host and gateway is often confusing because of a change in the meaning of host. In RFC (1122/3 and 1009) is defined as:

A host is a device connected to one or more networks. It can send and receive data from any network, but it never transfers data from one network to another.

A gateway is a device connected to more than one network, and it selectively forwards data from one network to other networks.

In other words, the concepts of host and gateway were manually separated, when computers did not have enough ability to use both host and gateway. The host is the computer where the user works, or a file server, etc. Modern computers are capable enough to play both roles at the same time, so modern host definitions should be like this:

A host is a device connected to one or more networks that can send and receive data from any network. It can also be used as a gateway, but that's not its sole purpose.

Routers are dedicated gateways, and their hardware has been specially designed to forward large amounts of data with minimal delay. However, the gateway may also be a standard computer with multiple network cards, and the network layer of its operating system has the ability to forward data. Because dedicated routing hardware is cheaper, it is already rare for computers to be used as gateways, and in small sites with only one dial-up connection, it is possible to use computers as non-dedicated gateways.

2. Class-based address

When the IP was initially designed, the address was divided into several categories according to the first byte:

0: Reserved
1-126: Class A (network address: 1 byte, host address: 3 bytes)
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

3. Subnet division

While a class-based address system works well for Internet service providers, it cannot do any routing within a network, and its purpose is to use a layer 2 (bridge/switch) to guide data in the network. In large Class A networks, this becomes a special problem, as using only bridge/switching in large networks makes it very difficult to manage. The logical solution is to split the large network into several small networks, but this is not possible in a class-based address system. To solve this problem, a new domain emerges: the subnet mask. The subnet mask indicates which parts of the address are network addresses and which are host addresses. In the subnet mask, binary 1 represents the network address bit, and binary 0 represents the host address bit. The subnet masks of traditional addresses are:

Class A: 255.0.0.0

Class B: 255.255.0.0

Class C: 255.255.255.0

If you want to use the address of a Class B network as a Class C-sized address, you can use the mask 255.255.255.0.

Using a longer subnet mask to divide a network into multiple networks is called a subdivision network. It should be noted that some old software does not support subnets because they do not understand the subnet mask. For example, UNIX's routed routing daemon usually uses the routing protocol of version 1 RIP, which was designed before the subnet mask appears.
The above only introduces three subnet masks: 255.0.0.0, 255.255.0.0 and 255.255.255.255.0.0, which are byte-aligned subnet masks. However, it can also be divided in the middle of bytes. I will not explain it in detail here. Please refer to the relevant TCP/IP books.

Subnets allow us to have new scale networks, including small networks for point-to-point connections (such as mask 255.255.255.252, 30-bit network address, 2-bit host address: subnet of two hosts), or medium-sized networks (such as mask 255.255.240.0, 20-bit network address, 12-bit host address: subnet of 4094 hosts).

Note that DNS is designed to allow only byte alignment of IP networks (in the .domain).

4. Supernetting

Supernet is a similar concept to subnets - IP addresses are divided into independent network addresses and host addresses according to subnet masks. However, contrary to subnet dividing large networks into several small networks, it combines some small networks into one large network - super network.

Assume there are now 16 Class C networks, from 201.66.32.0 to 201.66.47.0, which can be uniformly represented as network 201.66.32.0 with subnet mask 255.255.240.0. However, not any address group can do this. For example, 16 Class C networks 201.66.71.0 to 201.66.86.0 cannot form a unified network. But this actually doesn't matter. As long as the strategy is right, you can always find a suitable set of addresses.

5. Variable long subnet mask (VLSM)

If you want to divide your network into multiple subnets of different sizes, you can use variable-length subnet masks, each of which can use subnet masks of different lengths. For example: If you divide networks by department, some networks can have masks of 255.255.255.0 (most departments), others can have masks of 255.255.252.0 (larger departments).

6. No Category Address (CIDR)

The number of hosts on the Internet has increased beyond the original idea. Although it is far from reaching 232, there is already a shortage of addresses. RFC1519, published in 1993, -Classless Inter-Domain Routing (Classless Inter-Domain Routing), is a way to try to solve this problem. CIDR attempts to extend the life of IPv4. Unlike IPv6 with 128-bit addresses, it cannot ultimately solve the exhaustion of address space, but the implementation of IPv6 is a huge task and the Internet is not ready yet. CIDR gives us the time to prepare buffers.

Class-based address system works well, and it makes a good compromise between effective address usage and a small number of networks. But with the unexpected growth of the Internet, two major problems arise:

The increase in the number of allocated networks makes the routing table too large to manage, and to a considerable extent reduces the processing speed of the router.

The rigid address allocation scheme has caused many addresses to be wasted, especially Class B addresses, which are very scarce.

To solve the second problem, multiple smaller networks can be allocated, for example, multiple C-type networks instead of one B-type network. Although this can effectively allocate addresses, it further aggravates the expansion of the routing table (the first problem).

In CIDR, addresses are assigned according to network topology. A continuous set of network addresses can be assigned to a service provider, making the entire set of addresses as a network address (most likely using hypernet technology). For example: a service provider is assigned with 256 Class C addresses, from 213.79.0.0 to 213.79.255.0. The service provider assigns a Class C address to each user, but the routing table outside the service provider only distinguishes these routes through a single table entry - a network 213.79.0.0 with a mask of 255.255.0.0.

This approach significantly reduces the growth of routing tables, and the authors of CIDR RFC estimate that if 90% of service providers use CIDR, the routing tables will grow at a rate of 54% every 3 years, while if CIDR is not used, the growth rate is 776%. If existing addresses can be reorganized, the number of routes broadcast by routers on the Internet backbone will be greatly reduced. But this is actually not feasible because it will bring huge management burden.

Article entry: aaadxmm     Editor in charge: aaadxmm