Skip to content

Latest commit

 

History

History
49 lines (28 loc) · 2.18 KB

1.2. The 4 Layer Internet Model.md

File metadata and controls

49 lines (28 loc) · 2.18 KB

1.2. The 4 Layer Internet Model

The 4 Layer Internet Model, from source end to source host:

  • Application
  • Transport
  • Network
  • Link

Link

A data is transfer as pieces, called packets, along with a header. The header tells where the packet is from and to.

The link layer is to carry the data over one link at a time.

Network

The network layer is to deliver packets end-to-end across the Internet from the source to the destination.

Network layer packets are called datagram. They consist of some data and a header containing the To and From addresses.

Routing

When the data source sends a data to the destination, it sends data from the network layer to its link layer.

Then the link layer sends the packet to another link layer of a router. The network layer on the router examinates the destination address of the datagram, and is responsible for routing the datagram one hop at a time towards its destination. It does it by sending to the link layer again, to carry it over the next link. And so until it reaches the network layer at the destination.

Note that link layers may work very differently but the network layer doesn't need to concern about it. It is achieved by the layer separation and well-designed API.

Internet

When we send data to the Internet, it must use the Internet Protocol, or IP:

  • IP makes best effort to deliver datagrams, but no promises.
  • Datagrams can be lost, out of order, or corrupted.

Transport

The transport layer is to add guarantees for data delivery, order, and correctness on the top of network layer.

The common transport layer is Transmission Control Protocol, or TCP

If reliable delivery is not needed, it can use User Datagram Protocol, or UDP. This protocol does not retransmit lost packets and it just moves on.

Application

All application schematics on the Internet that send bi-directional reliable byte stream to each other.

Notes

  • IP is the thin waist of the Internet and it must use IP to use Internet. There are many choices for the application layer (http, smtp, ssh...), the transport layer (TCP, UDP...), and the link layer (WiFi, 3G, Ethernet...), but only one for the network layer. But really? IPFS?