TCP/IP note

Source: Internet
Author: User
Tags ftp file

TCP/IP note 1.TCP/ IP Layer 4 model: Application Layer (Telnet, ftp, snmp, smtp, etc.), transmission layer (TCP/UDP), network layer (IP, ICMP, and IGMP) and link layer (device drivers and network interface cards ). 2. In the TCP/IP protocol family, the network layer IP provides an unreliable and connectionless datagram transmission service. That is to say, it only sends the group from the source node to the target node as soon as possible, but does not provide any reliability guarantee. If an error occurs, for example, if a vro has used up the buffer temporarily, the IP address has a simple error processing algorithm: discard the datagram and then send an ICMP message to the source, any requirement for reliability must be provided by the upper layer (TCP ). On the other hand, TCP provides a reliable transmission layer on the unreliable IP layer. To provide this reliable service, TCP adopts an end-to-end validation grouping mechanism for timeout retransmission, sending, and receiving. 3. Ethernet format (for example): Except for the Ethernet 14-byte header, the Ethernet frame data must be between 46 and 1500 bytes. 4. TCP and UDP use 16-bit port numbers to identify applications, including the source port and destination port respectively. The servers are generally identified by well-known port numbers. For example, TCP port 21 of the FTP server, TCP port 23 of the Telnet server, and UDP port 69 of the TFTP server. Any TCP/IP implementation provides services using a well-known port number between 1 and 1023. 5. Because TCP, UDP, ICMP, and IGMP both need to send data to IP addresses, the IP header has an ID (8 bit) to mark which layer the data belongs. 1 indicates ICMP, 2 indicates IGMP, 6 indicates TCP, and 17 indicates UDP; TCP and UDP header port numbers identify different applications; the network interface layer must send IP addresses, ARP addresses, and RARP packets respectively. Therefore, the ID (16 bit) must be added to the Ethernet frame header ). 6. The maximum transmission unit (MTU) represents the limit on the length of data frames in various networks. If the transmitted data is larger than the MTU at the link layer, the IP layer must be split. Typical maximum network values: Ethernet (1500 bytes), 802.3/802.2 (1492 = 1500-8), X.25 (576), and point-to-point (296 ). 7. TOS field (4 Bit) in the IP header: Minimum latency, maximum throughput, maximum reliability, and minimum cost. Recommended TOS values for different applications: Telnet/Rlogin requires the minimum transmission latency. Because people mainly use it to transmit a small amount of interactive data. On the other hand, FTP file transmission requires the maximum throughput. The highest reliability is identified to the network management (SNMP) and route selection protocols. The user's Network News (NNTP) is the only application that requires the minimum fee. 8. subnet addressing. IP addresses include network numbers and host numbers. Host numbers are divided into subnet numbers and host numbers. The subnet hides the details of the internal network organization from the external router. Internet data can be first sent to the gateway, and then transmitted to the corresponding subnet router by the gateway, however, the subnet is not transparent to the vrouters In the subnet. 9. Icmp error packets 10. TCP provides a connection-oriented and reliable byte stream service. TCP provides full-duplex services for the application layer. First, a connection should be established through three handshakes (four handshakes are required when both are enabled ), the connection between the sending and receiving channels should be closed after four handshakes (and only four handshakes are needed ). 11.2MSL waiting status: TIME_WAIT status also becomes 2MSL waiting status. For each specific TCP/IP implementation, You must select a Maximum message Segment survival time MSL (Maximum Segment Lifetime ). It is the longest time in the network before any packet segment is discarded. For a specific implementation of the MSL value, the processing principle: when TCP executes an active close, concurrent back to the last ACK, the connection must be in the TIME_WAIT status for two times of MSL. In this way, TCP can resend the last ACK to prevent the loss of the ACK sent earlier. During this TIME_WAIT stay, the plug-in defining this connection (the customer's IP address and port number, the server's IP address and port number) cannot be used again. This connection can only be used after the 2MSL State ends (any late packet segment will be discarded during the 2MSL State ). For the client program, it implies that when we terminate a customer service program and immediately restart the application, the customer program will not be able to reuse the same local port. Generally, the server is passively disabled and does not enter the TIME_WAIT status. The situation varies with the server because the server uses a well-known port. If we terminate a server program that has established a connection and try to restart it immediately, the server program will not assign this well-known port value to its port, because the port is part of the 2MSL connection. Before restarting the server program ~ 4 minutes. 12. TCP sends a reset packet segment (the RST bit in the TCP Header) Whenever an error occurs to the baseline connection ). When a connection request arrives, no process is listening to the target port. A connection is released midway by sending an RST packet segment instead of FIN, which is sometimes called an exception release. 13. semi-open connection: If one party has closed or terminated the connection abnormally, but the other party does not know, such a connection is called semi-open connection. A host exception at any end may cause this situation. As long as you do not intend to transmit data on a semi-open connection, the other party that is still in the connection state will not detect that the other party has encountered an exception. 14. The maximum message length in MSS indicates the maximum data block length transmitted from TCP to the other end. When a connection is established, both parties must notify their respective MSS. When TCP sends a SYN, or because a local application process wants to initiate a connection, or because the host at the other end receives two connection requests, it can set the MSS value to the MTU length on the outbound interface minus the fixed IP header and TCP header.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.