A hub is a physical layer networking device which is used to connect multiple devices in a network. They are generally used to connect computers in a LAN.
A hub has many ports in it. A computer which intends to be connected to the network is plugged in to one of these ports. When a data frame arrives at a port, it is broadcast to every other port, without considering whether it is destined for a particular destination or not.
A switch is a data link layer networking device which connects devices in a network and uses packet switching to send and receive data over the network.
Like a hub, a switch also has many ports, to which computers are plugged in. However, when a data frame arrives at any port of a network switch, it examines the destination address and sends the frame to the corresponding device(s). Thus, it supports both unicast and multicast communications.
|They operate in the physical layer of the OSI model.||They operate in the data link layer of the OSI model.|
|It is a non-intelligent network device that sends message to all ports.||It is an intelligent network device that sends message to selected destination ports.|
|It primarily broadcasts messages.||It is supports unicast, multicast and broadcast.|
|Transmission mode is half duplex.||Transmission mode is full duplex.|
|Collisions may occurs during setup of transmission when more than one computers place data simultaneously in the corresponding ports.||Collisions do not occur since the communication is full duplex.|
|They are passive devices, they don’t have any software associated with it.||They are active devices, equipped with network software.|
|They generally have fewer ports of 4/12.||The number of ports is higher – 24/48.|