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

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

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

[Huawei]display interface Serial 2/0/1
Serial2/0/1 current state : UP
Line protocol current state : UP
Last line protocol up time : 2021-10-10 16:15:22 UTC-08:00
Description:HUAWEI, AR Series, Serial2/0/1 Interface
Route Port,The Maximum Transmit Unit is 1500, Hold timer is 10(sec)
Internet protocol processing : disabled
Link layer protocol is PPP
LCP 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 hdlc
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]
:y
Oct 10 2021 16:27:55-08:00 Huawei %%01IFNET/4/CHANGE_ENCAP(l)[0]:The user perfor
med the configuration that will change the encapsulation protocol of the link an
d 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 Do
wn. 
[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 ppp
Warning: 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 perfor
med the configuration that will change the encapsulation protocol of the link an
d 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 protoco
l 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 hdlc
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]
:y
Oct 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 th
en 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 Seri
al2/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 h
as 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 h
as 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  hdlc
Warning: The encapsulation protocol of the link will be changed. Continue? [Y/N]
:y
Oct 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 th
en 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 h
as 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 h
as 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数据包保持一致。

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值