Network Requirements
- Device1 and Device2 are directly connected, and Device2 has two L2 Ethernet interfaces which form a self-loop.
- On Device1, loopback detection has been enabled.
- After Device1 detects a loop, it closes the interconnected Ethernet interfaces to eliminate the loop.
Network Topology
Figure 10-1 Networking for Configuring the Remote Loopback Detection Function
Configuration Steps of L2 Ethernet Interface
Step 1: Configure VLANs, and configure the link type of the L2 Ethernet interface.
#On Device1, create VLAN2.
Device1#configure terminal
Device1(config)#vlan 2
Device1(config-vlan2)#exit
|
#On Device1, configure the link type of L2 Ethernet interface gigabitethernet0/1 to Trunk and allow services of VLAN2 to pass.
Device1(config)#interface gigabitethernet 0/1
Device1(config-if-gigabitethernet0/1)#switchport mode trunk
Device1(config-if-gigabitethernet0/1)#switchport trunk allowed vlan add 2
Device1(config-if-gigabitethernet0/1)#exit
|
#On Device2, create VLAN2.
Device2#configure terminal
Device2(config)#vlan 2
Device2(config-vlan2)#exit
|
#On Device2, configure the link type of L2 Ethernet interface gigabitethernet0/1, gigabitethernet0/2, and gigabitethernet0/3 to Trunk and allow the services of VLAN2 to pass. Configure the L2 Ethernet interface gigabitethernet0/2 and gigabitethernet0/3 to close the spanning tree.
Device2(config)#interface gigabitethernet 0/1-0/3
Device2(config-if-range)#switchport mode trunk
Device2(config-if-range)#no switchport trunk allowed vlan 1
Device2(config-if-range)#switchport trunk allowed vlan add 2
Device2(config-if-range)#exit
Device2(config)#interface gigabitethernet 0/2-0/3
Device2(config-if-range)#no spanning-tree enable
Device2(config-if-range)#exit
|
Step 2: Enable the loopback detection function.
#On Device1, enable the loopback detection function globally.
Device1(config)#loopback-detection enable
|
#On Device1, query the loopback detection status.
Device1#show loopback-detection
------------------------------------------------------------
Global loopback-detection : ENABLE
------------------------------------------------------------
Interface Loopback Time(s) State Control
------------------------------------------------------------
gi0/1 DISABLE 30 NORMAL TRUE
gi0/2 DISABLE 30 NORMAL TRUE
#The L2 Ethernet interface gigabitethernet0/1 of Device1 enables the loopback detection function.
Device1(config)#interface gigabitethernet 0/1
Device1(config-if-gigabitethernet0/1)#loopback-detection enable
Device1(config-if-gigabitethernet0/1)#exit
|
Step 3: Check the result.
#On Device1, query the loopback detection status. After a loop is detected:
Device1#show loopback-detection
-------------------------------------------------------
Global loopback-detection : ENABLE
-------------------------------------------------------
Interface Loopback Time(s) State Control
-------------------------------------------------------
gi0/1 ENABLE 30 ERR-DISABLE TRUE
gi0/2 DISABLE 30 NORMAL TRUE
#A loop has been detected on Device1. The L2 Ethernet interface gigabitethernet0/1 is closed, and the device outputs the following prompt information:
Jul 30 2014 03:30:30: %LOOP-BACK-DETECTED : loop-back send tag packet in vlan2 on gigabitethernet0/1, detected in vlan2 from gigabitethernet0/1
Jul 30 2014 03:30:30: %LINK-INTERFACE_DOWN-4: interface gigabitethernet0/1, changed state to down
Jul 30 2014 03:30:30: %LINEPROTO-5-UPDOWN : gigabitethernet0/1 link-status changed to err- disable
|
#On Device1, query the status of L2 Ethernet interface gigabitethernet0/1, and you will find that the link status of the L2 Ethernet interface gigabitethernet0/1 is changed to Down.
Device1#show interface gigabitethernet 0/1
gigabitethernet0/1 configuration information
Description :
Status : Enabled
Link : Down (Err-disabled)
Set Speed : Auto
Act Speed : Unknown
Set Duplex : Auto
Act Duplex : Unknown
Set Flow Control : Off
Act Flow Control : Off
Mdix : Auto
Mtu : 1824
Port mode : LAN
Port ability : 10M HD,10M FD,100M HD,100M FD,1000M FD
Link Delay : No Delay
Storm Control : Unicast Disabled
Storm Control : Broadcast Disabled
Storm Control : Multicast Disabled
Storm Action : None
Port Type : Nni
Pvid : 1
Set Medium : Copper
Act Medium : Copper
Mac Address : 0000.0000.008b
Configuration Steps of L3 Ethernet Interface
Step 1: Configure VLAN, and configure the link type of the L2 Ethernet interface.
#Create VLAN2 on Device2.
Device2#configure terminal
Device2(config)#vlan 2
Device2(config-vlan2)#exit
|
#On Device2, configure the link type of L2 Ethernet interface gigabitethernet0/1, gigabitethernet0/2, and gigabitethernet0/3 to Trunk and allow the services of VLAN2 to pass. Configure the L2 Ethernet interface gigabitethernet0/2 and gigabitethernet0/3 to close the spanning tree.
Device2(config)#interface gigabitethernet 0/1-0/3
Device2(config-if-range)#switchport mode trunk
Device2(config-if-range)#no switchport trunk allowed vlan 1
Device2(config-if-range)#switchport trunk allowed vlan add 2
Device2(config-if-range)#switchport trunk pvid vlan 2
Device2(config-if-range)#exit
Device2(config)#interface gigabitethernet 0/2-0/3
Device2(config-if-range)#no spanning-tree enable
Device2(config-if-range)#exit
|
Step 2: Enable the loopback detection function.
#On Device1, enable the loopback detection function globally.
Device1(config)#loopback-detection enable
|
#On Device1, view the loopback detection status.
Device1#show loopback-detection
-----------------------------------------------------
Global loopback-detection : ENABLE
-----------------------------------------------------
Interface Loopback Time(s) State Control
-----------------------------------------------------
gi0/1 DISABLE 30 NORMAL TRUE
gi0/2 DISABLE 30 NORMAL TRUE
#On Device1, configure the L2 Ethernet interface gigabitethernet0/1 as L3 Ethernet interface.
Device1(config)#interface gigabitethernet 0/1
Device1(config-if-gigabitethernet0/1)#no switchport
|
#The L3 Ethernet interface gigabitethernet0/1 on Device1 enables the loopback detection function.
Device1(config-if-gigabitethernet0/1)#loopback-detection enable
Device1(config-if-gigabitethernet0/1)#exit
|
Step 3: Check the result.
#On Device1, query the loopback detection status.
After a loop is detected:
Device1#show loopback-detection
-----------------------------------------------------
Global loopback-detection : ENABLE
-----------------------------------------------------
Interface Loopback Time(s) State Control
-----------------------------------------------------
gi0/1 ENABLE 30 ERR-DISABLE TRUE
gi0/2 DISABLE 30 NORMAL TRUE
#A loop has been detected on Device1. The L2 Ethernet interface gigabitethernet0/1 is closed, and the device outputs the following prompt information:
Jul 31 2014 11:29:30: %LOOP-BACK-DETECTED : loop-back send packet on gigabitethernet0/1, detected from gigabitethernet0/1
Jul 31 2014 11:29:30: %LINEPROTO-5-UPDOWN : gigabitethernet0/1 link-status changed to err- disable
Jul 31 2014 11:29:30: %LINK-INTERFACE_DOWN-3: Interface gigabitethernet0/1, changed state to down.
Jul 31 2014 11:29:30: %LINK-LINEPROTO_DOWN-3: Line protocol on interface gigabitethernet0/1, changed state to down.
|
#On Device1, view the status of the L3 Ethernet interface gigabitethernet0/1 and you can see that the status of the L3 Ethernet interface changes to err-disabled.
Device1#show interface gigabitethernet 0/1 status err-disabled
Interface Status Reason
--------------------------------------------------------------
gi0/1 err-disabled loopback-detect