Example for Configuring Layer 2 Topology Detection
Networking Requirements
As shown in Figure 2-15, two Ethernet interfaces are added to VLAN100 in default mode. To view changes of ARP entries, configure Layer 2 topology detection.
Configuration Roadmap
The configuration roadmap is as follows:
Add two Ethernet interfaces to VLAN100 in default mode.
Enable Layer 2 topology detection to view changes of ARP entries.
Procedure
- Create VLAN100 and add two Ethernet interfaces to VLAN100 in default mode.
# Create VLAN100 and configure an IP address for the VLANIF interface.
<Huawei> system-view [Huawei] sysname Router [Router] vlan 100 [Router-vlan100] quit [Router] interface vlanif 100 [Router-Vlanif100] ip address 10.1.1.2 24 [Router-Vlanif100] quit
# Add two Ethernet interfaces to VLAN100 in default mode.
[Router] interface ethernet 2/0/0 [Router-Ethernet2/0/0] port link-type access [Router-Ethernet2/0/0] port default vlan 100 [Router-Ethernet2/0/0] quit [Router] interface ethernet 2/0/1 [Router-Ethernet2/0/1] port link-type access [Router-Ethernet2/0/1] port default vlan 100 [Router-Ethernet2/0/1] quit
- Enable Layer 2 topology detection.
[Router] l2-topology detect enable
- Restart Ethernet2/0/0 and view changes of ARP entries and aging time.
# View ARP entries on the router. You can find the router has learned the MAC address of the PC.
[Router] display arp all IP ADDRESS MAC ADDRESS EXPIRE(M) TYPE INTERFACE VPN-INSTANCE VLAN/CEVLAN PVC ----------------------------------------------------------------------------- 10.1.1.2 00e0-fc1a-4900 I - Vlanif100 10.1.1.1 00e0-fc1a-4901 20 D-0 Ethernet2/0/0 10.1.1.3 00e0-fc24-bf04 20 D-0 Ethernet2/0/1 ----------------------------------------------------------------------------- Total:3 Dynamic:2 Static:0 Interface:1
After 1 minute, run the shutdown command to shut down Ethernet2/0/0, simulate an interface fault, and check the aging time of ARP entries. The command output shows that the ARP entries learned from Ethernet2/0/0 are deleted after Ethernet2/0/0 is shut down.[Router] interface ethernet 2/0/0 [Router-Ethernet2/0/0] shutdown [Router-Ethernet2/0/0] display arp all IP ADDRESS MAC ADDRESS EXPIRE(M) TYPE INTERFACE VPN-INSTANCE VLAN/CEVLAN PVC ---------------------------------------------------------------------------- 10.1.1.2 00e0-fc1a-4900 I - Vlanif100 10.1.1.3 00e0-fc24-bf04 19 D-0 Ethernet2/0/1 ------------------------------------------------------------------------------ Total:2 Dynamic:1 Static:0 Interface:1
# Run the undo shutdown command to restart Ethernet2/0/0 and check the aging time of ARP entries. The command output shows that Ethernet2/0/0 and Ethernet2/0/1 in VLAN100 update ARP entries after Ethernet2/0/0 is restarted and becomes Up.[Router] display arp all IP ADDRESS MAC ADDRESS EXPIRE(M) TYPE INTERFACE VPN-INSTANCE VLAN/CEVLAN PVC ----------------------------------------------------------------------------- 10.1.1.2 00e0-fc1a-4900 I - Vlanif100 10.1.1.1 00e0-fc1a-4901 20 D-0 Ethernet2/0/0 10.1.1.3 00e0-fc24-bf04 20 D-0 Ethernet2/0/1 ----------------------------------------------------------------------------- Total:3 Dynamic:2 Static:0 Interface:1
Configuration Files
Configuration file of the router
# sysname Router # l2-topolgy detect enable # vlan batch 100 # interface Vlanif100 ip address 10.1.1.2 255.255.255.0 # interface Ethernet2/0/0 port link-type access port default vlan 100 # interface Ethernet2/0/1 port link-type access port default vlan 100 # return