Part of this series of articles refer to the seventh edition of “Computer Network” edited by Xie Xiren, PPT link: Yuexue Multimedia course resources platform of Publishing House of Electronics Industry (yx.51zhy.cn/mtrcsRes/ph…
This paper is participating in theNetwork protocols must be known and must be known”Essay campaign
China Internet Network Information Center (CNNIC) publishes the development of The Internet in China twice a year.
The articles in this series are listed below:
- A second look: From Application to Theory. Computer Networks series I: An overview
- Looking back again: From Application to Theory computer Networks series ii: The Physical Layer
- Looking back again: From Application to Theory computer Networks series iii: The Data link Layer
- A second look: From Application to Theory computer Networks series iv: The network layer
The data link layer belongs to the lower layer of the computer network. The main contents of this paper are:
- The characteristics of the point-to-point channel and the broadcast channel at the data link layer, and the characteristics of the protocols used by the two channels (PPP and CSMA/CD).
- There are three basic problems in data link layer: frame encapsulation, transparent transmission and error detection.
- Hardware address of the Ethernet MAC layer.
- Functions and applications of adapters, transponders, hubs, Bridges and Ethernet switches.
Data link layer
Data link layer is a very important layer to realize communication between devices
Channels used by the data link layer
Note: Different link layers may use different data link layer protocols
Data link layer using point-to-point channel
Data links and frames
- A link is a passive point-to-point physical line segment without any other switching nodes. A link is only one component of a path. Also known as a physical link.
- Data LinkIn addition to the physical wiring, there must beCommunication protocolTo control the transmission of this data. If the hardware and software to implement these protocols are added to the link, it constitutes a data link. Also known asLogical link.
- The most common approach today is to use adapters, or network cards, to implement the hardware and software of these protocols
- Generally, adapters include the data link layer and the physical layer.
- Frame: Protocol data unit at the data link layer of a point-to-point channel. The data link layer sends the data frame handed down by the network layer to the link, and takes out the data in the received frame and delivers it to the network layer.
- IP datagrams: In the Internet, network layer protocol data units are IP datagrams (or simply datagrams, packets, or packets).
The data link layer passes frames
The main steps in communication are as follows:
- The data link layer of node A adds headers and tails to IP datagrams handed over by the network layer and encapsulates them into frames.
- Node A sends the encapsulated frame to the data link layer of node B.
- If the number of node B and the frames received by the link layer have no error, the IP datagram is extracted from the received frames and delivered to the network layer above. Otherwise, the frame is discarded.
The data link layer does not have to consider the details of how the physical layer implements the bit transfer. It is even simpler to imagine that frames are sent directly to each other as if horizontally between two data link layers, as shown in figure (b) above.
Three basic questions
There are many types of data link layer protocols, but three basic problems are common.
Encapsulated into a frame
- Framing is a frame by adding a header and a tail to a piece of data.
- One of the most important functions of the header and tail is frame delimiting.
- The control character SOH (Start Of Header) is placed at the beginning Of a frame, indicating the beginning Of the frame. Another control character, EOT (End Of Transmission), indicates the End Of the frame.
Transparent transmission
If the binary code of a byte in the data happens to be the same as SOH or EOT, the data link layer willIncorrectly “find the frame boundary”. The solution: byte stuffing or character stuffing. The data link layer of the sending end inserts a control character “SOH” or “EOT” in front of the dataEscape character“ESC” (whose hex code is 1B).If the escape character is also present in the data, an escape character ESC should be inserted before the escape character.
Error control
- Realistic communication links are not ideal. That is, bits can go wrong in transit: 1 can become 0, and 0 can become 1. This is called a bit error.
- Bit error is a type of transmission error. The “error” referred to in this article, unless otherwise specified, means “bit error”.
- Over a period of time, the ratio of the number of transmitting errors to the total number of transmitting bits is called the Bit Error Rate (BER). For example, a bit error rate of 100 means that on average one bit error occurs for every 100 bits transmitted.
- Bit error rate is closely related to signal-to-noise ratio. If you try to improve the SNR, you can reduce the bit error rate. The actual communication link is not ideal, it is impossible to reduce the bit error rate to zero.
- Therefore, in order to ensure the reliability of data transmission, all kinds of error detection measures must be adopted in the data link layerCyclic redundancy check CRCCyclic Redundancy Check for error detection.
- Principle of cyclic redundancy test
- At the sending end, the data is first divided into groups. Let’s say we have k bits per group.
- After each group M, n bits of redundancy code for error detection are added and sent together.
- Calculation of redundant codes
- The operation of 2 to the n times M using binary modulo 2 is equivalent to adding n zeros after M.
- The resulting number of (k + n) bits divided by the pre-selected divisor P of length (n + 1) bits gives the quotient Q and the remainder R, which is 1 bit less than the divisor P, that is, R is n bits.
- The remainder R is spliced after the data M as a redundancy code and sent together.
- Frame check sequence FCS
- The redundant codes added to the data are called Frame Check Sequence (FCS).
- Cyclic redundancy check CRC is not equivalent to frame check sequence FCS.
- CRC is a common error-detection method, while FCS is a redundant code added to the end of data.
- FCS can be obtained using CRC, but CRC is not the only method used to obtain FCS.
- Principle of cyclic redundancy test
- It should be noted
- CRC error detection technology can only be accepted without error with cyclic redundancy check, that is, all the accepted frames (excluding the discarded frames) can be considered with a probability very close to 1 that there is no error in the transmission process.
- CRC error detection alone cannot achieve error-free transmission or reliable transmission.
- It should be made clear that “infinite error” and “transmission error free” are different concepts.
- Using CRC checks at the data link layer, it is possible to achieve extremely high error transmission, but it is not reliable transmission.
- “Error-free transmission” (receiving what you send) requires acknowledgment and retransmission.
Point-to-point protocol PPP
For point-to-point links, the most widely used data link layer Protocol is point-to-point Protocol (PPP). PPP has been the official standard for the Internet since 1994.
The characteristics of
- Simplicity – this is the number one requirement. The protocol is not easy to make mistakes in the implementation, so that different vendors in the different implementation of the protocol on its interoperability improved.
- Frame – Special characters must be specified as frame delimiters.
- Transparency – Data transmission must be transparent.
- Multiple network layer protocols – Multiple network layer protocols can be supported on the same physical link.
- Multiple types of links – Can run on multiple types of links.
- Error detection – The ability to detect the frame received by the receiver and immediately discard the frame with error.
- Detecting connection status – PPP must have a mechanism to automatically detect whether a link is working in a timely manner (no more than a few minutes)
- Maximum Transport Unit – A standard default maximum transport unit MTU must be set for each type of point-to-point link, facilitating interoperability between implementations. It is important to note that the MTU is the maximum length of the data portion that a frame at the data link layer can carry, not the total length of the frame.
- Network-layer address negotiation – a mechanism must be provided to enable two network-layer entities communicating to know or be able to configure each other’s network-layer addresses through negotiation.
- Data compression negotiation – a method must be provided to negotiate using data compression algorithms.
In the TCP/IP protocol family, TCP at the transport layer is responsible for reliable transmission. Therefore, PPP at the data link layer does not need error correction, serial number setting, or flow control. PPP does not support multi-point lines (that is, a primary station communicates with multiple secondary stations on a link in turn), but only point-to-point link communication. In addition, PPP supports only full-duplex links.
The PPP protocol has three components:
- A method for encapsulating IP datagrams into serial links. IP supports both asynchronous links (8-bit data with no parity check) and bit-oriented synchronous links. The IP datagram in the PP2 frame is its information part. The length of this message part is limited by the MTU, the maximum transmission unit.
- A Link Control Protocol (LCP) used to establish, configure, and test data Link connections. The two parties to the communication may negotiate a number of options. There are 11 types of LCP groups defined in RFC1661.
- A set of Network Control Protocols (NCP), each of which supports different Network layer protocols, such as IP, OSI Network layer, DECnet, and AppleTalk.
The frame format
- A PPP frame consists of 4 fields at the beginning and 2 fields at the end.
- The flag field F = 0x7E (the symbol “0x” indicates that the following characters are represented in hexadecimal. The binary representation of the hexadecimal 7E is 01111110).
- Address field A is only set to 0xFF. The address field doesn’t actually work.
- Control field C is usually set to 0x03.
- PPP is byte-oriented, and all PPP frames are integer bytes in length.
- Transparent transmission problem:
- When PPP is used for asynchronous transmission, a special character padding method is used.
- When PPP is used on a synchronous transport link, the protocol specifies the hardware to do the bit filling (as HDLC does).
- PPP protocol does not use serial number and confirmation mechanism for the following reasons:
- When the probability of errors at the data link layer is small, PPP is a relatively simple protocol.
- In the Internet context, the PPP information field puts the data into the IP datagram. Reliable transmission at the data link layer does not guarantee reliable transmission at the network layer.
- The frame check sequence FCS field ensures error-free acceptance.
Working state
- When a user dials into an ISP, the router’s modem confirms the call and establishes a physical connection.
- The PC sends a series of LCP packets (encapsulated into multiple PPP frames) to the router.
- These packets and their responses select some PPP parameters and perform network layer configuration. NCP assigns a temporary IP address to the newly connected PC, making the PC a host on the Internet.
- When the communication is complete, NCP releases the network layer connection and takes back the original IP address. Next, LCP releases the data link layer connection. Finally, the physical layer connections are released.
- Therefore, PPP protocol is not a pure data link layer protocol, it also includes the physical layer and network layer content.
- Link Dead: A PPP Link always starts and ends in Link Dead state. In this case, there is no physical layer connection between the USER’s PC and the ISP’s router.
- The ‘Link establishment’ state: When a user’s PC calls a router over a modem (usually by clicking a connection button on the screen with a mouse), the router detects the carrier signal emitted by the modem. After the physical layer connection is established, PPP enters the link establishment state to establish LCP connection at the link layer.
- Authenticate: The LCP link is established after negotiation, and then the DEVICE enters the Authenticate state. In this state, only LCP transmission packets, authentication packets, and link quality monitoring packets are allowed.
- Network-layer Protocol state: In the Network-Layer Protocol state, NCP at both ends of a PPP link exchange network-layer control packets with each other based on different protocols at the Network Layer. This step is important because today’s routers can support multiple network layer protocols at the same time. In short, the network layers at both ends of PPP can run different network layer protocols, but still use the same PPP protocol to communicate.
- Link Open: After the network layer is configured, the Link enters the Link Open state for data communication.
- Link Terminate Status: After data transmission is complete, one end of the link sends a terminate-request (LCP) Request to end the link connection. After receiving a terminate-ACK (LCP) Request from the other end, the link is in the Terminate-ACK state.
Data link layer using broadcast channels
Broadcast channels can carry out one-to-many communication. The LAN discussed below uses broadcast channels. Local area networks were developed in the late 1970s. LAN technology plays a very important role in computer network. The layers of LAN work span the data link layer and the physical layer.
The data link layer of a LAN
- The main features of a LAN are:
- The network is owned by one unit;
- The geographical scope and number of sites are limited.
- LAN has the following main advantages:
- With broadcast function, it is easy to access the whole network from one site. Hosts on the LAN can share hardware and software resources connected to the LAN.
- Facilitate the expansion and gradual evolution of the system, the position of the equipment can be flexibly adjusted and changed.
- The reliability, availability and survivability of the system are improved.
- Two standards for Ethernet
- DIX Ethernet V2 was the protocol for the world’s first LAN product (Ethernet).
- IEEE 802.3 is the first IEEE Ethernet standard.
The DIX Ethernet V2 standard differs only slightly from the IEEE 802.3 standard, so it canShortened 802.3LAN to “Ethernet”. Strictly speaking, “Ethernet” should refer to a LOCAL area network (LAN) that complies with the DIX Ethernet V2 standard.
-
Two sub-layers of the data link layer
In order to make the data link layer better adapt to various LAN standards, the IEEE 802 Committee split the data link layer of the LAN into two sub-layers:
- The Logical Link Control (LLC) sublayer is transparent to the LLC sublayer regardless of the LAN protocol.
- Medium Access Control (MAC) sub-layer. Contents related to Access to transmission media are stored at the MAC sub-layer
However, after the 1990s, the fierce competition in the LAN market gradually became clear.EthernetinLAN marketChina has acquired a monopoly position and has almost become synonymous with LAN. Due to the rapid development of the InternetTCP/IP systemThere are only lans that are frequently usedDIX Ethemet V2Therefore, the role of logical link control sub-layer LLC(IEEE802.2 standard) developed by the IEEE802 committee has disappeared, and many manufacturers produce adapters that only have MAC protocol but no LLC protocol. This column does not consider the LLC sublayer when it comes to Ethernet. This makes the discussion of how Ethernet works much simpler.
2. Functions of the adapter
- The connection between computer and external LAN is carried out by communication adapter.
- The Network Interface board is also called a communication adapter or Network Interface Card (NIC).
- Key features of the adapter:
- Data serial transmission and parallel transmission conversion.
- Cache the data. There are memory chips for caching.
- Installs device drivers in the computer’s operating system.
- Implement the Ethernet protocol.
- The adapter does not use the computer’s CPU when receiving and sending various frames
CSMA/CD protocol
Reference – Computer Networking -CSMA/CD protocol
Star topology using hubs
To be continued
Ethernet channel utilization
To be continued
MAC layer of Ethernet
To be continued
Extended Ethernet
Extend Ethernet at the physical layer
- Using optical fiber expansion
- The host is connected to the hub using optical fiber (usually a pair of optical fibers) and a pair of optical fiber modems.
- It is easy to connect the main engine to a hub several kilometres away.
- Use the hub extension: Connects multiple Ethernet segments into a larger, multi-level star Ethernet.
- advantages
- Enables computers on Ethernet networks originally belonging to different collision domains to communicate across collision domains.
- Expanded the geographic coverage of Ethernet.
- disadvantages
- The collision domain is larger, but the overall throughput is not.
- If different collision domains use different data rates, they cannot be connected by hubs.
- advantages
Extend Ethernet at the data link layer
The more common way to scale Ethernet is at the data link layer.
At first, people used Bridges.
- The bridge forwards and filters the received frames based on the destination address of their MAC frames.
- When the bridge receives a frame, it does not forward the frame to all interfaces. Instead, it looks up the address table of the bridge based on the destination MAC address of the frame and determines which interface to forward the frame to or to discard it (filtering).
Now use an Ethernet switch.
Features of Ethernet switches
- An Ethernet switch is essentially a multi-interface bridge. There are usually a dozen or more interfaces. Each interface is a collision domain.
- Each interface is directly connected to a single host or another Ethernet switch and generally operates in full-duplex mode.
- Ethernet switches are parallel. It can connect multiple pair interfaces at the same time, so that multiple pairs of hosts can communicate at the same time.
- Hosts that communicate with each other have exclusive transmission media,Data transfer without collision.
Advantages of Ethernet switches
- Users enjoy exclusive bandwidth, increasing the total capacity.
- When switching from a shared bus Ethernet to a switched Ethernet, the software, hardware, and adapters of all connected devices do not need to be changed.
- Generally, Ethernet switches have multi-speed interfaces, facilitating users in different situations.
Bus Ethernet uses the CSMA/CD protocol and works in half duplex mode. Ethernet switches, however, do not use a shared bus and do not have collision problems, so they do not use the CSMA/CD protocol and work in full duplex mode. Why is it called Ethernet when you don’t even use the important Protocol CSMA/CD (and the associated “race period”)? The reason for this is that the frame structure is the same as the Ethernet frame structure.
Virtual LAN
- Using Ethernet switches, Virtual LAN(VLAN) can be easily implemented.
- In the IE802.1Q standard, virtual LAN vlans are defined as follows:
- A VIRTUAL local area network (VLAN) is a physical location-independent logical group composed of LOCAL area network (LAN) segments that have certain common requirements. Each VLAN frame has an explicit identifier that indicates which VLAN the computer that sent the frame belongs to.
- Virtual LAN is only a service provided by LAN to users, but not a new LAN.
- Because virtual LAN is a logical combination of users and network resources, it can easily recombine related devices and resources according to needs, so that users can access the required resources from different servers or databases.
- When B1 sends data to the members of the VLAN2 workgroup, workstations B2 and B3 will receive the message broadcast by them.
- When B1 sends data, workstations A1, A2, and C1 in VLAN1 and VLAN3 do not receive broadcast messages from B1.
- Virtual lans limit the number of workstations that can receive broadcast messages so that network performance does not deteriorate due to excessive broadcast messages (known as broadcast storms).
Advantages of virtual LAN
- Improved performance
- Simplified administration
- Reduced costs
- Improved security
Method of dividing virtual LAN
-
Based on switch ports
- The simplest and most commonly used method.
- Belongs to the method of dividing virtual LAN at the first layer.
- Disadvantages: Does not allow the user to move.
-
MAC address based on computer network card
- Divide virtual Lans based on MAC addresses of users’ computers.
- Belongs to a method of dividing a virtual LAN at layer 2.
- Allows the user to move.
- Disadvantages: You need to enter and manage a large number of MAC addresses. If the MAC address of a user changes, the administrator needs to reconfigure the VLAN.
-
Based on protocol Type
- Determine which virtual LAN the protocol of this type belongs to according to the third field “Type” field of the Ethernet frame.
- Belongs to a method of dividing a virtual LAN at layer 2.
-
Based on the IP subnet address
- Determine the VIRTUAL LAN to which the IP group belongs according to the type field of the third field in the Ethernet frame and the source IP address field in the IP packet header.
- Belongs to the method of dividing virtual LAN at the third layer.
-
Based on high-level applications or services
- Divide virtual lans by high-level applications or services, or a combination of them.
- More flexible, but more complex.
Ethernet frame format used by the virtual LAN
- IEEE approved the 802.3AC standard, which defines an extension of Ethernet’s frame format to support virtual lans.
- The VIRTUAL LAN protocol allows a 4-byte identifier, called a VLAN tag, to be inserted into the Ethernet frame format to indicate which virtual LAN the frame belongs to.
- The frame generated by inserting VLAN tags is called 802.1Q frame or tagged Ethernet frame.
High speed Ethernet
100 base-t Ethernet
- Can work in full duplex mode without conflict. When working in full-duplex mode, CSMA/CD is not used.
- MAC frame format is still the 802.3 standard.
- Keep the minimum frame length unchanged, but reduce the maximum cable length for a network segment to 100 meters.
- The interval between frames has been changed from 9.6 microseconds to 0.96 microseconds.
Gigabit Ethernet
- Allows 1 Gbit/s to work in full duplex or half duplex mode.
- Frame format specified by IEEE 802.3 protocol.
- The CSMA/CD protocol is used in half-duplex mode, and the CSMA/CD protocol is not used in full-duplex mode.
- Backward compatibility with 10Base-T and 100Base-T technologies.
10 gigabit Ethernet (10GE) and faster Ethernet
- The frame format is the same as 10 Mbit/s, 100 Mbit/s, and 1 Gbit/s Ethernet frames.
- The minimum and maximum Ethernet frame lengths specified in the 802.3 standard are retained for easy upgrade.
- Instead of using copper wire, only optical fiber is used as the transmission medium.
- It only works in full duplex mode, so there are no contention issues, and it does not use the CSMA/CD protocol.
- Faster Ethernet
Ethernet is used for broadband access
- Can provide two-way broadband communication.
- You can flexibly upgrade bandwidth based on users’ bandwidth requirements.
- It can realize end-to-end Ethernet transmission without the need for frame format conversion. This improves the data transmission efficiency and reduces the transmission cost.
- However, user authentication is not supported.