show mac-add和show ip arp命令
我们在交换机执行show mac-add命令可以得MAC地址与端口的对应关系,如下所示:
3550#show mac-add
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
1 0001.7a48.733b DYNAMIC Fa0/14
1 0001.7a48.9707 DYNAMIC Fa0/10
1 0001.7a4a.7015 DYNAMIC Fa0/8
1 0001.965a.b4d0 DYNAMIC Fa0/2
1 000b.5fb2.7197 DYNAMIC Fa0/19
1 000f.e207.f2e0 DYNAMIC Fa0/17
2 0001.7a53.2aab DYNAMIC Fa0/20
2 0001.965a.b4c0 DYNAMIC Fa0/2
2 0001.965a.b4d0 DYNAMIC Fa0/2
2 0050.ba08.7e55 DYNAMIC Fa0/2
2 00c0.9f32.66e1 DYNAMIC Fa0/2
2 1223.3212.3212 DYNAMIC Fa0/2
3 000b.5fb2.7197 DYNAMIC Fa0/19
3 0800.20c4.0460 DYNAMIC Fa0/4
4 0001.965a.b4d0 DYNAMIC Fa0/2
4 0002.8a36.1194 DYNAMIC Fa0/8
4 0003.0d2b.ebb0 DYNAMIC Fa0/8
4 0003.0ffb.6850 DYNAMIC Fa0/8
执行show ip arp命令可以得到IP地址与MAC地址的对应关系,如下所示
3550#show ip arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 10.13.0.7 4 001b.b95c.6879 ARPA Vlan113
Internet 10.60.0.54 7 1000.0210.2020 ARPA Vlan60
Internet 10.15.0.5 9 00a1.b013.bd07 ARPA Vlan115
Internet 192.168.1.104 0 Incomplete ARPA
Internet 10.13.0.6 0 0015.c567.3f51 ARPA Vlan113
Internet 10.63.0.52 0 001a.4d73.010d ARPA Vlan63
Internet 10.62.0.53 2 00e0.4c10.83f5 ARPA Vlan62
Internet 10.15.0.4 3 00d0.f801.8bbf ARPA Vlan115
Internet 10.60.0.55 6 1000.0332.5404 ARPA Vlan60
Internet 10.7.0.12 73 0014.2a17.c918 ARPA Vlan107
Internet 10.14.0.6 0 00c9.0002.c065 ARPA Vlan114
Internet 192.168.1.107 0 Incomplete ARPA
Internet 10.9.0.1 - 000d.bc04.1b00 ARPA Vlan109
Internet 10.15.6.1 5 0016.e645.8929 ARPA Vlan115
Internet 192.168.5.111 47 001d.7d77.fb35 ARPA Vlan4
Internet 10.66.6.253 0 0001.7a53.2aab ARPA Vlan2
根据这两组对应关系,我们就可以得到IP地址与端口的对应关系
比如本例中我们要确认IP地址为10.66.6.253的这台网络设备是接在交换机的哪个端口上,就可以先查看10.66.6.253对应的MAC地址为0001.7a53.2aab,而0001.7a53.2aab这个MAC地址对应的端口为fa0/20
Internet 10.66.6.253 0 0001.7a53.2aab ARPA Vlan2
2 0001.7a53.2aab DYNAMIC Fa0/20
这样就得到了IP地址与端口的对应关系,即10.66.6.253这台网络设备是连接到交换机的第20端口上。
温馨提示:答案为网友推荐,仅供参考