What is the “Internet”? (Part 3-1)
Tags: khanacademy, internet, personallearning
Published: 2020-12-12 07:18:24

(You want to read this post in Korean? Check out [here](https://velog.io/@theyunicorn/%EC%9D%B8%ED%84%B0%EB%84%B7%EC%9D%B4%EB%9E%80-%EB%AC%B4%EC%97%87%EC%9D%B4%EC%A3%A0-Part-3-1)!)

In [my last post](https://dev.to/yunicorn/what-is-the-internet-part-2-1530), I learned about what physical infrastructure is needed for the Internet to send and receive information at a global scale. If you remember, this was my first sub-question to a bigger one, ‘How does the Internet work?’.  

My first question was to understand how the Internet sends and receives the information, which is made of bits, between two devices. Now my second sub-question is  

> How does the Internet reliably send and receive information? How does it guarantee that it sent the correct information to the right receiver? 

## Part 3: How does the Internet reliably send and receive information?  

To answer this question, we need to remember the first characteristics of the Internet that we discussed in [my first post](https://dev.to/yunicorn/what-is-the-internet-part-1-1ldj) about the Internet. 

> Communication 
The Internet is essentially a communication system. As such, there are a sender of the data and a receiver of that data. Both should know how to talk to each other (ex: if there are rules/processes, both should know).  

The key point here is that **there are agreed-upon rules and standards that both a sender and a receiver follow** to talk to each other. In other words, when you use the Internet to communicate with your friends, there are a set of rules that you need to follow, and you are actually following. (Technically, your device is following, but you still get my point :)). We call this set of rules and standards ‘protocols’.  

To understand how these protocols play an important role on the Internet, we need to understand how the information is sent and received on the Internet at a high level.  

When you send a message to your friend over the Internet, this message(information) is broken down into smaller blocks. Each of these blocks is sent to the receiver. An interesting fact is that each of these blocks takes a different path to go to its destination, instead of taking the same route. On the receiver side, the receiver device reassembles these blocks into the whole message as each block arrives.  

Each of these blocks is called a **‘packet’**, and we call the method of breaking the information into smaller packets and sending each packet over different routes 'packet switching'. A network that uses this **packet switching method** to transfer data, like the Internet, is called a packet-switched network. Then why does the Internet use this method? 

### (A) Why do we use the packet switching method?
I mainly think about two reasons behind this decision choice. The first reason is **to improve fault tolerance**. In the first post about the Internet, we talked about the background of the Internet invention. The intent of the Internet creation was to create a communication system that can survive under nuclear attack. 

This means that the Internet aims to send and receive information between two entities in an accurate and efficient manner even if some parts of the network are broken. By sending packets over many different routes, the Internet can route packets around problems, if there are ones, and ensures the delivery of the information. As such, this method increases the robustness of communication.  

The second reason is that we can **minimize transmission latency** by efficiently using the network. It is true that sending smaller size information is generally faster than sending the whole message. But this is not the only reason why the packet switching method makes the transmission of the data fast. 

On the Internet, when each packet is sent off its destination, routers control each packet to take the best available route. Here, the best available route does not always necessarily mean that it is the most direct path. Considering non-technical factors such as politics and relationships between companies, and time it would take for data to reach the destination, the cost of using certain paths, the state of the path (whether it is congested) and more, the best available route for each packet would be determined. Since routers on the Internet controls the traffic of the data, it makes the whole network to be more efficient as the network can balance the load across various paths.  

Now as we understand the advantages of using packet switching for data transmission, let’s learn more about ‘packet’.  

### (B) The Structure of Packet
I briefly mentioned the definition of the packet above – a small segment of a larger message. A packet is the basic unit communication on the Internet. ‘A datagram’, ‘a network packet’, and ‘a datagram packet’ are all interchangeable with a packet. A packet has information that contains instructions for where the data needs to go and what the destination system should do once it arrives. How are these instructions are coded?

Like all other information, a packet is a string of bits divided into three main sections: **A set of headers, the payload (the data), and the trailer (the footer)**. A set of headers and the trailer contains the control information, which provides data for delivering the payload, and the payload contains the user data, which is the actual data that is being transmitted.  

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/b2j9613y7i88yt2ipyat.png)

Among three sections, a set of headers is the one that we are most interested in as it contains the important information that controls the transmission of the data that a sender wants to deliver. The trailer contains some bits signaling the end of the packet, but it does not contain more than this information.  

### (C) IP Packet header
Let’s deep dive into the header of the packet here. We know a packet is a package of data to be sent and received between two entities. What information do we need to provide when we send a package to our friends? Address!  
 
A packet needs to have the address of a sender and that of a receiver like a normal package in our world. As we have to follow a certain format of an address to send a package or a mail by using the postal system, there is a rule for addresses on the packet. The structure of the address is defined by Internet Protocol (IP), and we call the address that followed rules defined by IP ‘IP address’. IP describes not only IP address but also other information needed to route a packet in the packet header such as  
- Header Length 
- Packet Length 
- Time To Live (TTL) (the maximum number of network hops a packet can make before it is discarded) 
- Which protocol to use to transport the data 

This kind of information in IP allows devices in different networks to transfer data by relaying packets (we call this action ‘packet forwarding’). We call a packet whose structure is defined by IP ‘IP packet’. Simply put, the IP packet looks like this: 
 ![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/gfkpey4oz7yja4944760.png)

IP records a total of 14 fields in the header and the IP header length is about 20 or 24 bytes. The below image shows well what all fields in the header are and how they are structured. 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/eyfmqx5zjbcrfi1rxql0.png)

Among these fields, I am going to mainly focus on fields that are related to IP addresses, and those that are needed to transport the data reliably to the destination in coming up posts. In this post, let’s just remember that  
- Packets, small segments of a larger message, are transferred on the Internet to increase the efficiency of transmission of the data.  
- Each packet can take different routes to arrive at the same destination to increase the reliability of transferring the data from a source to a destination.  
- Each packet is defined by IP to be routed to its destination.  

In the next post, we are going to learn more about different versions of IP, how each version of IP defines the structure of IP address and what information does each different version of IP address contains. 

Stay Tuned! 

## Next Topic 
Part 3-2:  
- Can we talk more about the IP address? 


#### References:  
- https://www.khanacademy.org/computing/computers-and-internet/xcae6f4a7ff015e7d:the-internet/xcae6f4a7ff015e7d:routing-with-redundancy/a/ip-packets 
- https://kb.iu.edu/d/anyq%20 
- https://www.cloudflare.com/learning/network-layer/internet-protocol/