Parsing PPP, Ethernet II, and HDLC protocols

Source: Internet
Author: User

A network protocol is a collection of rules, standards, or conventions that are established for data exchange in a computer network. It specifies the format in which information must be used in communication and the meaning of these formats.

Most networks have a layered architecture, each layered on top of it, providing some service to its upper layer, and masking the details of how to implement the service. The rule that the nth layer on one device communicates with the nth layer on another device is the nth layer protocol. There are many protocols in each layer of the network, and the receiver and sender must agree on the same layer, otherwise one party will not be able to identify the information sent by the other party. network protocols enable various devices on the network to exchange information with each other.

PPP Protocol (Point-to-Point protocol) belongs to the network interface layer, which is mainly used for dial-up internet access. ) PPP has the ability to dynamically assign IP addresses, allowing IP addresses to be negotiated at connection time; frame format is as follows:

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/87/60/wKiom1feXgPTit7yAAAHOcoo-kg649.png-wh_500x0-wm_3 -wmp_4-s_3151135178.png "title=" Ppp.png "width=" and "height=" border= "0" hspace= "0" vspace= "0" style= "width:500px; height:63px; "alt=" Wkiom1fexgptit7yaaahocoo-kg649.png-wh_50 "/>

The first two 7E is the frame bound flag, the value is fixed to 7E;FF as the Address field, because the endpoint of the point-to-end link is unique, so the field is set to Ff;03 (C) as the control field, including the frame type and serial number, etc. FCS is a Frame check field to detect errors;

The PPP protocol specifies LCP (Link Control Protocol) for establishing, configuring, and testing PPP protocols; packets captured with wireshark such as:

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M00/87/60/wKiom1feYFvCg9yPAABBXrXxP7c750.png-wh_500x0-wm_3 -wmp_4-s_1886662501.png "title=" PPP package. png "Width=" 393 "height=" "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width : 393px;height:300px; "alt=" Wkiom1feyfvcg9ypaabbxrxxp7c750.png-wh_50 "/>

HDLC Protocol

    HDLC is a typical representative of the bit-oriented data Link Control protocol, which does not depend on any kind of character encoding set, the data message can be transparently transmitted, the "0-bit insertion method" for transparent transmission is easy to implement; Full duplex communication, high data link transmission efficiency; All frames are CRC tested, Sequential numbering of information frames prevents leakage or retransmission, high transmission reliability, and separation of transmission control functions from processing functions for greater flexibility. SDLC/HDLC protocol stipulates that all information transmissions must begin with a single marker character and end with the same character. This flag character is 01111110, called the Flag field (F). A complete unit of information, called a frame, is formed between the start sign and the end flag. All information is transmitted as frames, while the marker character provides the bounds of each frame. The receiver can establish frame synchronization by searching for "01111110" to detect the beginning and end of the frame.

Address fields and control fields

After the Flag field, you can have an address field a (addr) and a control field C (Contro1). The Address field is used to specify the address of the secondary station with which to communicate. A control field can prescribe several commands.The 1th or 1th, 2 bits in the control field represent the type of the transfer frame, and the 1th bit is "0" to indicate yesInformation Frame, 1th, 2 bits is "10" is the monitoring frame, "11" is no numbered frame. The SDLC prescribes a and C fields with a width of 8 bits. HDLC allows the A field to be any length and the C field to be 8-bit or 16-bit. The receiver must check the first bit of each address byte, if "0", followed by another address byte, and if "1", the byte is the last address byte. Similarly, if the first bit of the first byte of the control field is "0", there is also a second control field byte, otherwise there is only one byte. Immediately after the information field is the Two byte frame check field, the Frame check field is called FC (Frame Check) field, check sequence FSC ( Frame Check Sequence).

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/87/5E/wKioL1feZEni5LORAABm31GQ9ug263.jpg-wh_500x0-wm_3 -wmp_4-s_2759118755.jpg "title=" HDL frame format "width=" 397 "height=" "" border= "0" hspace= "0" vspace= "0" style= "WIDTH:397PX; height:320px; "alt=" Wkiol1fezeni5loraabm31gq9ug263.jpg-wh_50 "/>

with Wireshark capture packets such as:

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M00/87/5E/wKioL1feZYnDlZZAAAA-MQar7_Y264.png-wh_500x0-wm_3 -wmp_4-s_142761545.png "title=" HDLC Packet "width=" 385 "height=" "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:385px "; height:350px; "alt=" Wkiol1fezyndlzzaaaa-mqar7_y264.png-wh_50 "/>


Ethernet II Protocol

Ethernet is the most common communication protocol standard used by current LAN. This protocol defines the cable type and signal processing method used in LAN. It consists of a 6-byte destination MAC address, a 6-byte source MAC address, a 2-byte type field (used to indicate the type of data encapsulated in the frame, the inside) followed by 46-1500-byte data and 4-byte frame checks.

Header 8  Destination Address 6  Source Address 6  ether Type 2  Payload 46-1500  frame Test sequence 4

Header: 8 bytes, the first 7 0,1 alternating bytes (10101010) are used to synchronize the receiving station, and a 1010101011 byte indicates the starting position of the frame. The header provides receiver synchronization and frame demarcation services.

Destination Address: 6 bytes, unicast multicast or broadcast. The unicast address is called a personal, physical, hardware, or MAC address, and the broadcast address is the full 1,0xff FF ff.

Source Address: 6 bytes. Indicates the unicast address of the sending node.

Ether Type: 2 bytes, used to indicate the upper layer protocol contained within the Ethernet frame. The protocol identifier for the frame format. For IP messages, the field value is 0x0800. For ARP information, the value of the Ether Type field is 0x0806.

Payload: A protocol Data unit PDU consisting of an upper layer protocol. The maximum payload that can be sent is 1500 bytes. The payload is at least 46 bytes due to the collision detection feature of Ethernet. If the upper-layer protocol data unit is less than 46 bytes long, it must be added to 46 bytes.

Frame Inspection sequence: 4 bytes. Verify bit integrity.


650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/87/5E/wKioL1fedGLQHY07AABKPc0l30A240.png-wh_500x0-wm_3 -wmp_4-s_466066755.png "title=" ethernetii "width=" 385 "height=" "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width : 385px;height:350px; "alt=" Wkiol1fedglqhy07aabkpc0l30a240.png-wh_50 "/>

Destination: Destination address is c4:01:20:e8:00:00

Source: Origin Address is c4:02:21:e8:00:00

TYPE:IP Agreement;


This article from the "12034896" blog, reproduced please contact the author!

Parsing PPP, Ethernet II, and HDLC protocols

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.