What is the Internet?
The internet is a global network of interconnected devices that share
information.
The protocol suite used to share information is called TCP/IP.
Just like the name "computer science" , TCP/IP is also
somewhat misleading because TCP and IP are not the only protocols used
in the TCP/IP protocol suite (though they are the most fundamental and
well-known).
The TCP/IP protocol suite can be conceptualized as a five-layer
model:
- Application layer
- Transport layer
- Network layer
- Data Link layer
- Physical layer
Application layer
3 things happen on the application layer:
1- The application produces binary data.
2- The protocol we use to send the information is chosen. It could be HTTP, HTTPS, FTP, SMTP or SSH.
3- DNS lookup is done to resolve the IP address of the destination server.
Transport layer
The binary data from the application layer is broken down into small chuncks called segments.
A header is added to each segments containing:
1- The destination port to identify the service we want to access ( by convention port 443 is for HTTPS request and port 25 is for emails)
2- The source port to allow multiplexing (meaning many people can send simultaneous requests from the same network)
3- The sequence number of the segment to be able to assemble it upon reception.
The protocol that defines how these segments are created is called TCP.(There is another protocol that could be used at this layer called UDP, but this is outside of the scope of this course).
At this layer we establish a TCP connection between the source and the destination server.
The protocol defined on the application layer works on top of the TCP connection.
Network layer
We add to the segments an additional header containing the IP source and destination. Turning the segments into packets.
By containing the IP information, the packets can be correctly routed to the destination server.
The Routers are servers that will inspect the packets, check the IP and route the packet closer to the their destination.
Data link layer
This layer is responsible of getting the Mac address of the destination server.
So once the data reaches the destination network, it uses 2 protocols (ARP and Ethernet) to get the MAC address.
The MAC address is added to the packets making it a Frame.
At this point the data is ready to be sent.
The 4 steps that prepare the data to be sent is what we call : encapsulation.
Once the data reaches the destination server the same steps are done in the opposite direction (decapsulation)
Physical layer
When sending information, the binary data is transformed into electrical current and sent through the network.
When receiving information, the electrical current is transformed to binary data and sent back up to the application level passing by all the other layers in the opposite direction.
The most important step in decapsulation happens at the transport layer, where the data is reassembled (thanks to the sequence number in the TCP header) and sent back to the application layer.
