The LO loopback interface in Linux is described in detail

Source: Internet
Author: User
Tags naming convention

1, Linux network interface of literacy

(1) Naming of network interfaces

There is no naming convention, but the definition of a network interface name is generally meaningful. For example:

Eth0:ethernet, typically used for Ethernet interfaces.

Wifi0:wifi is a wireless LAN, so wifi0 generally refers to a wireless network interface.

Ath0:atheros, generally refers to the Atheros chip contains the wireless network interface.

A shorthand for lo:local, generally referred to as a local loopback interface.

(2) How the network interface works

A network interface is the basic device used to send and receive packets.

All network interfaces in the system form a chain structure that is called by name when used by the application layer program.

Each network interface corresponds to a struct net_device struct in a Linux system, containing NAME,MAC,MASK,MTU ... Information.

Each hardware card (a Mac) corresponds to a network interface, and its work is completely controlled by the corresponding driver.

(3) Virtual network interface

Virtual network interfaces are used in a wide range of applications. The most famous is the "Lo", basically every Linux system has this interface.

The virtual network interface does not actually receive and send packets from the outside world, but it receives and sends packets inside the system, so the virtual network interface does not need drivers.

The virtual network interface and the real network interface are consistent in use.

(4) Creation of network interface

The network interface of the hardware NIC is created by the driver. Virtual network interfaces are created by the system or by application-level programs.

The functions for creating network interfaces in the drive are: Register_netdev (struct net_device *) or Register_netdevice (struct net_device *).

The difference between the two functions is: Register_netdev (...) Automatically generates an interface with "ETH" as the heading name, while Register_netdevice (...) The interface name needs to be specified in advance. In fact, Register_netdev (...) Also by calling Register_netdevice (...) Implemented.

2. Lo (loopback interface) in Linux

1) What is the Lo interface?

In Linux systems, in addition to the network interface eth0, there can be other interfaces, such as LO (local loop interface).

2) What is the function of the Lo interface?

If a package is generated by a local process for another local process, they will pass the ' Lo ' interface on the out chain and then return to the ' Lo ' interface of the chain. Refer to the relevant contents of the packet filter.

PART2 Experiment:

A local process initiates a connection to a local daemon listening network IP address (eth1:10.1.1.1) port (8085), at which point the packet is not caught on the eth1, caught on lo, indicating that the local loopback interface lo is used, The IP address of the network layer is the intranet IP address.

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.