Basic Networking Devices
Tags: network
Published: 2023-05-07 13:56:34

A **NETWORK** is a group of inter connected devices.
Network connects computing devices together so as to be able to share resources among each other.
Traditionally a computer network would consist of a desktop computer, server, printer etc.
An example of a group of interconnected device is a switch, router, a wireless access point, a desktop and a phone, all connected to the same network but these days in most home network, the switch and the wireless access point will be built into the router.
Any network in a single area is called Local Area Network (LAN), the LAN is usually connected to the outside world using a socket in the wall provided by your internet service provider, this socket connects you to the Wide Area Network (WAN), the purpose of a WAN is to connect multiple LANs together.

Examples of Basic Networking Devices are: Hubs, Switches and routers.

**Hubs**- a hub's job is to connect devices in your network together. It's a device that has multiple ports that accepts ethernet connections from network devices.
          

## How It Works
If four computers(A,B,C and D) are connected to a hub through 4 different ports and then computer A wants to send to data to computer C, the hub receives the data and then rebroadcast the data through every port connected except the port it received the data from, therefore computer C receives the data but so does computer B and D but they simply discard it.
A Hub supports half-duplex i.e. only one device can send or receive data at a time.
It has no knowledge of addresses, all it does is repeat any data it receives, therefore wasting bandwidth in the process of forwarding it unnecessarily.
It also has security risk because all the host receives everyone's data and a malicious user can steal it.

**Switches**- a switch connects devices together and also learns the devices media access control (MAC) address.
             

## How it works
A switch has something called a MAC address table, the table shows the MAC address of the devices connected to it and which port it is connected to.
If 3 computers (A,B and C) are three newly connected devices to the switch and host A wants to send data to host C, the switch will receive the data and then forward the data out to each port connected to it like how a hub does which means host B and C will receive the data but host B will discard the data but unlike a hub the switch will now learn each connected devices MAC ADDRESS, so when host C send data back to host A it goes directly to host A without broadcasting it to any host that isn't meant to receive the data because the switch now knows exactly where to send the data.
A switch can use full deplex i.e it can send and receive data at the same time, and because it can learn Mac addresses it saves bandwidth and now because only the host is receiving the data, other host can't steal it.

Hubs and Switches can only be used to share data within local area network, they can't be used to share data outside their own network, because to exchange data outside a network, the device needs to be able to read IP addresses which hubs and switches can't read.

**Routers**- a router is a device that routes/forwards data from one network to another based on their IP address. It is like a doorway out of your internal network and into the outside world.
             

## How it works
When a data is received from a device, the router inspects the data's IP address and determines if the data was meant for it's own network or if it's meant for another network. If the data is meant for it's own network, it receives it and if it's meant for another network, it forwards it out to the other network.
So a router is a gateway of networks.

In conclusion, Hubs and Switches are used to create networks while Router are used to connects networks.