show ip arp命令可以得到IP地址与MAC地址的对应关系,show mac-address-table可以得到MAC地址与端口的对应关系,根据这两组对应关系,我们就可以得到IP地址与端口的对应关系。
命令总结:
1.静态绑定arp表项后,无老化时间
R2(config)#
arp 192.168.1.2
cc01.0614.0000
arpa
2.show ip arp ---查看arp表
R2#
show ip arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 192.168.1.1 1 cc00.0614.0000 ARPA FastEthernet0/0
Internet 192.168.1.2 - cc01.0614.0000 ARPA
Internet 192.168.1.3 0 cc02.0614.0000 ARPA FastEthernet0/0
Internet 192.168.1.4 1 cc03.0614.0000 ARPA FastEthernet0/0
R2#
3.
show mac-address-table ---查看mac-address-table,适用于二层接口
4.修改arp老化时间
R2(config)#int f0/0
R2(config-if)#
arp timeout ?
<0-2147483> Seconds
5.静态绑定mac-address-table
R1(config)#
mac-address-table static cc01.0614.0000
interface fastEthernet 1/2
vlan 2
6.清除arp缓存,刷新arp表
R1#
clear arp-cache ?
A.B.C.D IP address
interface Clear the entire ARP cache on the interface
vrf Clear entries for a VPN Routing/Forwarding instance
<cr>
R1#
clear arp-cache interface fastEthernet 1/2
R1#
7.no mac-address-table static 后需要刷新mac-address-table
clear mac-address-table