OSI vs TCP/IP model
OSI (Open Systems Interconnection) and TCP/IP both are networking models that describes how a data is sent over a network. It makes data transmission easy and reliable.
Before TCP/IP model there are no such reliable standerd for communication. Different networks uses different ways for communication. (ex. NCP, X.25)
TCP/IP Model
History
- The Defense Advanced Research Projects Agency (DARPA) started the project in late 1960s.
- Vine Cerf and Kahn, scientists at DARPA, designed the TCP/IP model in 1970s
- It was relesed in 1975 with the name of ARPANET (Advanced Research Projects Agency Network)
- ARPANET was renamed as TCP/IP in 1983 and become a open standerd.
- Now TCP/IP is managed by IETF (Internet Engineering Task Force)
What TCP/IP solves
- Interoperability : Makes a Standard for networking in all devices and networks.
- Global Addressing (IP) : Allowed unique identification of every device.
- Routing Mechanisms : Packets can find best path dynamically.
- Scability : Can handle millions of devices.
- Reliable (TCP) : It ensures retransmissions, error handling, acknowledgements.
Architecture / Layers
TCP/IP is made of 4 layers. Each layer should communicate with its neighbouring layer.
Application layer
Application layer is the top most layer of TCP/IP model. It handles end user interactions, data formatting and encodings, session managements etc.
Example : A user enter some information in a login form. Then the data is formatted into a structured formate. And sent to the transport layer for further transmission. And same happens on other end, transport layer sends a structured data to application layer and application layer shows it to the user if necessary.
Some protocols that are used in application layer are : HTTP, HTTPS, SMTP, SNMP
Transport layer
- Data received from application layer are divided into smaller chuncks. For TCP these smaller chunks are called Segments and Datagrams for UDP. In this layer a transport layer header is add to each chunks. Some header like : source port, destination port, sequence number, acknowledgment number, checksum
- There are two main protocols TCP (Transmission Control Protocol) and UDP (User datagram protocol) in transport layer, that doesn't mean transport layer have only these two. Some other protocols are : QUIC, ESP etc.
- After adding the ip headers the chunks are called packets.
Internet layer
The Internet Layer in the TCP/IP model is responsible for addressing, routing, and packet forwarding to ensure data reaches the correct destination across networks.
- It receives data from transport layer and add IP headers (source & destination IP addresses, TTL etc.), determines the best path then send it to network access layer. At the destination device it Decapsulate / exract IP headers and transfer the remaining to transport layer.
- Data at this layer are called IP Packets.
- Some protocols at this layer : IP, ICMP, ARP, RARP
Network access layer
Network access layer is also known as link layer is responsible for transmitting the data physically with the help hardwares.
- The packets received from internet layer are wrapped inside a header and trailer.
- After wrapping the data is called frame.
- Trailer area used for error detections.
- Frames are converted into bits (0,1) and transfered to the destination through a physical medium.