This is the 11th day of my participation in the Gwen Challenge.More article challenges
1. ARP protocol
Address resolution protocol
1.1 IP Address and MAC Address
- MAC addresses are used by the data link layer and the physical layer
- An IP address is an address used by the network layer and other layers
1.2 ARP Address Resolution Protocol
The basic function is to query the MAC address of the target device based on the IP address of the target device to ensure smooth communication. Convert an IP address to a physical address. However, IPv6 is no longer in use and has been replaced by the Neighbor Discovery Protocol (NDP).
1.3 ARP Working Mechanism
Message format
Ethernet transport layer
Each COMPUTER or router that is installed with TCP/IP has an ARP cache table. The IP and MAC addresses in the table correspond one by one, as shown in the following table.
When host A wants to send AN IP packet to host B on the LAN, host A searches for host B’s IP address in the ARP cache.
-
If yes, it checks the hardware address in the ARP cache, writes the hardware address to the MAC frame, and sends the MAC frame to the hardware address through the LAN.
-
If not, then:
-
The ARP process sends an ARP request packet on the local LAN
-
All ARP processes running on hosts in the area receive this ARP request group
-
When host B sees its OWN IP address in an ARP packet, host B sends an ARP response packet to HOST A and writes its own hardware address. The response packet is unicast.
-
After receiving the ARP response packet from host B, host A writes the mapping between host B’s IP address and hardware address into its ARP cache
-
In addition, if the sending host and the destination host are not on the same LAN, they cannot communicate with each other directly even if they know the MAC address of the destination host. In this case, the sending host obtains a MAC address that can access a router outside the LAN, rather than the actual MAC address of the destination host. All subsequent frames sent from the sending host to the destination host will then be sent to the router and sent out through it. This situation is called entrusted ARP or ARP Proxy.
-
TCP three handshakes and four waves
1. Three handshakes
2. Wave four times
The difference between HTTP and HTTPS
Refer to the link: www.mahaixiang.cn/internet/12…
- HTTP: hypertext transfer protocol, HTTPS: secure socket hypertext transfer protocol
- HTTPS adds SSL to HTTP. SSL relies on certificates to verify the identity of the server and does not encrypt communication between the browser and the server
- For HTTPS, you need to apply for a certificate from the CA
- HTTP port: 80, HTTPS port: 443
The HTTPS protocol has the following functions:
(1) Establish an information security channel to ensure the security of data transmission;
(2) Confirm the authenticity of the website
Get and POST
-
The most intuitive difference: The GET argument is contained in the URL, while the POST argument is passed through the Request body
-
Essence: Both are TCP links, and there is no difference. However, due to HTTP regulations and browser/server restrictions, they are applied differently
-
The most important difference: GET produces one TCP packet, while POST produces two
- For get requests, the browser sends both HTTP headers and data, and the server responds with 200.
- For POST, the browser sends a header, the server responds with 100 continue, the browser sends data, and the server responds with 200 OK.
Not all browsers send packages twice in post, Firefox only sends them once
5. TCP and UDP are different
UDP does not need to establish a connection before transmitting data. After receiving a UDP packet, the remote host does not need to confirm the connection. Although UDP does not provide reliable delivery, it is the most efficient way to work in certain situations (generally used for instant messaging), such as QQ voice, QQ video, live streaming, etc
TCP provides connection-oriented services. The connection must be established before the data is transferred and released after the data is transferred. TCP does not provide broadcast or multicast services. Because TCP to provide a reliable, connection-oriented transport service (TCP and reliable in TCP before passing data, there will be three times handshake to establish a connection, and in data transmission, are confirmed, the window, the retransmission, the congestion control mechanism, in after the data transfer, disconnected will also be used to save system resources), the hard to avoid increased a lot of overhead, Such as validation, flow control, timer and connection management. This not only makes the header of the protocol data unit much larger, but also takes up a lot of processor resources. TCP is used for file transfer, email sending and receiving, and remote login.