Difference: The switch works at the data link layer and forwards data through the MAC address; the hub works at the physical layer and forwards data through broadcast. The hub uses a bus topology internally, which must be unidirectional at the same time and can only be maintained in half-duplex mode; the channels between the two ports on the switch are independent of each other and can achieve full-duplex communication.
The operating environment of this tutorial: Windows 7 system, Dell G3 computer.
Related recommendations: "Programming Course"
The difference between switches and hubs:
1. Working level
The hub works at the physical layer and is a layer 1 device. Every time a data is sent, all ports can receive it. It adopts the broadcast method, so the network performance is greatly affected. Big restrictions.
The switch works at the data link layer and is a layer 2 device. Each port forms a MAC address forwarding table and forwards data according to the MAC address of the data packet instead of broadcasting.
2. Forwarding method
The working principle of the hub is broadcast mode. No matter which port receives the data, it must be broadcast to all ports. When there are many access devices, Network performance will be greatly affected.
The switch forwards data based on the MAC address. After receiving the data packet, it checks the destination MAC address of the packet and finds the corresponding port for forwarding instead of broadcasting to all ports.
3. Transmission mode
The hub adopts a bus topology. Each node shares a bus for communication. The sending and receiving of data packets adopts the CSMA/CD protocol. On the same It must be one-way within the time and can only be maintained in half-duplex mode. Two ports cannot send and receive data at the same time, and when two ports communicate, other ports work differently.
When two ports on the switch communicate, the channels between them are independent of each other and full-duplex communication can be achieved. Both ports send and receive data at the same time.
4. Bandwidth impact
No matter how many ports a hub has, all ports share a broadband, and only two ports can transmit data at the same time. And can only work in half-duplex mode.
#In short, the network performance of the switch is far better than that of the hub. With the advancement of technology, the cost of switches has been reduced, and hubs have gradually withdrawn from the market.
If you want to read more related articles, please visitPHP Chinese website! !
The above is the detailed content of What is the difference between a switch and a hub?. For more information, please follow other related articles on the PHP Chinese website!