1. Basic NETWORK TCP/IP

1.1 TCP/IP protocol family

TCP/IP: 1. Associated protocols on the Internet are collectively referred to as TCP/IP. 2. TCP and IP are two protocols. 3. Also said is in the IP protocol communication process, the use of the protocol family collectively.

1.2 Layered TCP/IP Management

The TCP/IP protocol family is divided into four layers: physical layer, network layer, transport layer, and application layer


Supplement:

  1. OSI seven layer protocols: application layer, presentation layer, session layer, transport layer, network layer, data link layer and physical layer
  2. Five layer protocols: application layer, transport layer, network layer, data link layer and physical layer

Advantages of hierarchy:

  1. If the Internet is governed by only one protocol, then when the design needs to change somewhere, the whole thing has to be replaced. Once layered, all you need to do is replace the changing layers. After the interfaces between layers are planned, the protocol design within each layer can be relatively free to change.
  2. The design is also simpler when layered, with each layer only having to consider the tasks assigned to it.

Functions of each layer:

  • Application layer:

Determines the activities that communicate when providing application services to users.

  • The transport layer

Provides direct data transfer between two computers in a network connection.

  • The network layer

To handle packets as they travel across the network, this layer defines the route to each other’s computers and transmits the packets. The role of the network layer is to select a transmission route among many options when it is transmitted to and from the other computer through multiple computers or network devices. A packet is the smallest unit of data transmitted over a network.

  • The link layer

Used to handle the part of the hardware connected to the network. Including the control operating system, hardware device driver, NIC (network adapter commonly known as network card) and optical fiber and other physical visible parts. Hardware categories are within the scope of the link layer.


1.3 TCP/IP Traffic

When the TCP/IP protocol family is used for network communication, the communication with the peer party is hierarchical and sequential. The sending end goes down from the application layer, and the receiving end goes up from the link layer. The diagram below:

The article is used for HTTP as an example:

  1. First, the sender issues an HTTP resource request at the application layer
  2. Then, for the convenience of transmission, the data transmitted from the upper layer is segmented, and each packet is marked with serial number and port number and forwarded to the network layer.
  3. At the network layer, add the MAC address as the communication destination and forward the MAC address to the link layer.
  4. The receiving end receives the data at the link layer and sends the data to the upper layer until the application layer receives the HTTP request from the sending end.

When transmitting data from layer to layer, the sender must print the header information of the layer every time it passes through the layer. The receiver, on the other hand, removes the corresponding header as it passes through layer to layer. The practice of wrapping data information is called encapsulation.

1.4 Protocols closely related to HTTP: IP, TCP, and DNS

1.4.1 IP protocol responsible for transmission

IP: The Internet Protocol (IP) is located at the network layer and transmits various data packets to each other. To ensure that the device is sent to the other party, various conditions must be met. Two important conditions are IP Address and MAC Address.

IP address and MAC Address: specifies the IP address assigned to the node. The MAC address is the fixed address of the nic. The IP address can be paired with the MAC address. The IP address can be changed, but the MAC address is basically unchanged.

Use ARP to communicate by MAC address: Communication between IP addresses depends on MAC addresses. In the network communication two parties in the same LAN situation is very rare, is generally through a number of computers and network equipment to connect to each other. During the transfer, the Address Resolution Protocol (ARP) is used. ARP is a protocol used to interpret addresses. The MAC address of the corresponding party can be traced based on the IP address of the corresponding party.

1.4.2 IP protocol responsible for Transmission

TCP:

1.4.3 IP protocol responsible for transmission

DNS: provides the resolution service between domain names and IP addresses.