Configuring a Loopback Interface
Context
A loopback interface has the following features:
- Is always Up and has the loopback feature.
- Can be configured with the mask of all 1s.
Based on the preceding features, the loopback interface has the following applications.
- The IP address of a loopback interface is specified as the source address of packets to improve network reliability.
- When no router ID is configured for dynamic routing protocols, the maximum IP address of the loopback interface is automatically configured as the router ID.
- The loopback interface is configured as the source interface to send Border Gateway Protocol (BGP) packets to ensure that the BGP session functions properly when the physical interface is faulty.
- The loopback interface can be configured with the mask of 255.255.255.255 to save IP address resources.
- The loopback interface can be assigned an IPv4 address and configured to check the source IPv4 addresses of packets.
Pre-Configuration
Before configuring a loopback interface, power on the device and perform self-check.
Procedure
- Run system-view
The system view is displayed.
- Run interface loopback loopback-number
A loopback interface is created and the loopback interface view is displayed.
You can create or delete a loopback interface dynamically. After a loopback interface is created, the link-layer protocol is always Up unless the loopback interface is deleted.
- Run ip address ip-address { mask | mask-length } [ sub ]
The IP address of the loopback interface is configured.
- (Optional) Run ip verify source-address
The loopback interface is configured to check the source IPv4 addresses of packets.