NETWORKING FOR ETHICAL HACKING | 4 Layer OSI Model



Let's have a look at what data packets are -

DATA PACKETS
After establishment of connection it's time to transfer data. A data packet is the important basic building block in networks.

A packet is the name we give to a self-contained collection of data, plus a header that describes what the data is, where it is going and where it came from.
  • First part is to identify where you want to send it. Every computer, router, switches have an IP Address which is a series of 4 numbers between 0 and 255 seperated by periods. IP addresses are in form xxx.xxx.xxx.xxx.
  • Second part is to format the data for transmission. All data is in binary 0's and 1's. Binary data is inserted into packets (< 65000 bytes). The first few bytes are headers. Each packet has atleast 3 headers ( IP header, Information of sender and receiver, protocol-TCP/UDP ).
  • TCP header has information such as port number.
  • Ethernet header has info such as MAC address for the source and destination.
  • If the packet is encrypted with (TLS)Transfer Layer Security - it consits a TLS header.
4 LAYER OSI MODEL


1. LINK LAYER :
The Internet is made up of end-hosts, links and routers. Data is delivered hop-by-hop over each link in turn. Data is delivered in packets. A packet consists of the data we want to be delivered, along with a header that tell the network where the packet is to be delivered, where it came from ... so on.

Link layer job is to carry the data over one link at a time. Examples of link layer are Ethernet and WiFi

2. NETWORK LAYER
It is the most important layer which delivers packets end-to-end across the internet from the source to the destination.  

Network layer packets are called datagrams. They consist of some data and a head containing the “To” and “From” addresses — just like we put the “To:” and “From” addresses on a letter. 

At the other end of the link is a router. The Link Layer of the router accepts the datagram from the link, and hands it up to the Network Layer in the router. The Network Layer on the router examines the destination address of the datagram, and is responsible for routing the datagram one hop at a time towards its eventual destination. It does this by sending to the Link Layer again, to carry it over the next link. And so on until it reaches the Network Layer at the destination.

The Link Layer is providing a service to the Network Layer. Essentially, the Link Layer says: “if you give me a datagram to send, I will transmit it over one link for you.”

When we send packets into the Internet, we must use the Internet Protocol (IP)

3.TRANSPORT LAYER

The most common Transport Layer are TCP- Transmission Control Protocol (reliable service) and UDP- User Datagram Protocol (non-reliable service).

Transport Layer make sure that data sent by an application at one end of the Internet is correctly delivered.

4. APPLICATION LAYER

Applications typically want a bi-directional reliable byte stream between two end points. They can send whatever byte-stream they want, and Applications have a protocol of their own that defines the syntax and semantics of data flowing between the two end points.

Let's combine all these with an example

When the application has data to send, it hands the data to the Transport layer, which has the job of delivering the data reliably to the other end. The Transport Layer sends data to the other end by handing it to the Network Layer, which has the job of breaking the data into packets, each with the correct destination address. Finally, the packets are handed to the Link Layer, which has the responsibility of delivering the packet from one hop to the next along its path. The data makes its way, hop by hop, from one router to the next. The Network Layer forwards it to the next router, one at a time, until it reaches the destination. There, the data is passed up the layers, until it reaches the Application.

Post a Comment

0 Comments