通过ARP实现二层拓扑探测配置示例 ' H$ Q+ t* A$ u, D/ _; R! b2 `
1、组网需求
手把手教你 通过ARP实现二层拓扑探测配置示例
图1 ARP实现二层拓扑探测示例 如上图1所示,两个GE接口加入VLAN100,两个GE口所连主机的IP地址如图所示。 : j: C+ w3 ]' c: B0 ~, w5 S& p
2、配置思路0 a$ g# s! V3 n: W* l
2.1、配置两个GE接口的缺省VLAN配置为VLAN 100。 2.2、使能二层拓扑探测功能,查看ARP表项的变化。 ( u% x6 R/ H) p5 z8 b; M5 m
3、操作步骤
" R0 Z* _* T$ d" B; o3 L3.1、创建VLAN 100,并配置Switch的两个GE接口加入VLAN 100。 # 创建VLAN100,配置VLANIF接口的IP地址。 <HUAWEI> system-view [HUAWEI] vlan 100 [HUAWEI-vlan100] quit [HUAWEI] interface vlanif 100 [HUAWEI-Vlanif100] ip address 10.1.1.2 24 [HUAWEI-Vlanif100] quit
; J3 n; d: A# D3 Z( U, t# 配置GE接口加入VLAN100。 [HUAWEI] interface gigabitethernet 1/0/1 [HUAWEI-GigabitEthernet1/0/1] port link-type access [HUAWEI-GigabitEthernet1/0/1] port default vlan 100 [HUAWEI-GigabitEthernet1/0/1] quit [HUAWEI] interface gigabitethernet 1/0/2 [HUAWEI-GigabitEthernet1/0/2] port link-type access [HUAWEI-GigabitEthernet1/0/2] port default vlan 100 [HUAWEI-GigabitEthernet1/0/2] quit . n& C9 [6 Y& J) e0 i
3.2、使能二层拓扑探测功能。 [HUAWEI] l2-topology detect enable
- H, k0 O. h) Q) t. b3 k3.3、重启接口GE1/0/1,并查看ARP表项及老化时间的变化。 # 从Switch上分别Ping网段10.1.1.1和10.1.1.3内的主机后,查看Switch的ARP表项,可以看到Switch已经学习到了PC的MAC地址。 [HUAWEI] ping 10.1.1.1 PING 10.1.1.3: 56 data bytes, press CTRL_C to break Reply from 10.1.1.1: bytes=56 Sequence=1 ttl=255 time=10 ms Reply from 10.1.1.1: bytes=56 Sequence=2 ttl=254 time=1 ms Reply from 10.1.1.1: bytes=56 Sequence=3 ttl=254 time=1 ms Reply from 10.1.1.1: bytes=56 Sequence=4 ttl=254 time=1 ms Reply from 10.1.1.1: bytes=56 Sequence=5 ttl=254 time=1 ms --- 10.1.1.1 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 1/2/10 ms [HUAWEI] ping 10.1.1.3 PING 10.1.1.3: 56 data bytes, press CTRL_C to break Reply from 10.1.1.3: bytes=56 Sequence=1 ttl=255 time=10 ms Reply from 10.1.1.3: bytes=56 Sequence=2 ttl=254 time=1 ms Reply from 10.1.1.3: bytes=56 Sequence=3 ttl=254 time=1 ms Reply from 10.1.1.3: bytes=56 Sequence=4 ttl=254 time=1 ms Reply from 10.1.1.3: bytes=56 Sequence=5 ttl=254 time=1 ms --- 10.1.1.3 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 1/2/10 ms [HUAWEI] display arp all IP ADDRESS MAC ADDRESS EXPIRE(M) TYPE INTERFACE VPN-INSTANCE VLAN/CEVLAN ----------------------------------------------------------------------------- 10.1.1.2 00e0-c01a-4900 I - Vlanif100 10.1.1.1 00e0-c01a-4901 20 D-0 GE1/0/1 100 10.1.1.3 00e0-de24-bf04 20 D-0 GE1/0/2 100 ----------------------------------------------------------------------------- Total:3 Dynamic:2 Static:0 Interface:1 ! z! ?; y: V$ \
# 依次shutdown、undo shutdown接口GE1/0/1,并查看ARP表项的老化时间。 shutdown接口GE1/0/1,查看ARP表项的老化超时时间。 [HUAWEI] interface gigabitethernet 1/0/1 [HUAWEI-GigabitEthernet1/0/1] shutdown [HUAWEI-GigabitEthernet1/0/1] display arp all IP ADDRESS MAC ADDRESS EXPIRE(M) TYPE INTERFACE VPN-INSTANCE VLAN/CEVLAN ---------------------------------------------------------------------------- 10.1.1.2 00e0-c01a-4900 I - Vlanif100 10.1.1.3 00e0-de24-bf04 18 D-0 GE1/0/2 100 ------------------------------------------------------------------------------ Total:2 Dynamic:1 Static:0 Interface:1
3 s/ X _* D3 z* L6 h# V) Y" Mundo shutdown接口GE1/0/1,从Switch上Ping网段10.1.1.1内的主机后,查看ARP表项的老化超时时间。 [HUAWEI] interface gigabitethernet 1/0/1 [HUAWEI-GigabitEthernet1/0/1] undo shutdown [HUAWEI-GigabitEthernet1/0/1] quit [HUAWEI] ping 10.1.1.1 PING 10.1.1.3: 56 data bytes, press CTRL_C to break Reply from 10.1.1.1: bytes=56 Sequence=1 ttl=255 time=10 ms Reply from 10.1.1.1: bytes=56 Sequence=2 ttl=254 time=1 ms Reply from 10.1.1.1: bytes=56 Sequence=3 ttl=254 time=1 ms Reply from 10.1.1.1: bytes=56 Sequence=4 ttl=254 time=1 ms Reply from 10.1.1.1: bytes=56 Sequence=5 ttl=254 time=1 ms --- 10.1.1.1 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max = 1/2/10 ms [HUAWEI] display arp all IP ADDRESS MAC ADDRESS EXPIRE(M) TYPE INTERFACE VPN-INSTANCE VLAN/CEVLAN ----------------------------------------------------------------------------- 10.1.1.2 00e0-c01a-4900 I - Vlanif100 10.1.1.1 00e0-c01a-4901 20 D-0 GE1/0/1 100 10.1.1.3 00e0-de24-bf04 20 D-0 GE1/0/2 100 ----------------------------------------------------------------------------- Total:3 Dynamic:2 Static:0 Interface:1 ) q. n F- S3 B; S% M
由输出信息可以看到,GE1/0/1被shutdown之后,从GE1/0/1学习到的ARP表项被删除。GE1/0/1被undo shutdown,接口状态重新变为Up后,从GE1/0/2学习到的ARP表项被老化。此时,设备会发送ARP探测报文,更新从GE1/0/2学习到的ARP表项,表项更新后,老化超时时间重新变为默认值20(分钟)。
2 o" i) M3 S3 c0 @* y9 b4、配置文件
% W7 ?, a- F; j6 d& e, FSwitch的配置文件 # sysname HUAWEI # l2-topology detect enable # vlan batch 100 # interface Vlanif100 ip address 10.1.1.2 255.255.255.0 # interface GigabitEthernet1/0/1 port link-type access port default vlan 100 # interface GigabitEthernet1/0/2 port link-type access port default vlan 100 # return
' y8 g9 N q) i. k7 a4 [9 r' C |