18Configuring loopback and null interfacesConfiguring a loopback interfaceIntroduction to the loopback interfaceA loopback interface is a software-only virtual interface. It delivers the following benefits:• The physical layer state and link-layer protocols of a loopback interface are always up unless theloopback interface is manually shut down.• To save IP address resources, you can assign an IP address with an all-F mask to a loopbackinterface. When you assign an IPv4 address whose mask is not 32-bit, the system automaticallychanges the mask into a 32-bit mask. When you assign an IPv6 address whose mask is not 128-bit,the system automatically changes the mask into a 128-bit mask.• You can enable routing protocols on a loopback interface, and a loopback interface can send andreceive routing protocol packets.Because of the benefits mentioned above, loopback interfaces are widely used in the followingscenarios:• You can configure a loopback interface address as the source address of the IP packets that thedevice generates. Because loopback interface addresses are stable unicast addresses, they areusually used as device identifications. When you configure a rule on an authentication or securityserver to permit or deny packets generated by a device, you can simplify the rule by configuring itto permit or deny packets that carry the loopback interface address identifying the device. Whenyou use a loopback interface address as the source address of IP packets, be sure to perform anynecessary routing configuration to make sure that the route from the loopback interface to the peeris reachable. All data packets sent to the loopback interface are treated as packets sent to thedevice itself, so the device does not forward these packets.• Because a loopback interface is always up, it can be used in dynamic routing protocols. Forexample, if you do not configure a router ID for a dynamic routing protocol, the highest loopbackinterface IP address is selected as the router ID. In BGP, to prevent physical port failure frominterrupting BGP sessions, you can use a loopback interface as the source interface of BGP packets.Configuration procedureStep Command Remarks1. Enter system view. system-view N/A2. Create a loopback interfaceand enter loopback interfaceview.interface loopbackinterface-number N/A3. Set the interface description. description textOptionalBy default, the description of a loopbackinterface is interface name Interface.