Home  >  Article  >  Web Front-end  >  [HTTP] Detailed explanation of tcp/ip link layer network layer transport layer application layer

[HTTP] Detailed explanation of tcp/ip link layer network layer transport layer application layer

little bottle
little bottleforward
2019-04-16 11:47:013503browse

1. The seven-layer protocol can be simplified into a four-layer protocol

Link layer network layer transport layer application layer

2. Two networks connected through a router
The network layer ip provides a hop-by-hop protocol, which provides an unreliable service that may be lost in the middle.
The transport layer tcp provides a reliable transport layer based on ip

Metaphor : tcp is the Taobao seller, and ip is the package. If the package is lost in the middle, the seller will resend a package. There will be a confirmation process.
3.udp is unreliable, it will not confirm, and it will be lost if it is lost. Lost, for example, voice uses this, syslog also uses this

4.icmp subsidiary protocol, ping uses this

5. Encapsulation, each layer will leave its own mark. , add a header starting from the application layer, add a header to tcp, add a header to ip, add a header to Ethernet, and encapsulate it into a frame; the data length of the frame is between 46~1500 bytes
6. Divided, the receiver is divided. From the above encapsulation, extract the header

7. Port number, the source port number is usually randomly assigned, and the destination port number is usually a well-known port or For the designated port, be sure to pay attention to whether it is going out or returning, because tcp is full-duplex

8. Link layer, Ethernet and ieee 802 encapsulation
To distinguish between Ethernet and 802.3 encapsulation, you only need to look at Ethernet encapsulation is a 2-bit type, and 802.3 encapsulation is 2-bit long. We generally see Ethernet frames, and rarely see 802.3 frames.
There are only three Ethernet headers, source, destination, and protocol. Type, 0800 represents the ip protocol

Other supplements:
1. The subnet mask tells us which is the network part and which is the host part. For example, the subnet mask is 255.0.0.0, and the ip is 13.0.0.0 tells us that 13 is the network part, and the rest is the host part
2. The gateway is to other network segments. Who should it be given to? For example, my gateway is 192.168.1.1. The function of the router is to connect to different network segments. Forwarding data
3. The MAC address is fixed in the chip when it leaves the factory. It is also called the physical address. It is a 48-bit binary system. What is displayed on the computer is a 12-digit hexadecimal system. For example, mine is 50-7B- 9D-25-B0-EF ipconfig /all
4. The computer network card has a mac address, and the computer has an ip address
5. Data packet: Data-source address-destination address-source mac address-destination mac address (router ) After passing the next hop, the mac address will be modified and transferred to the server step by step

[Recommended course: TCP/IP video tutorial]

The above is the detailed content of [HTTP] Detailed explanation of tcp/ip link layer network layer transport layer application layer. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete