Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How are Ethernet frames sent?
How are Ethernet frames sent?
Ethernet with IEEE 802.3 standard is the most widely used in the two-layer switching network. At present, more than 90% of local area networks in the world are composed of Ethernet technology. With the development of Ethernet technology, it has entered the fields of access network and metropolitan area network. In this lecture, the author puts forward a new viewpoint that there is virtual circuit in Ethernet switching technology.

Classification of 1 Ethernet

The characteristic of Ethernet is that multiple data terminals share the transmission bus. Ethernet can be divided into 10 Mbit/s Ethernet, 100 Mbit/s Ethernet, 1 000 Mbit/s Ethernet and 10 Gbit/s Ethernet according to its bus transmission rate. Ethernet can be divided into coaxial cable Ethernet, twisted pair Ethernet and optical fiber (multimode, single mode) Ethernet according to its bus transmission medium.

2 carrier sense multiple access/collision detection (CSMA/CD) protocol

* * * The core idea of Pleasant Ethernet is that multiple hosts share a common * * * transmission channel. Time division, frequency division or code division are adopted in telephone communication, so that multiple user terminals can share a common transmission channel. However, in data communication, data is sudden, and if fixed time slots, frequency bands or channels are occupied for data communication, resources will be wasted.

If multiple hosts * * * share a common transmission channel (bus) without taking any measures, collisions and conflicts will inevitably occur. CSMA/CD protocol is formulated to solve the problem of multiple hosts competing for common transmission channels.

(1) Carrier Sense Multiple Access (CSMA)

Each Ethernet frame (MAC frame) has a host and its physical address (MAC address). When a host on the network wants to send a MAC frame, it should listen to the channel first. If the channel is idle, send it; If a carrier (baseband signal) is found on the channel, it will not be sent, and it will be sent immediately or delayed for a random time when the channel is idle, thus greatly reducing the number of collisions.

(2) Collision Detection (CD)

For conflict detection, generally speaking, when the signal swing on the bus exceeds the normal value, it is considered that a conflict has occurred. This detection method is easy to make mistakes, because there is attenuation when the signal propagates on the line. When the two hosts are far apart, the signal of the other host is already weak when it arrives, and when it is superimposed with the signal sent by the local host, it cannot reach the amplitude of conflict detection, and an error will occur. To this end, IEEE 802? The length of the cable is limited in the standard. At present, the widely used conflict detection method is that the sending end of the host sends data to the cable, and the receiving end of the host receives the data back, and then compares it with the sent data to determine whether it is consistent. If they are consistent, there will be no conflict; If they are inconsistent, there is a conflict.

3 MAC frame format

Each frame starts with a 7-byte preamble. The preamble is an alternating code of "10 10", which is used to synchronize the receiver clock of the destination host and the transmitter clock of the source host. Followed by the frame start delimiter byte "1010101"to indicate the start of the frame.

A frame includes two addresses: a destination address and a source address. If the highest bit of the destination address is "0", it means an ordinary address; If it is "1", it means the group address. The next highest bit of an address is used to distinguish whether it is a local address or a global address. The local address is assigned by the local network administrator. Without this local network, the address is meaningless. The global address is uniformly assigned by IEEE to ensure that no two hosts in the world have the same global address. Approximately 7× 10 13 global addresses are allowed. Global addresses can be used for global MAC frame addressing.

The length of the data field gives how many bytes of data exist in the data field, and its value is 0 ~ 1 500. The length of the data field is "0", which is legal, but a frame that is too short may cause problems during transmission. One reason is that when the host detects a collision, it will stop sending. At this point, some data has been sent to the cable, but the destination host cannot simply distinguish whether it is a correct frame or a junk frame. For this reason, IEEE stipulates that the correct length must be greater than 64 bytes, and if it is less than 64 bytes, it must be filled to the minimum length of the frame with padding fields.

4 Ethernet interconnection

According to the OSI 7-layer model, Ethernet can be interconnected at the lower 3 layers and the upper 3 layers. Network element devices for interconnection include repeaters, hubs, bridges, routers, switches and gateways.

4. 1 repeater

Repeater works in the physical layer of OSI Layer 7 model. Because the digital pulse signal will produce attenuation and waveform distortion after a certain distance transmission, it will cause error code at the receiving end. The role of repeater is to regenerate (amplify and shape) data signals transmitted through the network and expand the scope of local area network.

Repeater works in the physical layer and is completely transparent to the high-level protocols. Two networks connected by repeaters are equivalent to one network at the link layer. Repeaters only extend the distance, but cannot provide isolation and expand the effective bandwidth.

4.2 Hub

A hub is like a multi-port repeater with a star structure, and each port has the ability to send and receive data. When a port receives data from a host connected to the port, it forwards the data to other ports. Before data forwarding, each port regenerates, shapes and retimes it.

Hubs can be connected in series into a multi-stage star structure, but the two hosts farthest apart are limited by the maximum transmission delay and can only be connected in series for several stages. When there are too many connected hosts, the bus load is heavy, and conflicts will occur frequently, which will lead to the decline of network utilization.

Hub, like repeater, works in the physical layer of OSI 7-layer model and can't provide isolation, which is equivalent to multi-port repeater.

4.3 Bridges

The bridge works in the link layer (MAC layer) of OSI 7-layer model. When an Ethernet frame passes through a bridge, the bridge will check the source and destination MAC addresses of the frame. If the two addresses belong to different networks, the bridge will forward the MAC frame to the other network, and vice versa. Therefore, the bridge has the function of filtering and forwarding MAC frames, which can isolate the network. For the * * * shared network, the isolation between networks means improving the effective bandwidth of the network.

The simplest form of bridge is a dual-port bridge connecting two LANs. When multiple LANs are interconnected, in order not to reduce the effective bandwidth of the network, multi-port bridges or Ethernet switches can be used. However, using these devices working at the link layer has the following disadvantages:

(1) A multiport bridge or Ethernet switch has only a simple routing table. When a port receives a data packet, if the device can't find the corresponding output port according to the destination address, it will broadcast the data packet to all ports, which will easily cause a broadcast storm in the case of a large network.

(2) Multi-port bridges or Ethernet switches do not have the function of link layer protocol conversion, so it is impossible to realize the network interconnection between Ethernet and different protocols such as X.25, FR, N-ISDN and ATM.

4.4 router

There is a huge and complex routing table in the router, which can be maintained in time according to the changes of network topology and load. When the router can't find the corresponding output port of a packet input by a port, it will delete the packet. Because the router abolished the broadcast mechanism, it can suppress the broadcast storm.

4.5 gateway

Gateway works in the upper three layers of OSI 7-layer model, namely, dialogue layer, presentation layer and application layer. Gateway is used to interconnect two completely different networks, which is characterized by the conversion function of high-level protocols. The most typical application of gateway is IP telephone gateway. IP telephone gateway will time-division multiplex 64 kbit/s coded voice and No? 7*** channel signaling is converted into IP packets and sent to the Internet for transmission, so that two completely different networks, PSTN and Internet, can be interconnected.

5 Ethernet switch

5. Basic principle of1Ethernet switch

In order to improve the efficiency of large-scale network, it is necessary to segment the network at the link layer to improve the effective bandwidth of the network. For small networks, bridges can be used to segment the network; For large-scale networks, Ethernet switches are often used to segment the network, that is, an exclusive Ethernet is divided into several network segments by Ethernet switches. A segmented network is called a switched Ethernet. In switched Ethernet, CSMA/CD mechanism is still used by hosts working in various network segments, while routing mechanism is used by switches connecting various network segments. If an exclusive Ethernet has m bandwidths and * * has n hosts, the average bandwidth of each host is m/n. If 8 Ethernet switches are introduced into the network and the network is divided into 8 segments, the bandwidth of each segment is still m, and the total bandwidth is widened to 8M.

At present, large and medium-sized Ethernet has introduced multi-switch cascade working mode. Generally, a user-level switch can connect 1 port to 1 host, so the host can enjoy all the bandwidth of the connected port without competing for network resources.

After introducing switches into Ethernet to segment the network, can the network capacity be expanded indefinitely? The answer is no, because the addressing of MAC frames in Ethernet switches is broadcast, it is easy to cause broadcast storm when the network is too large. This requires the router to segment the network at the network layer. The router divides the computer network into several subnets, thus reducing the broadcast domain of its underlying Ethernet and suppressing the broadcast storm.

5.2 Routing mode of Ethernet switch

When a port in the switch receives a MAC frame, the first task of the switch is to find the output port according to the destination address of the MAC frame, and then forward the MAC frame to the output port.

Usually, there is a routing table in an Ethernet switch, which selects the output port for each MAC frame according to the destination address of the received MAC frame.

(1) Fixed route

Fixed routing means that the switch has a manually configured routing table that indicates each port and its corresponding destination address. Although fixed routing is a routing method, if the network scale is too large, configuring the routing table will become a very heavy task. In addition, the network where the switch is located often changes the network configuration or adds or deletes hosts, so it is difficult for the network administrator to update the routing table in time to adapt to the topology changes.

(2) Self-learning routing

In practical application, the dynamic routing table is usually established by self-learning method to automatically adapt to the changes of network topology. Dynamic routing table can be obtained through self-learning process on the basis of manual routing table establishment.

The so-called self-learning is to establish or refresh the routing table according to the source address of the MAC frame arriving at each port. Suppose the switch receives a MAC frame from the X port and checks that the source address of the MAC frame is the A address, which means that all MAC frames with the destination address of the A address should be forwarded through the X port. After receiving the MAC frame with the source address of A from the X port, the switch control section checks the routing table. If there is no A address in the destination address entry in the routing table, the content of A address is added to the destination address entry corresponding to the X port; If a destination address in the routing table is an A address, but its corresponding port is a Y port, the routing table needs to be modified.

As can be seen from the above, Ethernet switches use broadcast frames and self-learning methods to establish routing tables. After the routing table is configured, subsequent Ethernet frames will select routes according to the destination MAC address (unmarked) and the routing table, thus forming a virtual circuit from the source host to the destination host.