CCNA学习笔记8--ARP(标准ARP)
知识点1:APR分为四类
(address revolution protocol地址解析协议)
解析的是IP地址还是MAC地址?
答:解析的是MAC地址
1. 标准的ARP
2. 无故ARP
3. 代理ARP
4. 反向ARP (不讲)
知识点2:ARP表基本包含的信息
发送者IP
发送者MAC
目标IP
目标MAC
知识点3:通过实验学习ARP工作原理
实验拓扑
实验描述
R1 ping R2,为什么第一次ping中,第一个包一定会丢
实验操作
1.基本配置 Router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)#enable password cisco Router(config)#no ip domain lookup Router(config)#line console 0 Router(config-line)#password cisco Router(config-line)#logging synchronous Router(config-line)#exec-timeout 0 0 Router(config-line)#exit Router(config)#line vty 0 4 Router(config-line)#password cisco Router(config-line)#logging synchronous Router(config-line)#exit Router(config)#hostname R1 R1(config)#exit R1# *May 19 02:38:22.257: %SYS-5-CONFIG_I: Configured from console by console R1#wr Building configuration... [OK] |
2.配ip地址 R1(config)#interface ethernet 0/0 R1(config-if)#ip address 10.0.12.1 255.255.255.0 R1(config-if)#no shutdown R2(config)#interface ethernet 0/0 R2(config-if)#ip address 10.0.12.2 255.255.255.0 R2(config-if)#no shutdown |
3.在R1的interface e0/0端口开启抓包 |
4.R1 ping R2 第一个包被丢弃 R1#ping 10.0.12.2 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.0.12.2, timeout is 2 seconds: .!!!! Success rate is 80 percent (4/5), round-trip min/avg/max = 1/1/1 ms |
5.查看R1和R2上的MAC地址 R1#show interfaces ethernet 0/0 Ethernet0/0 is up, line protocol is up Hardware is AmdP2, address is aabb.cc00.1000 (bia aabb.cc00.1000) Internet address is 10.0.12.1/24 R2#show interfaces ethernet 0/0 Ethernet0/0 is up, line protocol is up Hardware is AmdP2, address is aabb.cc00.2000 (bia aabb.cc00.2000) Internet address is 10.0.12.2/24 R2#show interfaces ethernet 0/0 | include Ha Hardware is AmdP2, address is aabb.cc00.2000 (bia aabb.cc00.2000) |
6. 查看ARP表 R1#show arp Protocol Address Age (min) Hardware Addr Type Interface Internet 10.0.12.1 - aabb.cc00.1000 ARPA Ethernet0/0 Internet 10.0.12.2 20 aabb.cc00.2000 ARPA Ethernet0/0 R2#show arp Protocol Address Age (min) Hardware Addr Type Interface Internet 10.0.12.1 21 aabb.cc00.1000 ARPA Ethernet0/0 Internet 10.0.12.2 - aabb.cc00.2000 ARPA Ethernet0/0 |
3. 删除ARP表 R2#clear arp-cache (由于模拟器的原因,用完清除ARP表缓存的命令,依旧可以查看。为了看到我们实验的效果,把端口shutdown然后再no shutdown即可) |
实验讲解
首先,R1 ping R2第一次执行的时候,R1并不知道R2的MAC地址。发送一个请求信息,信息包含,寻求IP地址是10.0.12.2的MAC,在目的地解封装为广播帧,目标MAC设置为全0.
然后R2收到广播帧,发现ip地址对的上,给R1发送一条带有自己MAC的消息。
R1收到后,把R2的MAC记录下来,放在ARP表中。
R1再发送ping包的时候,就是含有R2 MAC地址的包
(要能筛选出抓出的包包含的信息)