• 网络协议:包丢失&物理层&数据链路层


    目录

    ping时丢失第一个包

     网络互联模型

     请求过程

     网络分层

     物理层(Physical)

     数字信号、模拟信号

    数据通信模型

    ​信道(Channel)

     数据链路层(Data Link)

    数据链路层的三个基本问题

     封装成帧

     透明传输

     差错检验

     CSMA/CD协议

    Ethernet V2帧的格式

     PPP协议

     网卡


    ping时丢失第一个包

    reason:When the data packet is arrived at Fa1/0,there is no PC01's MAC address.So the router 0  abandons this data packet,and router 0 will make a ARP request to search for PC01's MAC address.

     网络互联模型

    In order to better promote the research and development of the Internet, the International Organization for Standardization (ISO) formulated the network interconnection Model in 1985, and the OSI System Interconnect Reference Model (Poen System Interconnect Reference Model) has a seven-layer structure. 

     请求过程

     网络分层

     物理层(Physical)

    The Physical defines the standard of interface,cable,transmission rate,transmission way, etc.

     数字信号、模拟信号

    • Analog Signal:Continuous signal, suitable for long distance transmission. Poor anti-interference ability, waveform deformation is difficult to correct when interference appears.
    • Digital Signal:Discrete signals, not suitable for long-distance transmission. Strong anti-interference ability, waveform distortion can be recovered when interference appears.

    数据通信模型

    LAN communication model

    WAN communication model

     信道(Channel)

    Channel:The channel where information is transmitted. A transmission medium, such as a network cable, may be composed of several channels.

    • Simplex communication:The signal can only be transmitted in one direction, and the transmission direction of the signal can not be changed. Such as radio broadcast and cable television broadcast.
    • Half duplex communication:Signal can be bidirectionally transmitted, but must be alternating, at the same time it can only be transmitted in one direction. Such as: intercom
    • Full duplex communication:Signal can be bidirectionally transmitted at the same time . Such as : call a phone.

     数据链路层(Data Link)

    Data Link:A physical line (wired or wireless) from one node to its neighbors, with no other exchangeable nodes in between.

     explanation:1是同一个链路,集线器无脑,2是一个链路,3是一个链路,4是一个链路,5是一个链路。不过4和5的数据是相同的

    When transmitting data in a data link, it needs a corresponding protocol to control the transmission of data.

    The communication protocol may be different in different types of data link.

    • boardcast data link:CSMA/CD protocol,such as :a network consists of coaxial cable and Hub (or router - switch - router)
    • peer to peer data link:PPP protocol,such as : a network between two routers.

    three basical problems in data link:封装成帧(framing),透明传输(transparent transmission),差错检验(error check)

    数据链路层的三个基本问题

     封装成帧

    Frame's data part is the IP data packet transmitted from the network layer.

    MTU(Maximum Transfer Unit),every data link's protorol stipulates frame's maximum length of data to be sent,Ethernet's MTU is 1500 bytes.

     透明传输

     using SHO(Start Of Header)as the beginning symbol of frame,EOT(End Of Transmission)as the ending symbol of frame.

     If SOH and EOT appears in the data part, it must make a escape.

     差错检验

    FCS is calculated by data part and beginning part.

     CSMA/CD协议

    CSMA/CD(Carrier Sense Multiple Access with Collision Detection),载波侦听多路访问/冲突检测

    The network which uses this protocol is called Ethernet,it transmits Ethernet frame. Ethernet frame's standard:Ethernet V2,IEEE-802.3。Ethernet V2 is widely used.

    In order to detect whether the frame that is being sent makes a conflict , the Ethernet frame needs 64 bytes at least.

    The network using Switch is already support Full duplex communication. It doesn't need use CSMA/CD protocol, but its frame is still Ethernet frame.

    Ethernet V2帧的格式

    • Beginning:source MAC + target MAC + network type
    • Ethernet frame:beginning part + data  + FCS
    • data's length at least:64 - 6 - 6 - 2 - 4 = 46 bytes

    When data part's length less than 46 bytes, the data link layer will add some bytes behind the data , the receive port will abandon this adding bytes.

     summary:Ethernet frame's data length:46~1500 bytes,Ethernet frame's length :64~1518 bytes(target MAC + source MAC + network type + data + FCS)

     PPP协议

    • Address:the value in picture is 0xFF,it is valueless, peer to peer channel doesn't need source MAC and target MAC
    • Control:the value in picture is 0x03,it is valueless up to now
    • Protocol:the protocol type used inside 
    • beginning and ending symbol of frame:0x7E

     0x7E--->0x7D5E,0x7D----->0x7D5D

     网卡

    • When the NIC receives a frame, it first checks the error. If the frame passes the check, it receives this frame; otherwise, it discards it.
    • The frame catched by Wireshark lacks of FCS: Because the frame that Wireshark catchs is the frame which passed the error check.(FCS will be discarded by hardware)
    • Wireshark cann't catch the frame which doesn't pass error check.

     this is Wireshark

  • 相关阅读:
    新能源汽车软件开发设计规范
    临门一脚踢不进?面试官就是不要我?程序员面试隐藏加分项你做对了吗?!
    发布npm包质量分测试
    DTI-ALPS处理笔记
    element-ui日期选择器el-date-picker, 案例:填写有效期和选择开始时间后, 自动生成结束时间, datetime时间转换
    我用Python写了几个摸鱼小游戏,赐你2023年度上班上学摸鱼必备良品!(附源码)
    常见排序算法
    入行 4 年,跳槽 2 次,我摸透了软件测试这一行
    Java开发注意事项和细节说明
    linux 指定时间 执行一次 命令
  • 原文地址:https://blog.csdn.net/weixin_62775913/article/details/126475767