Data Link Layer

Source: Internet
Author: User
Directory

Data link layer standards
Data link layer terminology
Channel
Link Definition
Three basic questions
Two important measures
CSMA/CD Protocol
Ethernet services
MAC frame
Extended LAN
The computer communicates with the LAN through an adapter.
Hub
Bridge
Network Topology
Vswitch
VLAN
Ethernet frame format used by the virtual LAN
Average time required to send a frame
LAN wireless protocol
Ethernet protocol for LAN
Point-to-Point Protocol for Wan
Pppoe Point-to-Point Protocol

Data link layer standards

Data link layer terminology

Channel

Two channels:

Point-to-point channel:

Communication Method:

One-to-one point-to-point communication

PPP protocol:

Frame header:

Requirements to be met:

        • Simple (this is the first requirement)
        • Encapsulated into frames
        • Transparency
        • Multiple network layer protocols
        • Multiple types of links
        • Error Detection
        • Detect connection status
        • Maximum transfer unit
        • Network Layer address negotiation
        • Data Compression negotiation

Features not required:

        • Error Correction
        • Traffic Control
        • Serial number
        • Multi-point line
        • Half Duplex or ticket Link

Three components:

        • A Method of encapsulating IP datagram into a serial link.
        • Link Control Protocol (LCP ).
        • Network Control Protocol (NCP ).

PPP protocol working status:

Transparent transmission:

Character filling:

        • Convert each 0x7e in the information field into a 2-byte sequence (0x7d, 0x5e ).
        • If a 0x7d byte appears in the information field, convert it into a 2-byte sequence (0x7d, 0x5d ).
        • If the ASCII control character (that is, the value is less than 0x20) is displayed in the information field, a 0x7d byte must be added before the character and the encoding of the character must be changed.

Zero bit filling:

Method:

          • Sending time, As long as 5 consecutive 1 is found, enter a 0 immediately
          • AcceptThe bitstream in the frame is scanned. Each time five consecutive 1 streams are found, the first 0 after the five consecutive 1 streams are deleted.

Note:

The PPP protocol uses synchronous transmission (a series of BITs for continuous transmission) when using the SONET/SDH link. At this time, the PPP protocol uses the zero-bit padding method for transparent transmission.

Broadcast Channel:

Communication Method: One-to-multiple Broadcast Communication

Note:: Therefore, a dedicated shared channel protocol must be used to coordinate the data sending of these hosts.

Channel Division:

  • Static channel Division:
    • Frequency Division Multiplexing
    • Time division multiplexing
    • Wavelength Division Multiplexing
    • Code Division Multiplexing
  • Dynamic Channel Division:
    • Dynamic Media Access Control (Multi-Point Access), Random Access
    • Dynamic Media Access Control (Multi-Point Access), controlled access
Link Definition

Link)Is a passive point-to-point physical line segment with no other switching nodes in the middle.

Data Link)In addition to physical lines, communication protocols must be established to control the transmission of data. If hardware and software implementing these protocols are added to the link, a data link is formed.

Three basic questions

Encapsulated into frames:

Add the header and tail of a piece of data before and after the data, and then form a frame. Determine the frame boundary.

Transparent transmission:

Definition:

Data is transparent during transmission

Solve transparent transmission problems:

    • The data link layer of the sender inserts an escape character "ESC" before the control character "Soh" or "EOT" in the data (the hexadecimal code is 1b ).
    • Byte stuffing or character stuffing the data link layer of the receiver deletes the inserted escape characters before sending the data to the network layer.
    • If the escape character also contains data, insert an escape character before the Escape Character. When the receiving end receives two consecutive escape characters, delete the first one.

Error Control:

  • Cyclic Redundancy Test
  • Frame verification sequence (FCS)
Two important measures

A flexible and connectionless method is used to send data directly without establishing a connection.

Ethernet does not number the sent data frame or require the recipient to send it back for confirmation.

CSMA/CD Protocol

Definition:

Carrier monitoring Multi-Point Access/collision detection CSMA/CD

Conflict:

Conflict Control:

Conflict and competition:

Practice:

Step 1,After listening(Before sending data, each site must first check whether other computers are sending data on the bus)
Step 2,Send while listening(Check whether a collision is sent when each site sends data)
Step 3,Conflict stop(When a collision occurs, both parties must immediately stop sending data and send human interference signals)
Step 4,Random resend(Then resend the data based on the backoff algorithm)

Carrier listening for transmission latency:

Human interference signal:

Features:

  • It is impossible for a site to send and receive data simultaneously.
  • Multiple computers are connected to a bus through multi-point access.

Backoff Algorithm:

  • Determine the basic backoff time. Generally, it is set to the contention period (2 ).
  • Define retransmission times K, K = min [retransmission times, 10]. From the Integer Set ,..., (2 to the power of the K-1 minus 1)] a random number is taken as R. The retransmission latency is R times the backoff time
  • This frame is discarded when 16 re-transmission attempts are still unsuccessful and reported to the top

Competition period:

  • Time from the sender to the receiver, and from the receiver to the sender
  • Ethernet takes 51.2 s as the length of the contention period. During the contention period, 512 bits can be sent, that is, 64 bytes. if no conflict occurs between the first 64 bytes of data that can be sent during the competition period, the subsequent data will not conflict. If the received frame is smaller than 64 bytes, the data will be discarded directly.

CSMA/CD sending process:

CSMA/CD receiving process:

 

Ethernet services

The services provided by Ethernet are unreliable, that is, the best delivery effort. this frame is discarded when the target station receives a data frame with an error and does nothing else. the correction of errors is determined by the top management. if some data is lost and retransmitted at the higher level, Ethernet does not know that this is a re-transmitted frame, but is sent as a new data frame.

MAC frame

MAC frame format:

Value of the MAC frame type Field and Its Meaning:

  • 0x0000-0x05dc IEEE 802.3 Length
  • 0x0101-0x01ff Experiment
  • 0x0600 Xerox NS IDP
  • Zero X 0660
  • 0x0661 dlog
  • 0x0800 Internet Protocol (IP)
  • 0x0801 x.75 Internet
  • 0x0802 NBS Internet
  • 0x0803 ECMA Internet
  • 0x0804 chaosnet
  • 0x0805 X.25 level 3
  • 0x0806 Address Resolution Protocol (ARP: Address Resolution Protocol)
  • 0x0808 Frame Relay ARP (Frame Relay ARP) [rfc1701]
  • 0x6559 raw frame relay [rfc1701]
  • 0x8035 dynamic darp (drarp: Dynamic RARP) Reverse Address Resolution Protocol (RARP: Reverse Address Resolution Protocol)
  • 0x8037 Novell Netware IPX
  • 0x809b ethertalk
  • 0x80d5 ibm sna services over Ethernet
  • 0x80f3 appletalk address parsing protocol (AARP: appletalk Address Resolution Protocol)
  • 0x8100 Ethernet automatic protection switch (EAPS: Ethernet Automatic Protection Switching)
  • 0x8137 Internet Packet Exchange (IPX: Internet Packet Exchange)
  • 0x814c Simple Network Management Protocol (SNMP: Simple Network Management Protocol)
  • 0x86dd Internet Protocol V6 (IPv6, Internet Protocol version 6)
  • 0x880b Point-to-Point Protocol (PPP: Point-to-Point Protocol)
  • 0x880c Common Exchange Management Protocol (gsmp: General switch Management Protocol)
  • 0x8847 Multi-Protocol Label Switching (unicast) MPLS: Multi-Protocol Label Switching <unicast>)
  • 0x8848 Multi-Protocol Label Switching (Multicast) (MPLS, Multi-Protocol Label Switching <multicast>)
  • 0x8863 PPP over Ethernet (discovery phase) (pppoe: PPP over Ethernet <discovery stage>)
  • 0x8864 PPP over Ethernet (PPP session phase) (pppoe, PPP over Ethernet <PPP session stage>)
  • 0x88bb Lightweight Access Point Protocol (lwapp: Light Weight Access Point Protocol)
  • 0x88cc connection layer Discovery Protocol (lldp: Link Layer Discovery Protocol)
  • EAP (eapol: EAP over LAN) on 0x8e88 LAN)
  • 0x9000 configure the test protocol (loopback)
  • 0x9100 VLAN tag protocol identifier (VLAN tag protocol identifier)
  • 0x9200 VLAN tag protocol identifier (VLAN tag protocol identifier)
  • 0 xFFFF Reserved

MAC address

Address Allocation:

    • The IEEE Registrar Ra is responsible for allocating the first three bytes of the address field to the manufacturer (that is, the last 24 bytes)
    • The last three bytes in the address field (that is, the lowest 24 bits) are assigned by the manufacturer. They are called extended identifiers and must ensure that the generated adapter has no duplicate addresses.

Definition:

A hardware address is also called a physical address or a MAC address.

MAC frame:

    • Unicast (unicast) frame (One-to-one)
    • Broadcast (broadcast) frame (One to all)
    • Multicast (Multicast) frame (One-to-multiple)
    • The Ethernet adapter can also be set as a special mode, which is a hybrid paradigm. When a frame is transmitted over the Ethernet, It is quietly received.

Two standards:

    • Dix Ethernet V2 standard (the most common MAC frame format is Ethernet V2)
    • IEEE 802.3 standard

Invalid MAC frame:

    • The length of the data field is different from that of the length field.
    • The frame length is not an integer byte.
    • An error is detected using the received frame inspection sequence (FCS ).
    • The length of the data field is not 46 ~ Between 1500 bytes

Minimum interval between frames:

    • Definition:The minimum interval between frames is 9.6 s, which is equivalent to 96-bit sending time.
    • Purpose:After a station detects that the bus is idle, it has to wait 9.6 s before sending data again. this is done so that the receiving cache of the station that just received the data frame can be cleaned up and the next frame is ready for receiving.
Extended LAN

Expand LAN at the physical layer (extend LAN with a hub)

Advantages:

    • Enable computers in different collision domains to communicate with each other.

Disadvantages:

    • The collision domain is increased, but the total throughput is not increased.
    • If different collision domains use different data rates, they cannot be connected with hubs.

Lan extension at the data link layer (LAN extension using bridges)

Advantages:

    • Expanded the geographical coverage of LAN
    • Filter traffic
    • Extended physical scope
    • Improved reliability
    • Lan that can interconnect different physical layers, different MAC Sub-layers, and different rates (such as 10 Mb/s and 100 Mb/s Ethernet)
    • The bridge makes each network segment an isolated collision domain

Disadvantages:

    • Storage forwarding increases latency
    • There is no traffic control function on the MAC Sub-layer.
    • When network segments with different MAC Sub-layers are bridging together, the latency is greater.
    • The bridge is only suitable for LAN with fewer users (no more than several hundred) and less traffic. Otherwise, network congestion may occur due to the spread of too much broadcast information. this is the so-called broadcast storm.

The differences between LAN extension on the physical layer and on the data link layer are as follows:

  • The Hub does not detect the transmission media when forwarding frames.
  • The bridge must execute the CSMA/CD algorithm before forwarding frames. If a collision occurs during the sending process, it must stop sending and backoff.
The computer communicates with the LAN through an adapter.

Hub

Bridge

The forwarding table registers the following information:

  • Source Address
  • Interface number
  • Time

Transparent bridge self-learning algorithm:

Process the received data frame:

Requirements:

Update and subscribe at intervals

Spanning Tree Algorithm:

    • Method:
      • After the interconnected bridges communicate with each other, they can find a subset of the original network topology. in this subset, there is no loop in the connected network, that is, there is only one path between any two stations.
      • To obtain the Spanning Tree that reflects the changes in the network topology, the root bridge on the spanning tree must update the topology of the spanning tree at intervals.
    • Purpose:
      • In order to avoid generating forwarding frames in circles in the network

Source Route Bridge:

  • Purpose:
    • Find the optimal route path
  • Method:
    • The Origin Site sends a discovery frame to the target site in broadcast mode, each of which records the route
    • When a frame arrives at the destination site, it is returned to the origin site along its route
    • After the source station learns these routes, it selects an optimal route from all possible routes.
    • Any frame header sent from the origin site to the destination site must carry the information specified by the origin site.
Network Topology

Star topology:

As the emergence of hubs and twisted pair wires are widely used in Lan, this topology is widely used.

Ring topology:

  • In the logical ring topology, each node receives frames in sequence. if the frame is not sent to this node, it will pass the frame to the next node. this will allow the ring to use a controlled media access control technology called token Transfer
  • The node in the logical ring topology removes the frame from the ring and checks the address. If it is not sent to the node, it is sent back to the ring.
  • In the cycle, all nodes in the cycle between the source node and the target node will check the frame.

Bus topology:

  • Allows multiple nodes to communicate with each other through the same shared media.
  • Only one terminal sends data at a time.
  • Each node can view all frames on the media, but only the target node of the frame can process the frame content.
  • The media access control method is usually CSMA/CD or CSMA/CA.

Point-to-point topology:

  • Point-to-point topology directly connects two nodes
  • A virtual circuit is a logical connection between two network devices in the network.
Vswitch

A switch is often referred to as a switch or a layer-2 switch (indicating that the switch works at the data link layer). There are usually more than a dozen interfaces on the Ethernet switch. therefore, an Ethernet switch is essentially a bridge with multiple interfaces.

VLAN

Logical groups composed of some lan cidr blocks that are not related to physical locations

Each VLA frame has a clear identifier that specifies the VLAN of the workstation that sends the frame.

Use Ethernet switches to Implement Virtual LAN

These CIDR blocks share some common requirements.

Ethernet frame format used by the virtual LAN

Average time required to send a frame

LAN wireless protocol

Ethernet protocol for LAN

Point-to-Point Protocol for Wan

Pppoe Protocol

Preface

Pppoe (PPP over Ethernet, rfc2516, it is worth noting that this RFC is not a standard but an information type) defines how to transmit PPP data packets over Ethernet.
ADSL is implemented through pppoe.

Communication Process Overview

The establishment of the pppoe channel (ADSL dialing) is divided into two phases: the discovery phase and the PPP session phase.

In the discovery phase, an Access Concentrator (AC and Access Concentrator) on an Ethernet client is called the ADSL Modem. Generally, there is only one AC at home; however, if there may be more than one ADSL in an Ethernet, there will be more than one AC, then the client will select one. after the discovery phase is complete, both the client and the AC obtain information about the PPP channel to be established on the Ethernet.

The discovery phase is stateless, that is, the two sides do not need to save the previous status information. Only after the PPP session starts, the two sides need to establish a virtual PPP communication interface, the ppp0 Nic is available in Linux, and the ADSL interface is added to the network connection in windows.

Protocol Header Format

Protocol Value

Pppoe data is directly above the Ethernet header data, and its level is the same as ARP, IP, and so on. In the type field of the Ethernet header, 0x8863 indicates the pppoe discovery phase data, and 0x8864 indicates the PPP session phase data, as shown below. (analogy: 0x0800 indicates IP data, and 0x0806 indicates ARP data)

Pppoe protocol header

The pppoe header has 6 bytes, Which is exactly 4-byte aligned with the 14-byte Ethernet header, including the following fields:

      • Ver version number, 4 bits, must be 0x01
      • Type, 4 bits, must be 0x01
      • Code: 8-bit, which has different definitions in the discovery phase and PPP session phase
      • Session_id session ID: 16 bits are used to define a PPP Session, which is defined during the discovery process.
      • Length: 16 bits, indicating the Load Length, excluding Ethernet and pppoe headers.

Discovery phase

The data in the pppoe discovery phase is 0x8863.

Tag

In the discovery phase, information about the client and the AC is exchanged, and a pppoe channel is established. The load information is pppoe information and no upper-layer protocol data is available.
The load in the discovery phase is called a tag. The tag information format is as follows. The load information may contain multiple tags:

Tag_type: 16-bit, tag type (tag_type can be the following values (note that the first byte is 2, indicating an error message ))

      • 0x0000 end-of-list
      • 0x0101 service-name
      • 0x0102 ac-name
      • 0x0103 host-uniq
      • 0x0104 ac-cookie
      • 0x0105 vendor-specific
      • 0x0110 relay-session-ID
      • 0x0201 service-name-Error
      • 0x0202 ac-system-Error
      • 0x0203 generic-Error

Tag_length: 16 bits, indicating the length of tag_value: Tag Value

Pppoe actively discovers the initial package

Pppoe actively discovers that the initial packet (pppoe active discovery initiation, padi) is sent by the client. The destination address in the Ethernet header is the etherebroadcast address FF: FF, the code in the pppoe header is 0x09, And the session_id value must be 0. The load part must contain only one service-name tag to indicate the requested service type. In addition, it can contain other tags, the entire pppoe package cannot exceed 1484 bytes, so that the 16 bytes can be added by the ADSL relay device.
An example of a padi package is:

Pppoe active discovery proposal package

The pppoe active discovery package (pppoe active discovery offer, pado) is sent by the AC to respond to the padi package of the client. The destination address in the Ethernet header is the MAC address of the client, the code in the pppoe header is 0x07, the session_id value must be 0, and the load part must contain an ac-name tag to indicate the name of the current ac, A service-name tag specified in the padi package. It can also contain tags of other service-names. if the AC does not provide services to the client, the AC will not respond to the pado package. an example of a pado package is:

Pppoe actively discovers request packets

Pppoe actively discovers that the request packet (pppoe active Discovery request, padr) is sent by the client, because multiple AC may respond to the padi packet sent by the client, the client selects an AC from the pado packet to send the padr packet. The destination address in the Ethernet header is the MAC address of the AC, and the code in the pppoe header is 0x19, the session_id value must be 0. The load part must contain only one service-name tag to indicate the requested service type. It can also contain other tags.

Pppoe actively discovers the session Validation Package

The pppoe active discovery session Validation Package (pppoe active discovery session-confirmation, pads) is sent by the AC. After receiving the client's padr package, the AC generates a seession_id value to mark this PPP session, it is sent to the client as a padr package. the destination address in the Ethernet header is the MAC address of the client. The code in the pppoe header is 0x65, and the session_id value must be the generated session_id, the load part must contain only one service-name tag, indicating that the service type is accepted by the AC. It can also contain other tags. if the AC does not accept server-name in padr, pads contains a service-name-error tag, and session_id is set to 0.

Pppoe actively detects the stop package

Pppoe active discovery stop package (pppoe active discovery terminate, PAdT) indicates the end of The pppoe session process, and both the AC and client can actively send out. the destination address in the Ethernet header is the MAC address of the Peer party. The code in the pppoe header is 0xa7, And the session_id value must be the session_id of the pppoe session process. No tag is required.

PPP session phase

In the PPP session phase, the PPP package is encapsulated in the pppoe Ethernet frame. The destination address of the Ethernet packet is single, the Ethernet protocol is 0x8864, And the pppoe header code must be 0, session_id must always be the seesion_id value negotiated during the discovery phase. The load of pppoe is the entire PPP package, and the first two bytes are the PPP protocol ID values.
An example of a pppoe session package is as follows:

Note:Since the pppoe header is 6 bytes and the PPP protocol ID number is two bytes, it takes up to 8 bytes in total, while the MTU value of Ethernet is 1500, the upper-layer PPP load data cannot exceed 1492 bytes, therefore, the maximum number of receiving unit values negotiated during PPP negotiation cannot exceed 1492 bytes, that is, the MTU in the pppoe environment is 1492 bytes.

Description of ADSL dialing process

The client starts the dialing program, sends the padi package, the ADSL modem responds to the pado package, and the client sends the padr package again. The ADSL modem responds to the pads package and then establishes the pppoe channel, then the client performs the common PPP protocol dialing process, but the PPP data packets are packaged into the Ethernet frame. After successful dialing, the client and the server establish a PPP channel, ADSL modem converts an Ethernet frame to a PPP package. although ADSL uses telephone lines, the frequency is not the call frequency. Therefore, dialing ADSL does not affect the call. after the communication ends, the PAdT will be sent to disconnect the pppoe channel.

Conclusion

Because of the wide application of ADSL, pppoe is also applied. Understanding the communication protocol and data format is necessary for the development, protocol analysis, and access control of the underlying driver, pppoe is supported in both Windows and Linux.

Data Link Layer

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.