Resolve problems such as central back-to-interface of network protocols

Source: Internet
Author: User
Tags block ip address

Here are some highlights of the data link layer of the network protocol. Here we mainly explain the problem of the loop interface. Loopback: a logical and Virtual Interface on the router. the router does not have any loopback interface by default. this interface allows client programs and server programs running on the same host to communicate through TCP/IP. generally, the system assigns 127.0.0.1 to this interface and name it localhost. an IP datagram sent back to the loopback interface cannot appear on any network.

The following is a simple process for the loopback interface to process IP data packets:

The key points to be pointed out in the figure are:

1) Any data sent to the loopback address 127.0.0.1 is input as an IP address.

2) copy the data transmitted to the broadcast address or multicast address and send it to the loop interface, and then to the Ethernet. This is because the definition of broadcast transfer and multicast transfer includes the host itself.

3) any data sent to the Host IP address is sent to the loopback interface.

Although the book briefly introduces this, I think there are still few introductions, so I have consulted some other materials, I think the following description may be helpful for understanding this concept. Note: The original Article ).

I. loopback interface

To identify and manage network devices such as routers and PCs, we usually use the IP addresses configured on the interfaces of these devices, including physical interfaces and logical interfaces, such as VLANs. however, although the device is not out of the network, the device cannot be managed because the interface status of its management address is down, the Interface Network Protocol cannot start ). to solve this problem, the loopback interface appears, which is a logical interface on the device, and the interface status is not affected by the physical port up/down, the interface will not be down as long as the system network protocol of the device is not faulty. by the way, although the layer-3 vlan is also a logical interface, the vlan we usually use is a port, and the core layer switch vlan is generally associated with only one port, when the port is down, the vlan interface cannot be up.

It can be seen that the loopback interface address is undoubtedly the best choice for marking the physical device itself, because as long as the device runs normally, it will always be in the up state.

2. loopback address and loopback route

The loopback address is the address set on the loopback interface, which is used to identify the device itself. class a cidr Block 127.0.0.0 is used as the local loopback address. Generally, all devices use 127.0.0.1 by default. Of course, you can also set A public IP address on the loopback interface as the device identification for the whole network.

When a device sends a data packet to itself, it sends the packet to its loopback interface and directly sends it to the cpu for processing ). but if the destination IP address is not its loopback address, how does it know that the destination IP address of the packet is its own IP address? In this case, the loopback route is required for identification. generally, the IP addresses on the pc nic and the management ip addresses of some low-end network devices point to the loopback interface by default, but many high-end devices need to manually set the loopback route. for example, if one of the interfaces of A vro is 61.175.201.54, the loopback route should be set to 61.175.201.54/32 127.0.0.1 to indicate that the address is on its own interface.

3. Application Example

For pc, the NIC of the pc is equivalent to an interface of the router. if the IP address set on a pc Nic is 220.172.115.50, the network protocol status is up when the NIC is connected normally. Enter ipconfig in the doscommand line status to view the IP address on the NIC. ping the NIC address on the host as follows: the host sends an icmp packet with the destination address 220.172.115.50 and sends a response to the host; based on the default loopback host route, the host finds that the next hop of the destination address of the data packet points to its loopback interface. The host does not know that the address is on its Nic ), then, the packet is sent to its loopback interface, that is, directly to the cpu). Then, the host receives a ping packet with the source IP address 220.172.114.50, and then replies to the packet. The response packet is also returned based on the original route of the loopback route. from this process, we can see that both the origin and the receiving point of the data packet are in the same interface, that is, the loopback interface of the host.) The addressing process is a loop process, therefore, this interface is called a "loop interface ". when the network adapter is disconnected and the network protocol is down, you can use ipconfig to find "media disconnected" and other prompts. No IP address is displayed. ping 220.172.115.50 and the following error occurs: "destination unreachable" and so on. The host cannot find the corresponding route because the NIC protocol is not up. Therefore, the host cannot make a forwarding decision, prompting that the route is inaccessible ). however, all IP addresses in the 127.0.0.0/8 CIDR block can be pinged at this time. Generally, the pc uses the 127.0.0.0/8 CIDR Block IP address as the loopback address by default, when the host finds that the destination address of the packet is its own loop address, the packet is sent directly to its cpu. from this we can see that the ping loop return address does not mean that the network card address can be pinged. Therefore, do not ping 127.0.0.1 to check whether the network card is good or bad. This will not work.

Let's take a look at the router example. for example, routers0/1 is directly connected to routerB interface s0/2, routers0/1 is 202.56.112.11, and routerB s0/2 is 202.56.112.12, neither of the two routers performs interface loopback routing. in this case, the IP address of the interface s0/1 can be pinged on the routerinterface, but tracert 202.56.112.11 finds that the packet is not directly sent to the routerinterface itself, but is sent back to the routerinterface through routerB. I was surprised when I first encountered this situation, but after I understood the concept of loop back, this doubt would naturally be solved. next let's take a look at the packet addressing process: first, the router cisco2600 or above) There is no loopback route with the default Interface address, and no manual settings are made for the two routers. therefore, when routeworker sends an icmp ping packet whose destination address is s0/1, routeworker finds the route table and does not find that the host route entry pointing to the loopback interface has a higher priority than the network route entry ), therefore, the data packet is forwarded to routerB based on the direct connection route. After receiving the data packet, routerB also forwards the data packet to the routeworker based on the direct connection route. After receiving the ping packet, routemanager responds, returns the original path of the response package. as a result, there is an interesting phenomenon: the delay of routerping itself is longer than that of routerB. therefore, many devices have manually configured local loopback routes to reduce unnecessary troubles.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.