数据链路层 抓包观察 以太网 PPP HDLC数据链路层封装

网友投稿 754 2022-11-30

数据链路层 抓包观察 以太网 PPP HDLC数据链路层封装

数据链路层 抓包观察 以太网 PPP HDLC数据链路层封装

[Huawei]display interface Serial 2/0/0Serial2/0/0 current state : UPLine protocol current state : UPLast line protocol up time : 2021-10-10 16:15:22 UTC-08:00Description:HUAWEI, AR Series, Serial2/0/0 InterfaceRoute Port,The Maximum Transmit Unit is 1500, Hold timer is 10(sec)Internet protocol processing : disabledLink layer protocol is PPP ####### 使用的是ppp协议LCP opened

可以看到这段链路使用的是ppp协议,那么这段链路的Serial 2/0/1也必须得是ppp协议,要不然数据链路层协议不一样,不能通。这就是数据链路层故障。

[Huawei]display interface Serial 2/0/1Serial2/0/1 current state : UPLine protocol current state : UPLast line protocol up time : 2021-10-10 16:15:22 UTC-08:00Description:HUAWEI, AR Series, Serial2/0/1 InterfaceRoute Port,The Maximum Transmit Unit is 1500, Hold timer is 10(sec)Internet protocol processing : disabledLink layer protocol is PPPLCP opened

可以看到数据链路层不同的协议,同样是一条物理线路,可以是ppp,hdlc ..........等协议

[Huawei]interface Serial 2/0/1[Huawei-Serial2/0/1]link-protocol ? fr Select FR as line protocol hdlc Enable HDLC protocol lapb LAPB(X.25 level 2 protocol) ppp Point-to-Point protocol sdlc SDLC(Synchronous Data Line Control) protocol x25 X.25 protocol

改为hdlc协议 ,可以看到这个口子就down了,也就不工作了。

[Huawei-Serial2/0/1]link-protocol hdlcWarning: The encapsulation protocol of the link will be changed. Continue? [Y/N]:yOct 10 2021 16:27:55-08:00 Huawei %%01IFNET/4/CHANGE_ENCAP(l)[0]:The user performed the configuration that will change the encapsulation protocol of the link and then selected Y. [Huawei-Serial2/0/1][Huawei-Serial2/0/1]Oct 10 2021 16:27:55-08:00 Huawei %%01PPP/4/PHYSICALDOWN(l)[1]:On the interface Serial2/0/1, PPP link was closed because the status of the physical layer was Down. [Huawei-Serial2/0/1]Oct 10 2021 16:27:55-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[2]:The line protocol PPP on the interface Serial2/0/1 has entered the DOWN state.

可以看到ping也不通了

改为ppp协议,可以看到接口就起来了

[Huawei-Serial2/0/1]link-protocol pppWarning: The encapsulation protocol of the link will be changed. Continue? [Y/N]:y[Huawei-Serial2/0/1]Oct 10 2021 16:31:25-08:00 Huawei %%01IFNET/4/CHANGE_ENCAP(l)[7]:The user performed the configuration that will change the encapsulation protocol of the link and then selected Y. [Huawei-Serial2/0/1]Oct 10 2021 16:31:25-08:00 Huawei %%01IFPDT/4/IF_STATE(l)[8]:Interface Serial2/0/1 has turned into DOWN state.[Huawei-Serial2/0/1]Oct 10 2021 16:31:25-08:00 Huawei %%01IFPDT/4/IF_STATE(l)[9]:Interface Serial2/0/1 has turned into UP state.[Huawei-Serial2/0/1]Oct 10 2021 16:31:25-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[10]:The line protocol PPP on the interface Serial2/0/1 has entered the UP state.

现在不同的链路使用不用的协议

AR2接口 Serial 2/0/0 使用hdlc协议

[R2]interface Serial 2/0/0[R2-Serial2/0/0]link-protocol hdlcWarning: The encapsulation protocol of the link will be changed. Continue? [Y/N]:yOct 10 2021 16:47:58-08:00 R2 %%01IFNET/4/CHANGE_ENCAP(l)[2]:The user performed the configuration that will change the encapsulation protocol of the link and then selected Y. [R2-Serial2/0/0][R2-Serial2/0/0]Oct 10 2021 16:47:58-08:00 R2 %%01PPP/4/PHYSICALDOWN(l)[3]:On the interface Serial2/0/0, PPP link was closed because the status of the physical layer was Down. [R2-Serial2/0/0]Oct 10 2021 16:47:58-08:00 R2 %%01IFNET/4/LINK_STATE(l)[4]:The line protocol PPP on the interface Serial2/0/0 has entered the DOWN state. [R2-Serial2/0/0]Oct 10 2021 16:47:58-08:00 R2 %%01IFNET/4/LINK_STATE(l)[5]:The line protocol PPP IPCP on the interface Serial2/0/0 has entered the DOWN state. [R2-Serial2/0/0]Oct 10 2021 16:47:58-08:00 R2 %%01IFPDT/4/IF_STATE(l)[6]:Interface Serial2/0/0 has turned into DOWN state.[R2-Serial2/0/0]Oct 10 2021 16:47:58-08:00 R2 %%01IFPDT/4/IF_STATE(l)[7]:Interface Serial2/0/0 has turned into UP state.[R2-Serial2/0/0]Oct 10 2021 16:47:58-08:00 R2 %%01IFNET/4/LINK_STATE(l)[8]:The line protocol IP on the interface Serial2/0/0 has entered the UP state.

AR3接口  Serial  2/0/1 使用hdlc协议

[R3]interface Serial 2/0/1[R3-Serial2/0/1]link-protocol hdlcWarning: The encapsulation protocol of the link will be changed. Continue? [Y/N]:yOct 10 2021 16:50:08-08:00 R3 %%01IFNET/4/CHANGE_ENCAP(l)[0]:The user performed the configuration that will change the encapsulation protocol of the link and then selected Y. [R3-Serial2/0/1]Oct 10 2021 16:50:08-08:00 R3 %%01IFPDT/4/IF_STATE(l)[1]:Interface Serial2/0/1 has turned into DOWN state.[R3-Serial2/0/1]Oct 10 2021 16:50:09-08:00 R3 %%01IFPDT/4/IF_STATE(l)[2]:Interface Serial2/0/1 has turned into UP state.[R3-Serial2/0/1]Oct 10 2021 16:50:09-08:00 R3 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP on the interface Serial2/0/1 has entered the UP state.

现在AR2去ping AR3 Serial  2/0/1接口地址11.0.0.2

[R2-Serial2/0/0]ping 11.0.0.2 PING 11.0.0.2: 56 data bytes, press CTRL_C to break Reply from 11.0.0.2: bytes=56 Sequence=1 ttl=255 time=50 ms Reply from 11.0.0.2: bytes=56 Sequence=2 ttl=255 time=30 ms Reply from 11.0.0.2: bytes=56 Sequence=3 ttl=255 time=30 ms Reply from 11.0.0.2: bytes=56 Sequence=4 ttl=255 time=20 ms --- 11.0.0.2 ping statistics --- 4 packet(s) transmitted 4 packet(s) received 0.00% packet loss round-trip min/avg/max = 20/32/50 ms

不同链路协议不一样,帧的格式也不一样

这段链路是以太网的帧,就是计算机广播信道的帧。

选择要抓包的接口以及对应的协议hdlx或者ppp协议

以太网的帧封装了三个字段

还是这个数据包,看看点对点链路的帧,看到源地址,目的地址还是没有变!但是由于链路不一样,协议也不一样,帧的格式也不一样,可以看到点到点的帧就不需要MAC地址。(点到点的帧有个控制字段和协议字段,但是和以太网的帧相比,ip报文的字段还是没变,也就是帧格式变了,其他不变)

再来看看HDLC的帧,可以看到地址,控制字段,协议和ppp协议的帧格式又不一样

从上面抓包可以看到,计算机在通信的时候,经过不同的链路,有不同的封装。帧格式不一样,但是IP数据包保持一致。

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Jenkins在Kubernetes中持续部署
下一篇:计算机网络 数据链路层 使用eNSP搭建学习数据链路层环境
相关文章

 发表评论

暂时没有评论,来抢沙发吧~