Home > Article > Operation and Maintenance > What is lo in linux
In Linux, lo is the abbreviation of local, which refers to the local loopback interface; this interface can be used to send and receive data within the system. Its main function is to detect the network configuration of the local machine and provide certain applications. Resources on the server need to be called during runtime.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
lo: The abbreviation of local, generally refers to the local loopback interface.
The role of the lo interface
A local process initiates a connection to the port (8085) of the intranet IP address (eth1: 10.1.1.1) monitored by a local daemon ). At this time, the packet cannot be captured on eth1. If it is captured on lo, it means that the local loopback interface lo is used, and the IP address of the network layer is the intranet IP address.
loIn fact It is a system virtual loopback interface, and its IP address is 127.0.0.1. This interface can be used to send and receive data within the system, so generally we use: ping 127.0.0.1 can be pinged, because this is actually It is to establish a connection within the system.
127.0.0.1, often called the local loop back address, does not belong to any classified address class. It represents the local virtual interface of the device, so by default it is regarded as an interface that will never go down. Usually you can ping this local loopback address without installing a network card. It is generally used to check whether the local network protocol, basic data interface, etc. are normal.
It has two main functions:
The first is to test the network configuration of the machine. If it can PING 127.0.0.1, it means that the network card and IP protocol of the machine are installed properly. No problem;
Another function is that some SERVER/CLIENT applications need to call resources on the server when running
1. Naming of the network interface
There is no certain naming convention here, but the definition of network interface names generally has to be meaningful. For example:
eth0: The abbreviation of ethernet, generally used for Ethernet interfaces.
wifi0: wifi is a wireless LAN, so wifi0 generally refers to the wireless network interface.
ath0: The abbreviation of Atheros generally refers to the wireless network interface included in the Atheros chip.
lo: The abbreviation of local, generally refers to the local loopback interface.
2. How the network interface works
The network interface is the basic device used to send and receive data packets.
All network interfaces in the system form a chain structure, which is called by name when used by application layer programs.
Each network interface corresponds to a struct net_device structure in the Linux system, including name, mac, mask, mtu... information.
Each hardware network card (a MAC) corresponds to a network interface, and its work is completely controlled by the corresponding driver.
3. Virtual network interface
The application range of virtual network interface is very wide. The most famous one is "lo". Basically every Linux system has this interface.
The virtual network interface does not actually receive and send data packets from the outside world, but receives and sends data packets within the system, so the virtual network interface does not require a driver.
Virtual network interfaces are consistent in use with real network interfaces.
4. Creation of network interface
The network interface of the hardware network card is created by the driver. The virtual network interface is created by the system or created by the application layer program.
The function to create a network interface in the driver is: register_netdev(struct net_device *) or register_netdevice(struct net_device *).
The difference between these two functions is: register_netdev(...) will automatically generate an interface with "eth" as the starting name, while register_netdevice(...) needs to specify the interface name in advance. In fact, register_netdev(...) also This is achieved by calling register_netdevice(…).
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of What is lo in linux. For more information, please follow other related articles on the PHP Chinese website!