Ok let’s start with hub.
- Belong to Layer 1 (Physical Layer) of the OSI model.
- Connects computers in a network and is a repeater device because any data (aka frame) sent to a particular computer, will be copied and also sent to all the computers in the network.
- Mac address on the frame will be checked by respective computer’s network media. And if the mac address matches the computer’s, data will be further processed. If not, the computer will discard the packet.
- Bandwidth is shared among all computers, hence translate to slower speed. Example, if a hub’s speed is 100 Mbps and 2 pairs of computers are communicating now, then each pair will only have 50Mbps.
- When a computer wants to sent data to all the computers in the network, it will use a broadcast mac address which is FF:FF:FF:FF:FF:FF. When all the network cards received the frame, all the computers will keep and further process the data.
- Hubs are obsolete devices and hardly any current network are using hub.
- Layer 2 (Data Link) of the OSI model.
- It is like a smart hub, where it have a record of all the computers mac addresses and tag the addresses to their respective ports.
- A frame from a computer enter the switch and the switch checks the destination mac address and compares to its internal address table. If there is a match, the switch will forward the data to the respective port destinated to that particular computer.
- Switches have dedicated bandwidth per port. Bandwidth are not shared among ports.
- A switch behaves like a hub when it received a data with a destination address which is a broadcast mac address (FF:FF:FF:FF:FF:FF).
- Layer 3 of OSI model (Network Control).
- Hub and switch connect computers in Local Area Network (LAN), router connects 2 networks together ( eg. LAN to LAN, WAN to LAN etc) using TCP/IP ( Transmission Control Protocol/ Internet Protocol).
- Router also know as Default Gateway when you type ‘ipconfig’ in the command window(Cmd).
- Router uses logical addresses called IP addresses instead of mac addresses to transmit data between different networks and within a network.
- Example of IPv4 (IP version 4) address would be a set of 4 numbers separated by dot. The numbers must be between 0 and 255.
- IPv4 is a 32 bit address system (4 sets of 8 bit, each set separated by a dot(.)) See example of IPv4 here.
- The detail explaination of how these addresses are allocated, across networks and within a network, will be explained in another post called IP Address – all you need to know.
- Another system of router logical address is the IPv6 (IP version 6).
- 128 bit address system, grouped in 8 groups of 4 hexadecimal or 8 groups of 16 bit, separated by colons. See example of IPv6 here.