Bits and Bytes of network
Published: 2022-10-23 10:13:48

Computer network explains how computer can connect to each other.
We'll discuss TCP/IP model and its layers in depth.
Each layer helps the next layer below and above it.

## TCP/IP model

It is a five layer model

1. Physical layer
It represent physical device that connect computers like cables
It describes how signals are sent

2. Data link layer
It is also network access layer
We introduce our first protocol here, defines common way of interpreting signals
Ethernet is used here, ethernet standard defines protocol tog et data

3. Internet layer/ Network layer
Devices connect through routers
Responsible for data delivered across different network
IP is used in this layer, its heart of internet
Network software is divided in client and server
A single node may be running 1+ client and server applications like email and web server.

4. Transport layer
It sorts which client and server program are supposed to get that data.
Data gets to right applications running on nodes.
TCP/IP is used here.
There are different protocol serving different purposes
UDP uses IP.

TCP provides  mech to ensure data is transferred while UDP don't.

5. Application layer
It is application specific
Send and receive email with protocol


## Understanding layers better 
 
Delivery truck and road - Physical Layer
How  delivery gets from one intersection to next - Data link layer
Which road to be taken from address a to b - Internet layer
Delivery drives knocks your door - Transport layer 
Your package itself - Application layer

The primary difference between our five layer model and the seven layer OSI model is that the OSI model abstracts the application layer into three layers total.

## Cables

Network devices and cables allow computers to connect to each other.
Cables connect devices and allow data transfer.
Copper and fiber optics cables are used widely.
These wires carry binary data and system at other end translated this data.
CAT 5 (older), CAT 5E and CAT 6 are used, different in number of twists in wire.
CAT 5's internals reduces crosstalk.
Higher level protocol detect missing data and request to send data again.

CAT 6 are  more expensive, fast data transfer.

Fiber cables have individual optical fibers and transfer beams of lights, uses pulses of light. Transfers data quicker.

## Hubs and switches

Hub is physical layer device, allows connection of many computers at once. Each devices is connected to hub, to check if the message is for them or not. It leads collision. It slows down the process.
It is layer 1 device.

Switch is also known as switching hub, similar to hub.
You can connect many devices. It is layer 2 or data link devices.
It can determine for which system data is intended for and sends data to only that system.

## Routers

Hubs and switches are primary devices for LAN. 
When you want to send data to other networks, router helps.
It operates at layer 3, network layer.
It inspects IP data and knows where to send data.
Router has routing tables, takes traffic to ISP.
It has many different connections to different router, uses PGP.
Traffic is travelled to dozens of routers.

## Client and Server

Server - Provides data to something requesting data
Client - Asks for data

Each node can be both client and server.