R1和R2段是12.1.1.0/24
R2和R3段是23.1.1.0/24
R3和R4段是34.1.1.0/24
R2和R3之间运行EIGRP路由协议,发布的网段是0.0.0.0
R1设置网关地址是12.1.1.2
R4设置网关地址是34.1.13
R1的12.1.1.1要和R4和34.1.1.4发生通信,会丢一两个包,具体通信过程如下
1.R1先把对方的IP地址和自己的mask计算,然后把自己的IP地址和自己mask计算,发现不相同,就知道和自己不是同个网段的,发现自己有网关地址,
所以发送icmp包时先查询网关的mac地址,然后二层封装的源地址是自己的mac地址,目的地址是R2的F1/0的mac地址,把icmp请求包发给R2的F1/0
2.R2收到该数据包,发现是发给自己的,然后检查FCS域,没错的话,就去掉二层头部,裸露三层包头和ICMP数据,检查IP包头的校验和,没错的话,就查看目的地址
发现是34.1.1.4,然后查找FIB(FIB其实就是路由表的拷贝,是在控制层面把路由表拷贝进FIB这个硬件区域中的),并行操作,符合最长掩码符合原则,最后查找到要去34.1.1.4
要从F1/1出去,下一跳地址是23.1.13,所以自己的三层源目地址不变,然后TTL减掉一,变为254,重新计算ip包头校验和,然后二层需要封装R2的F1/1的mac地址和
R3的F1/1的mac地址,通过adj表可以直接进行mac地址重写,然后计算FCS,从R2的F1/1发送出去
R2开启debug ip packets,发现R1去ping R4是CEF传送数据包
R2#
*Feb 8 11:06:15.363: CEF: Try to CEF switch 34.1.1.4 from FastEthernet1/0
*Feb 8 11:06:15.363: CEF: CEF switched to FastEthernet1/1
*Feb 8 11:06:15.451: CEF: Try to CEF switch 12.1.1.1 from FastEthernet1/1
*Feb 8 11:06:15.451: CEF: CEF switched to FastEthernet1/0
*Feb 8 11:06:15.483: CEF: Try to CEF switch 34.1.1.4 from FastEthernet1/0
*Feb 8 11:06:15.483: CEF: CEF switched to FastEthernet1/1
*Feb 8 11:06:15.527: CEF: Try to CEF switch 12.1.1.1 from FastEthernet1/1
*Feb 8 11:06:15.527: CEF: CEF switched to FastEthernet1/0
*Feb 8 11:06:15.547: CEF: Try to CEF switch 34.1.1.4 from FastEthernet1/0
*Feb 8 11:06:15.547: CEF: CEF switched to FastEthernet1/1
*Feb 8 11:06:15.567: CEF: Try to CEF switch 12.1.1.1 from FastEthernet1/1
*Feb 8 11:06:15.567: CEF: CEF switched to FastEthernet1/0
*Feb 8 11:06:15.599: CEF: Try to CEF switch 34.1.1.4 from FastEthernet1/0
*Feb 8 11:06:15.599: CEF: CEF switched to FastEthernet1/1
*Feb 8 11:06:15.619: CEF: Try to CEF switch 12.1.1.1 from FastEthernet1/1
*Feb 8 11:06:15.619: CEF: CEF switched to FastEthernet1/0
*Feb 8 11:06:15.679: CEF: Try to CEF switch 34.1.1.4 from FastEthernet1/0
*Feb 8 11:06:15.679: CEF: CEF switched to FastEthernet1/1
*Feb 8 11:06:15.699: CEF: Try to CEF switch 12.1.1.1 from FastEthernet1/1
*Feb 8 11:06:15.699: CEF: CEF switched to FastEthernet1/0
*Feb 8 11:06:16.447: CEF: Try to CEF switch 224.0.0.10 from FastEthernet1/1
通过show ip cef查看FIB区域里面的内容
R2#sh ip cef
Prefix Next Hop Interface
0.0.0.0/0 drop Null0 (default route handler entry)
0.0.0.0/32 receive
12.0.0.0/8 0.0.0.0 Null0
12.1.1.0/24 attached FastEthernet1/0
12.1.1.0/32 receive
12.1.1.1/32 12.1.1.1 FastEthernet1/0
12.1.1.2/32 receive
12.1.1.255/32 receive
23.0.0.0/8 0.0.0.0 Null0
23.1.1.0/24 attached FastEthernet1/1
23.1.1.0/32 receive
23.1.1.2/32 receive
23.1.1.3/32 23.1.1.3 FastEthernet1/1
23.1.1.255/32 receive
34.0.0.0/8 23.1.1.3 FastEthernet1/1
224.0.0.0/4 drop
224.0.0.0/24 receive
255.255.255.255/32 receive
R2#sh adjacency detail
Protocol Interface Address
IP FastEthernet1/0 12.1.1.1(5)
8 packets, 912 bytes
CA0013FC001C
CA0113FC001C0800
ARP never
Epoch: 0
IP FastEthernet1/1 23.1.1.3(7)
10 packets, 1140 bytes
CA02030C001D
CA0113FC001D0800
ARP never
Epoch: 0
3.R3收到该数据包,检查FCS,无错,拆掉二层,裸露ip包头和icmp数据,检查ip包头检验和,无错,就查看目的地址,然后通过CEF进行相关操作,把数据包从R3的F1/0发送出去
4.R3的F1/1收到该数据包,检查FCS,无错,拆掉二层,裸露ip包头和icmp数据,检查ip包头检验和,无错,查看目的地址,发现就是从自己这里出去,然后查看mac地址,发现自己没有34.1.1.4的mac地址,所以会丢包,同时进行arp查询
、
R1会收到R2的EIGRP的数据包,是因为没有配置被动接口
这里的回应包TTL为253是因为经过了R2和R3两个路由器