TCP/IP Model - How Internet Works in Reality
Background
Last week we introduced the OSI Model, the theoretical model that helps networking engineers plan and design networks. Today, we will introduce another widely used network architecture that provides a framework for communication between devices over the internet, TCP/IP model.
The International Organization for Standardization (ISO) developed the OSI model in the late 1980s. It was designed as a conceptual framework to guide the development of network protocols. On the other hand, the TCP/IP model was developed by the US Department of Defense (DoD) in the 1960s on a small scale, which later evolved into the modern internet. The TCP/IP model was implemented and widely adopted before the OSI model gained significant traction. Therefore, we use the OSI model as an architectural blueprint to explain and plan a network. At the same time, we can find the TCP/IP model in real applications as the boundaries of layers blend.
Instead of seven layers, the TCP/IP model has only four layers. From high level to low level, they are Application Layer, Transport Layer, Internet Layer, and Network Interface Layer. Before we dive into the details of what individual layers do, there is one important point to clarify that will help us understand the naming convention better.
TCP/IP model is often referred to as Internet Protocol Suite. A protocol is a set of rules that define how a process is done. What input shall be taken? What output shall be produced? TCP and IP are the first two protocols developed in the early days of the Internet. And the model that represents the Internet is named after these two. However, with the rapid growth of civil adaption, more diverse and customized functionalities emerged. The Internet can transmit images and videos instead of plain text. To serve and regulate the new implementations, many protocols are defined to standardize the transmission. Hence, the modern TCP/IP model represents a group of protocols for Internet communication.
In the following session, we will have a closer look at these two fundamental protocols, as most of the rest protocols are built on top of the two. Later, we will introduce some important protocols in each layer. And chain them up with the newsletter example at the end.
TCP and IP
IP stands for Internet Protocol. It locates in the L2 - Internet Layer. It defines routing and logical addressing of packets allowing data to traverse the Internet using the logical addressing schema, IP addresses. You can compare an IP address with a physical postal address. They are both invented artificially and assigned according to an artificial rule. And delivering a piece of information is done using a navigation system (the protocol) to find the best route, traveling from one intermediate address to another until it reaches the destination. You might remember that we discussed another way of locating devices in the OSI Model, the MAC addresses. The two are linked but work in different scopes. MAC address only plays a role when the data reaches the switch of your local network. And the switch will use a look-up table to convert the IP address attached to the packet to MAC address and send the packet to the end device, like a laptop. A computer can multitask with the Internet, like sending/receiving files, browsing, etc. An IP address can be further divided into hundreds and thousands of ports for all services running on it.
TCP stands for Transmission Control Protocol. It locates in the L3 Transport Layer. It defines a series of rules for the connection between sources and destinations so that the data will be sent reliably. The major functionalities are shown in the diagram below.
However, reliability means slow transmission. Another protocol, UDP (User Datagram Protocol), is invented to trade reliability for high speed. And it is mainly used in live video and audio streaming, where missing data is less critical than latency.
Four Layers of TCP/IP Model and Their Protocols
In this section, I will introduce some most important protocols for each layer that will be used for me to send newsletters.
L4 - Application Layer. Similarly, this layer is closest to the end-user. It groups L7 - Application, L6 - Presentation, and L5 - Session layers from the OSI model into one layer.
Some Important Protocols in L4 | Functionality |
---|---|
Domain Name System (DNS) | Resolve a domain name to its corresponding IP address lium.tech → 198.185.159.145 |
Dynamic Host Configuration Protocol (DHCP) | Assign IP address configurations to devices on a network |
Hypertext Transfer Protocol Secure (HTTPS) | Retrieve the content of a web page from a web server |
Post Office Protocol Version 3 (POP3) | Retrieve emails from an email server. Users can only read after downloading the email from the server. |
Internet Message Access Protocol (IMAP) | Retrieve emails from an email server, replacing POP3. Users can read the email on the server or download it to the client machine. |
L3 - Transport Layer. It remains the same as the OSI model. The two most important protocols, TCP and UDP, are introduced in the above section.
L2 - Internet Layer. It is equal to the L3 - Network Layer in the OSI model. IP is the most important protocol in this layer. ARP (Address Resolution Protocol) is also here. It is the one who creates the look-up table to convert between IP addresses and MAC addresses.
L1 - Network Interface Layer. It combines the L2 - Data Link Layer and L1 - Physical Layer in the OSI model. CSMA/CD (Carrier-Sense Multiple Access/Collision Detection) is a protocol used by Ethernet; CSMA/CA (-/Collision Avoidance) is used by Wi-Fi.
With all the above protocols, the Internet can find a way to help me send my newsletters to you. Here is the summary diagram. I will only draw the last part between your mail server and your phone to save some effort.
Hope now you have a better idea about how the newsletter arrives at your phone mailbox :)