Stanford CS144笔记(一)

Networked Applications

  1. World Wide Web
  2. BitTorrent
  3. Skype
  4. ......

Layerd Internet Model

Ineternet is a huge and complicated project, for simplifying the developments of Internet, The pioneers of internet designed a "4 Layer Internet Model".

This model divide Internet into 4 layer: Application layer, Transport layer, Network layer and Link layer.

The following picture illustrated the "4 Layer Internet Model"

The job of Link layer is carry the data over one link at a time.

  • Data is in packets( packet is the data we want deliver along with a header tells the network where the packet is be delivered, where it came from).
  • Data is delivered hop-by-hop each link in turn.
2. Network layer

The job of Network layer is to deliver packets end-to-end across the Internet from the source to destination.

  • Network layer will invoke the service provided by Link layer to deliver packets.

  • Network layer don't need to kwon how Link layer complete his task.

Modularity:

  • This separation of conerns between Network layer and Link layer allows each to focus on it's own job without worrying about how the other layer work.
  • It means that a single Network layer has a common way to talk to many different Link layers by simply handing them datagrams to sent.

Network layer is "special":
We must use the Internet Protocol(IP).

  • Best effort, but it makes no promises.
  • IP datagrams can get lost, can be deliver out of order, and canbe corrupted, there are no guarantees.
3. Transport layer
  1. TCP(Transmission Control Protocol)
    1. Reliable data transfer.
    2. Congestion control
    3. Flow control
  2. UDP(User Datagram Protocol)
4. Application layer
  1. HTTP (World Wilde Web)
  2. SMTP (Email)
  3. DNS (Domain->IP address)
  4. Peer-to-Peer(BitTorrent)
5. Put it all together

We say that each layer communicates with its peer layer.

A complete process of transmission of Application data through Internet.

6. 7-layer OSI(Open System Inerconnection) Model

In the 1980s, ISO(International Standards Organization) created a 7-lay Internet Mode.

The IP Service Model

Each layer provides a "sevice" to the layer above.

1. Properties

2. Why the IP service so simple?
  1. Simple, minimal: Faster, more streamlined and lower cost to build and maintain.
  2. The end-to-end principle: Where possible, implement features in the end hosts.
  3. Allows a variety of reliable (or unreliable) services to be built on top.
  4. Works over any link layer: IP makes very few assumptions about the link layer below.
3. Some details

1, Tries to prevent packets looping forever. To do this IP adds a hop-count field in the header of datagram, called TTL(Time To Live)
2. Will fragment packets if they are too long. IP is designed to run over any kind of link, most links have a limit on the size of the packets they can carry.
3. Uses a header checksum to reduce chances of delivering datagram to wrong destination.

The checksum is the result of adding the data bit by bit and inverting the sum. When verifying the checksum, add the data bit by bit and add the checksum. If it is equal to zero, the verification is passed.

IPv4 Datagram
The format of IPv4 Datagram:

IPv4 Datagram capture by wireshark.

4. Summary

We use IP every time we send and receive datagrams.

IP privides a deliberately simple service:

  • Datagram
  • Unreliable
  • Best-effort
  • Connetionless
CS专业在读,热爱编程。
专业之外,喜欢阅读,尤爱哲学、金庸、马尔克斯。
原文地址:https://www.cnblogs.com/jmhwsrr/p/14014822.html