Abstract:Follow the message and walk from the Windows host through the router to the Linux host.

This article is shared from the Huawei Cloud Community “The Wonderful Journey of Messages on Different Devices”, the original author: GuSe Blowing Sheng.

Introduction to the

In the figure above, Hosta’s message is forwarded to HostB, where the message is needed, starting from the local gateway, passing through the router Routera, and arriving at HostB.

Host A: Windows;

1. Router A.

Host B: Linux;

Let’s start with the routing table of Host A and look at the routing tables for different locations on the network. Before we look at the routing table, let’s take a look at the concept of routing, which is the most basic element of a data communication network. Routing information is the path information that guides the message sending, and the process of routing is the process of message relay and forwarding.

The router/host selects the route through the routing table, and each router/host keeps at least one routing table.

The IP configuration routes and the direct routes generated by the interface are stored in the routing table of the host

Routes discovered by various routing protocols are saved in the router’s routing table. Routes in the routing table can usually be divided into the following three categories according to their sources:

  • Routing discovered by the link layer protocol (also known as interface routing or direct routing).
  • Static routing manually configured by a network administrator.
  • Dynamic Routing Protocol discovers the route.

The route on Host A

Configuration: The host must be configured with the native IPv4 address, subnet mask and default gateway;

Gateway is also known as the inter-network connector, protocol converter. Gateway realizes network interconnection above the network layer. In plain English, gateway is a setting of forwarding route. If the next hop of route is gateway, it means that the next hop of route is a router, rather than a host.

View Windows in routing table:

The first route is automatically generated by the configured default gateway. The mask is 0.0.0.0. The next hop is the default gateway.

Gateway routing is the route that is the next hop to gateway. First of all, it is clear that gateway routing is not a routing protocol, but a routing protocol is a rule to maintain routing table between routers, which is used to discover routes, generate routing table, and guide packet forwarding.

Routes with a mask of 0.0.0.0 are collectively referred to as the default routes. To understand the default routes, we should first know the longest matching principle of route forwarding. Routing search matches by bits. In short, the route matching to the longest mask is the forward route. If you look up the IP tree, you’ll eventually find 0.0.0.0, which is the default route. More simply, the idea is to give routes that can’t find non-zero addresses a place to forward eventually

After understanding the above concepts, we can know that the first route is the default gateway route. Its function is to send the message from the native machine. If the destination address is not the native machine, it will be forwarded directly from the default gateway.

The destination address of the message is 10.1.1.1, not the native IP address, and is thrown out of the gateway by default.

Routing on Router A

There are two tables on the router, one is the routing table on the control surface, and the other is the forwarding table. In order to understand the forwarding, we will take a special look at the forwarding table of Huawei router.

In republication, the interface GE1/1/1 can be configured as

interface GE1/1/1

IP address 10.1.1.10 255.255.255.0

10.1.1.0/24 is the network segment routing, the destination address is the result of matching IP address and mask, and the next hop is the IP address configured by the interface (without any forwarding meaning, only display meaning). Used to forward a message whose destination address is the same network segment from a specified interface.

10.1.1.10/32 is the route of the host, and the destination address is the IP address of the interface. All the route masks of the host are 32 bits. The next hop is the ring return port address 127.0.0.1, which indicates that the address of 1.1.1.1 is available on the local machine. The host route is used to receive messages destined for the local device.

10.1.1.255/32 is the subnet broadcast route, and the algorithm is XOR between the IP address and the mask address after inversion. IP protocol stipulate that all the three-layer interfaces of the network segment broadcast address need to receive the message of this address. In practical application, there is almost no use of segment broadcast feature in any scenario.

After receiving the message, Routera searched for forwarding according to the longest matching principle, found the network segment routing of 10.1.1.0, and forwarded the message from GE1/1/1.

Routing on Host B

Host B is the Linux operating system, and it has many similarities to a Windows Host

Gateway routing: The Linux operating system needs to be configured

Interface configuration on Linux

On ETH0, the configured IP address is 10.172.153.72 and the mask length is 24

View the routing table

A phenomenon was found: there is no host route generated by interface route in the routing table.

This is where Linux differs from routing and Windows. If it is a native IP address, direct hit, no need to look up the routing table.

Another interesting phenomenon is that in the Linux table, the gateway is the route of 0.0.0.0, which means that the message needs to be searched inside the host. When forwarding, the destination address will be held to find the ARP form. If the corresponding MAC address cannot be found, the message will be discarded.

Click on the attention, the first time to understand Huawei cloud fresh technology ~