TCP/IP stands for Transmission Control Protocol / Internet Protocol. It is basically a protocol or set of rules, that was developed by the Department of Defence (DoD) in 1974 about how to send data from computer to another computer across or within a network.
When data is sent across the internet or any network, TCP/IP is the method used to properly route the data. TCP/IP is used to route data across a network so that it is received by the intended recipient computer. TCP/IP goes through four main stages when processing and sending data to another computer.
The application layer is the isn’t layer to understand in the TCP/IP model, as it just refers to applications that exchange data. You are using the application right now, as your browser (Chrome, Internet Explorer, Firefox, etc) are applications. Any application, that end-user use, to exchange data to another computer is an application used within this first stage. Each application will communicate with the Transport layer through a particular port using a particular protocol. For example, most browsers will communicate through port 80 using the HTTP protocol.
Transport Layer (TCP)
The transport layer acts as a mediator between the Application and Internet/Network Layer. This is where the TCP and UDP protocols live. The main purpose of the Transport layer is to permit devices on the source host to communicate with devices on the destination host. Within this layer, the data will be packetised, which means it will be split up into smaller chunks of data and put within packets. When the packets reach the destination the receiver has to put them back together, to enable this each packet will have a header that contains assembly instruction and error checking information. This allows the destination to reassemble the data from the packet and also check to see if any packets did not arrive. Each packet will be tiny in comparison to the original data and will contain about 1KB of data each.
Internet Layer (IP)
The Internet Layer deals with attaching the IP addresses to the packet. Each packet’s header will be given two IP addresses, the destination IP address and the source IP address. This means that each packet will be able to tell who it came from and where it is being sent. This is important, not only to deliver the packet to the correct person but also so the receiver can know who sent the data and whether or not to trust the data. Another reason why the source IP address is attached is to allow the receiver to request more information, such as if a chunk of data is missing and did not arrive.
The Network layer handles MAC addresses that are used for routing on the local area network (LAN). The packets are put inside frames, and the frame header will contain the destination MAC address. If the sender does not know the MAC address of it’s intended receiver it will put its default gateway (usually the router).
When each computer, or network device, receives a frame it will look at the MAC address and send it to that computer. If the MAC address is the same as the network device’s that receives the packet (when the default gateway receives it) then it will open up the frame and look at the packet’s header. It will look at the destination IP address and see if that also matches it’s own IP address. If the IP address doesn’t match it will put the packet into a new frame with a new MAC address that belongs to the intended receiver (using the destination IP address). It then sends the new frame to the destination. When a computer receives a frame, and the MAC address and IP address matches it’s own then it will open up the frame and the packet and consume the data within. It will also destroy the packet and frame, as they are no longer needed.
The TCP/IP model is important for many reasons. It not only allows computers to communicate but it also is designed in a way to allow packet switching to happen. Packet switching allows each packet of data to be sent independently, meaning that they all can find the fastest route across the network or internet separately. Also, TCP/IP can handle data from many different applications, as it doesn’t really care about the data itself, so it simplified networking and data communication.
Each Packet will also have a Time to Live (TTL) for IPv4 communication or a Hop Limit for IPv6 communication. These both effectively achieve the same thing, the packet will eventually destroy itself if it doesn’t receive it’s intended target. This can stop packets from circulating indefinitely around a network. If the receiver of data doesn’t receive a packet, due to it expiring, then it can use the source IP address to request the missing parts.