Networking fundamentals & OSI model

·

14 min read

What is network?

--If two computers are connected then it is known as network.

--In broader terms it refers to the communication infrastructure used to connect different components and services within a software system.

What is Host?

Any device which get the IP adresses is known as host.(ip adresses is referred downwards)

Different types of Network?

LAN -- refers to local area network

MAN-- refers to metropolitian area network ,where two cities are connected.

WAN-- refers to wide area network.It is used across countries using optical fibre cables.These areof tow types SONET(synchronous optical networking) and FRAME RELAY

What are bits,bytes,mb,MB etc!

bits--> It refers to zeroes and ones in binary.It stands for binary digits.

1bits --> means it contains either 1's or 0's of single digit

1byte--> combination of 8 small bits

1kilobyte(kb)--> combination of 1024 byte forms 1kb

1megabyte(MB)--> It is equal to 8megabits per sec.and 1megabits contain 1024 kilobits

Different types of Topologies--

In computer networking, a topology refers to the physical or logical layout of a network. It defines how devices, such as computers, routers, switches, and other networking equipment, are connected to each other and how they communicate.

The different types of Topologies are:-

  1. Bus topology: In this type of topology, all devices are connected to a single cable or "bus." Data is transmitted in both directions along the bus, and each device listens to the bus to determine whether the data is intended for it.

  2. Star topology: In this type of topology, each device is connected to a central hub or switch. Data is transmitted between devices via the hub or switch, which manages and directs traffic.

  3. Ring topology: In this type of topology, each device is connected to two other devices in a circular arrangement. Data is transmitted around the ring from one device to the next in a unidirectional manner.

  4. Mesh topology: In this type of topology, each device is connected to every other device in the network. This creates multiple paths for data to travel, increasing redundancy and improving reliability.

  5. Tree topology: In this type of topology, devices are arranged in a hierarchical tree structure. Data is transmitted from one level of the tree to another until it reaches its destination.

OSI MODEL

The osi model also known as Open system Interconnection model.It is a conceptual model and tells how data communications takes place between different computer system.

The OSI system consists of seven layers each of which has its specific role:

The layers are:

  1. Physical Layer

  2. Data Link Layer

  3. Network Layer

  4. Transport Layer

  5. Session Layer

  6. Presentation Layer

  7. Application Layer


We will talk in details about each layer and dive in depth in each of the layer:

Physical Layer

: This layer is responsible for the physical transmission of data over a communication channel, such as copper wire, fiber-optic cable, or radio waves. It defines the physical and electrical specifications for the devices and media used for communication.

The topologies of different types are present in these layer.

This layer provides a reliable and error-free communication link between two directly connected devices. It divides the data into frames and performs error detection and correction, flow control, and access control.

  1. It ensures that data is transmitted efficiently and accurately by dividing the data into frames and adding additional information to each frame, such as addressing and error detection and correction.

    Data link layer are of two types:

    LLC(Logical Link Control):

    It is responsible for error detection and flow control

    It identifies the protocol being used and controls the transmiision of data

    MAC(Media Access Control):

    It adds MAC adressses of the sender and receiver.

    Also adds length of frames and checksum.

Some common protocols that operate at the data link layer include Ethernet , Wi-Fi,Bluetooth.

What are frames (as mentioned previously in Data Link Layer)?

Frames are a unit of data in the Data link layer which is responsible for transmitting data over a physical communications link between two devices.Frames are packets of data that are created by adding a header and trailer to the original data.

In simple terms we can say that data link layer transfers in frames and frame contains (Data link layer of adresses of sender + the IP adresses of the destination)

Error detection:

Error detection in the data link layer is the process of detecting errors that may occur during the transmission of data over a communicaiton link.Error can occur due to noise,interference,attenuation or other factors that causes original data to be corrupted.

Network layer

: Works for communications with the other computers or devices.

Router is present in these layer so routing present.

Logical adresses present also known as IP adresses to identify source and destination of packets and adds the IP addresses of the source and desstination .Then it sends the packet to the next netwoek device, like a router ,which reads the destination IP address and forwards the packets to the correct network or computer .

So in conclusion the network layer helps ensure that data packets are delivered to the correct destination by using IP addresses and routing the packets between different networks.

Control Plane:

It built routing tables.Routing protocols are done,this exchange information between routers to establish the best path for a packet to take . The control plane also handles the creation and maintenance of routing tables, which are used by routers to determine the correct path for a packet to take.

Two types of routing present:

1.Static Routing --> we need to setup manually

2.Dynamic Routing --> automatic

Internet Protocol:

It is the protocol that lies in the networking layer.It is a set of rules that govern how data is transmitted over the Internet. It is responsible for routing data packets from the source device to the destination device by providing them with unique IP addresses.

The IP protocol works in conjunction with other protocols, such as TCP (Transmission Control Protocol), to ensure reliable delivery of data across networks. When a device sends a data packet over the Internet, the IP protocol breaks the data into smaller packets and adds routing information, including the source and destination IP addresses, to each packet. These packets are then transmitted over the network and reassembled at the destination device.

There are two versions of IP currently in use: IPv4 and IPv6. IPv4 uses 32-bit addresses, which limits the number of unique addresses available. IPv6, on the other hand, uses 128-bit addresses, providing a virtually unlimited number of unique addresses for devices connected to the Internet.

Subnet Masking:

Subnet masking is a technique used in computer network to divide a larger network into smaller sub networks or subnets.It involves the use of a subnet mask,which is a 32-bit number that is applies to an IP address to identify the network and the host portion of the address.It is expressed in dotted decimal notaion such as 255.255.255.0 which represent a 24 bit subnet mask . The number of 1s in the subnet mask determines the size of the subnet and the number of hosts that can be acccomodated in each subnet.

Reserved address:

127.0.0.0/8 -- Here first 8 bits are reserved

Packets:

Packets are the fundamental units of data that are transmitted across a network. They are formed by breaking down the data into smaller chunks, which are then encapsulated with header information to create a packet.

At the network layer, packets are used to transmit data between different devices on a network. Each packet contains both the destination IP address and the source IP address, as well as other control information needed to ensure reliable delivery of the data.

Packets are essential in modern network communication, as they allow for data to be broken down and transmitted efficiently across different types of networks. By dividing data into packets, the network can allocate resources more effectively and provide reliable delivery of data even when individual packets may get lost or delayed.

In details packets consists of IP adresses, identification ,flags,protocols,checksum addresses , TTL etc

IPv4 and IPv6:

IPv6 is 4 times larger than IPv4 but it is not backward compatible i.e, devices with IPv4 cannot acces IPv6

Middle Boxes:

Extra devices that also interact with the IP boxes :

  1. Firewall:A firewall is a network security device that monitors and controls incoming and outgoing network traffic based on predetermined security rules. At the network layer, a firewall operates by examining packets of data as they travel through the network and deciding whether to allow or block them based on their source, destination, protocol, and other criteria.

  2. Network adresses Translation (NAT):

    NAT is a technique used in computer networking to remap one IP adresses space into another by modifying network address information in the IP header of packets while they are in transit across a traffic routing device.This technique is most often used to allow multiple devices on a private network to share single public IP address.

Transport layer

: The transport layer is responsible for ensuring reliable communication between two devices in a network by providing end-to-end data transport services such as segmentation, error correction, flow control, and multiplexing. It also determines the level of quality of service (QoS) for data transmission and establishes connections and sessions between network endpoints. The most common protocols associated with the transport layer are Transmission Control Protocol (TCP) and User Datagram Protocol (UDP).Transport layer also takes care of congestion control (congestion control algorithms built in TCP)

Checksums:

When you send data over internet , it gets broken up into small packets that are sent individually and then reassembled.To make sure data arrives intact each packet is assigned with a checksum.

A checksum is a value that calculated based on the contents of packet .Its like a fingerprint or signature that uniquely identifies the packet.

Timers:

A timer is a clock that starts counting when a packet is sent and stops counting when a certain amount of time has passed.If the timer reaches its maximum value before the packet reaches its destination , the transport layer assumes that the packet has been lost and resends it.This helps to ensure that all packets are delivered reliably even if some get lost or delayed along the way.

Timers are an important part of the transport layer and they play a crucial role in ensuring that data is transmitted efficiently and accurately across the network.

UDP(User Datagram Protocol):

UDP stands for User Datagram Protocol, and it is a communication protocol used in computer networks. UDP is a simple, connectionless, and unreliable protocol that allows data to be transmitted between devices without the overhead of establishing and maintaining a connection.

UDP is often used for applications that require low latency and do not require the reliability of TCP (Transmission Control Protocol), which is a connection-oriented protocol that guarantees the delivery of data. Examples of applications that use UDP include online games, streaming media, and real-time video conferencing.

One of the advantages of UDP is that it does not require a lot of overhead, which makes it faster than TCP. However, because it is unreliable, UDP packets may be lost, duplicated, or delivered out of order. For this reason, applications that use UDP must be designed to tolerate these kinds of errors.

UDP uses checksums to see if corrupted.

TCP(Transmission Control Protocol):

TCP stands for Transmission Control Protocol, and it is a communication protocol used in computer networks. TCP is a connection-oriented, reliable protocol that ensures the delivery of data between devices.

When two devices establish a connection using TCP, they exchange packets of information to establish the connection, set parameters, and perform a handshake. Once the connection is established, data can be transmitted between the devices in a reliable and ordered manner.

TCP provides several mechanisms to ensure the reliability of data transmission, including acknowledgement of received data, retransmission of lost data, flow control, and congestion control. These mechanisms ensure that data is delivered in the correct order and without errors.

One of the disadvantages of TCP is that it requires more overhead than UDP, which makes it slower. However, TCP is widely used for applications that require the reliable delivery of data, such as web browsing, email, and file transfer.

3 way handshake:

The 3-way handshake is a process used by the Transmission Control Protocol (TCP) to establish a connection between two devices. The 3-way handshake involves three steps:

  1. SYN (Synchronize): The first step is initiated by the device that wants to establish the connection. It sends a SYN packet to the other device, indicating that it wants to start a communication session.

  2. SYN-ACK (Synchronize-Acknowledge): The second step is initiated by the receiving device. It responds with a SYN-ACK packet, which acknowledges the receipt of the SYN packet and indicates that it is ready to communicate.

  3. ACK (Acknowledge): The final step is initiated by the initiating device. It sends an ACK packet to the receiving device, acknowledging the receipt of the SYN-ACK packet. At this point, the connection is established, and data can be transmitted between the devices.

The 3-way handshake ensures that both devices are ready to communicate and that they agree on the parameters of the connection, such as the sequence numbers and window sizes. This process helps to prevent data loss, corruption, or duplication during data transmission.

Session layer:

The Session Layer, located at the 5th layer of the OSI model, is responsible for establishing, managing, and terminating communication sessions between two devices. It establishes a session between two devices by synchronizing the dialog and keeping track of which device is currently speaking.

The Session Layer ensures that data is transferred without errors and that data integrity is maintained by implementing mechanisms such as checkpoints, which enable the retransmission of lost data.

It also provides the ability to encrypt and decrypt data for secure communication. The Session Layer is responsible for managing the length and duration of the session, including session establishment, maintenance, and termination.

Overall, the Session Layer plays a crucial role in managing and coordinating communication sessions between two devices to ensure reliable, secure, and error-free data transfer.

Presentation layer:

The Presentation Layer, located at the 6th layer of the OSI model, is responsible for data translation, compression, and encryption. It ensures that data is properly formatted for transmission and that it can be understood by both the sender and the receiver, regardless of the device or software being used.

The Presentation Layer handles data compression to reduce the amount of data to be transmitted, thus reducing transmission time and bandwidth requirements. It also provides data encryption and decryption to secure data transmission.

The Presentation Layer performs data formatting, which includes data conversion between different data formats, character encoding and decoding, and data compression. The layer also handles data encryption and decryption to ensure secure transmission over an unsecured network.

Overall, the Presentation Layer plays a crucial role in preparing data for transmission, ensuring that it is properly formatted, compressed, and encrypted to ensure secure and efficient communication between devices.

Application layer:

The Application Layer interacts directly with the end-user and provides a variety of network services, such as file transfer, email, remote login, and web browsing. It uses standard application protocols such as HTTP, FTP, SMTP, and Telnet to provide these services.

The Application Layer is responsible for converting data into a format that can be understood by the recipient, including data formatting and code conversion. It also manages the transfer of data between the application and the network, including the establishment and termination of sessions.

Application layer has Client - server architecture and P2P architecture:

client-server architecture:

A client is a device or software application that sends request to a server to perform a particular task.The client may be web browser, mobile application etc.

A server is a device or software that receives requests from clients and responds with the requested information or funciton .The server may be a web server,email server,file server or any other software that provides services to clients.

Advantages include:

Scalability, Relaiablitly ,Security,Efficiency

P2P architecture:

It is where participant in the network can act as both as clients and servers.There is no need of central server thus it promotes piracy.

Cookies:

Cookies are small pieces of data that are stored on your computer or device when you visit a website.They help the website remember things about you,like your login information,your language , preference or the items you've added to your shopping cart.

Third party cookies are cookies that are craeted by a website other than the one you are currently visiting.It is used to track you so that they can show personalised ads.

DNS:

Also known as Domain name System. DNS are mapped to IP addresses .

It is the system used to translate website names into numbers that computer can understand.When you type in a website name,like google.com your computer sends a request to a DNS server to ask for the number that corresponds to that name.The DNS server then looks up the number associated with that webiste and sends it back to your computer ,which then uses that number to connect to the webiste.

A domain name can never be bought you can just rent a domain name.

Top level domains are root DNS servers.(ex- .com,.io,.org)

These all domain name are managed by ICANN (Internet corporation for assigned names and numbers. They register all top level domains)