4G Router Overlapping Routing Settings


The principle of the router
The principle of the routing table is that if a host has multiple network interfaces, when it sends a packet to a specific IP address, it decides which interface to use.

The specific settings
Purpose, subnet mask, gateway, flag, interface 201.66.39.0255.255.255.0201.66.39.21Ueth1
201.66.37.0255.255.255.0201.66.37.74Ueth0

The host sends all the data destined for the host (201.66.37.1-201.66.37.254) in the network 201.66.37.0 through the interface eth0 (IP address is 201.66.37.74), and all the destinations are the data passing through the interface in the network 201.66.39.0. Eth1 (IP address is 201.66.39.21) is sent. The flag U indicates that the route status is "up" (i.e., active state). For a directly connected network, some software does not give the IP address of the interface as in the previous example, but only the interface.

Routing Table Principle: This example only involves a directly connected host, so what about the destination host in the remote network? If you connect to the network 73.0.0.0 through a gateway with an IP address of 201.66.37.254, you can add one to the routing table:
73.0.0.0255.0.0.0201.66.37.254UGeth0

This entry tells the host that all packets destined for the host within network 73.0.0.0 are routed through 201.66.37.254. The flag G indicates that this item directs the packet to the external gateway. Similarly, you can define a route to a specific host through the gateway, and add the flag H (host):
91.32.74.21255.255.255.255201.66.37.254UGHeth0
The following is the principle of the routing table, except for special entries:
127.0.0.1255.255.255.255127.0.0.1UHlo0
Default0.0.0.0201.66.37.254UGeth1

The first principle of the routing table principle is the loopback interface, which is used by the host to send data to itself. It is usually used to test and run applications that are above IP but require local communication. This is the host route to the specific address 127.0.0.1 (interface lo0 is the "fake" NIC inside the IP stack).

The second item of the routing table principle is very interesting. In order to prevent each route on the host that may reach the network on the Internet, a default route can be defined. If there is no entry in the routing table that matches the destination address, the packet is was sent to the default gateway. Most hosts simply connect to the network through a network card, so only through one router to other networks, there are only three items in the routing table: the loop back entry, the local subnet entry, and the default entry (pointing to the router).
Overlapping routes, assuming the following overlapping items in the routing table:
1.2.3.4255.255.255.255201.66.37.253UGHeth0
1.2.3.0255.255.255.0201.66.37.254UGeth0
1.2.0.0255.255.0.0201.66.37.253UGeth1
Default0.0.0.0201.66.39.254UGeth1

The reason why these routes overlap is because these four routes all contain the address 1.2.3.4. If you send data to 1.2.3.4, which route will you choose? In this case, the first route is selected, passing the gateway 201.66.37.253. The principle is to choose the subnet mask with the longest (most accurate). Similarly, the data sent to 1.2.3.5 selects the second route.

Routing Table Principle Note: This principle only applies to indirect routing (through the gateway). Defining two interfaces on the same subnet is illegal in many software implementations. For example, the following settings are usually illegal (although some software will try to load balance on both interfaces):
Eth0201.66.37.1255.255.255.0
Eth1201.66.37.2255.255.255.0

The strategy for overlapping routes is very useful. It allows the default route to work as a route with a destination of 0.0.0.0 and a subnet mask of 0.0.0.0, and does not need to be implemented as a special case of routing software. Looking back at CIDR, the above example is still used: A service provider is given 256 Class C networks, from 213.79.0.0 to 213.79.255.0. The routing table outside the service provider knows all of these routes with only one entry: 213.79.0.0, and the subnet mask is 255.255.0.0.
---------------------------------------------------

Comments

Popular Posts