The physical layer and data link layer of network learning

OSI seven-layer model: The
OSI (Open System Interconnection) seven-layer network model is called the Open System Interconnection Reference Model, which is a logical definition and specification;
the network is logically divided into 7 layers. Each Each layer has related and corresponding physical devices, such as routers and switches; the
seven-layer model mainly includes: physical layer, data link layer, transport layer, network layer, presentation layer, session layer, and application layer. :

Insert picture description here

However, it is not practical, so we generally use the TCP/IP four-layer model.
Insert picture description here

Physical layer
Physical layer: Responsible for the transmission of optical/electrical signals, such as the current common network cable (twisted pair) of Ethernet, the coaxial cable used in early Ethernet (now mainly used for cable TV), optical fiber, and current wifi The wireless network uses electromagnetic waves, etc., which all belong to the concept of the physical layer.
The ability of the physical layer determines the maximum transmission rate, transmission distance, anti-interference, etc. Hubs work at the physical layer.
Although the physical layer has many types of transmission media, physical interfaces, and their communication protocols, the technology and procedures are all There are many, but the function is relatively simple. Its main energy supply is :
(1) Building a data path;
(2) Transparent transmission;
(3) Data transmission;
(4) Data coding;
(5) Data transmission management: For example, flow control based on bit stream transmission, error control, activation and release of physical lines, etc.

The transmission medium of the physical layer:
1. Twisted pair cable
2. Coaxial cable
3. Optical fiber

Data link layer
Data link layer: Mainly carry out MAC address (network card address) encapsulation and decapsulation of data received from the physical layer. For example, the driver of the network card device, frame synchronization (that is, what signal is detected from the network cable is counted as the beginning of a new frame), conflict detection (if a conflict is detected, it will be automatically retransmitted), data error checking and other tasks. There are Ethernet, Token ring network, wireless LAN and other standards. Switches work at the data link layer. The data at this layer is often called a frame.

Reasons for the existence of the data link layer:
1. Due to the diversity of the physical layer transmission media, there are more protocols and the performance is also unstable, and the data link layer does not consider the difference between the transmission media and communication protocols on different physical links , Just logically establish a logical data channel with stable performance and not affected by the type of transmission medium.
2. The data in the physical layer is transmitted bit by bit, which is not only inefficient, but also prone to errors. Therefore, the data link layer is transmitted in units of "frames". A frame usually has thousands of bits. Not only does the transmission efficiency increase, but it is also less prone to errors.

Data link layer structure:
1. Logical link control (LLC) is the
main power supply: data link management, encapsulation and framing, transparent transmission, and error control.
2. Medium Access Control (MAC)
The purpose of setting the MAC sublayer is mainly to solve the ring contention and addressing of multi-channel communication, so it is more suitable for broadcast links and point-to-point links.
The main functions of the MAC layer include: data frame encapsulation/unloading, frame addressing and identification, frame reception and transmission, frame error control, media access conflict control, etc.
Insert picture description here

Summary of physical equipment at the data link layer:

Computer network card:
1. Wired Ethernet
2. WLAN wireless network

Bridge:
Insert picture description here

name Floor Features
Hub Physical layer Signal amplification, no MAC address table
Repeater Physical layer Connect multiple network segments of the same LAN to amplify the signal and extend the signal transmission distance
Network card Physical layer and data link layer Data encapsulation and decapsulation, link management, data encoding and decoding
Bridge data link layer The interconnection of various local area networks
Layer 2 switch data link layer Determine the optimal route and forward data frames
router Network layer Routing, filtering information, network management
Gateway Transport layer, application layer Convert protocol at higher level

The difference between switches and hubs:
(1) Different working levels in OSI: hubs work at the first layer (physical layer), switches at least at the second layer, and more advanced switches can work at the third layer (network layer), The fourth layer (transmission layer) and the seventh layer (application layer);
(2) The data transmission method is different: the data transmission method of the hub is the broadcast transmission of multiple replications, while the data transmission of the switch is purposeful, and the data is only To send to the destination node, it is the first time to use "flooding" broadcast transmission with FF-FFFF-FF-FF-FF as the MAC address when it cannot be found in its own MAC address table. Therefore, the switch is much higher than the hub in terms of data transmission efficiency and channel utilization, and the hub is more prone to "broadcast storm".

The principle of the two-layer switch:

In the Layer 2 switch, it also accesses the MAC address and port mapping table used for data frame forwarding, which lists which MAC address is connected to which port.
Insert picture description here

Guess you like

Origin blog.csdn.net/m0_46551861/article/details/113589055