{"id":103895,"date":"2024-09-03T02:49:11","date_gmt":"2024-09-02T18:49:11","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=103895"},"modified":"2024-09-03T02:49:11","modified_gmt":"2024-09-02T18:49:11","slug":"tcp-ip-protocol","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/tcp-ip-protocol.html","title":{"rendered":"\u5973\u670b\u53cb\u5f0f\u5f97 TCP\/IP \u4e09\u6b21\u63e1\u624b\u4e0e\u56db\u6b21\u6325\u624b"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nTransmission Control Protocol\/Internet Protocol\u7684\u7b80\u5199\uff0c\u4e2d\u8bd1\u540d\u4e3a\u4f20\u8f93\u63a7\u5236\u534f\u8bae\/\u56e0\u7279\u7f51\u4e92\u8054\u534f\u8bae\uff0c\u53c8\u540d\u7f51\u7edc\u901a\u8baf\u534f\u8bae\uff0c\u662fInternet\u6700\u57fa\u672c\u7684\u534f\u8bae\u3001Internet\u56fd\u9645\u4e92\u8054\u7f51\u7edc\u7684\u57fa\u7840\uff0c\u7531\u7f51\u7edc\u5c42\u7684IP\u534f\u8bae\u548c\u4f20\u8f93\u5c42\u7684TCP\u534f\u8bae\u7ec4\u6210\u3002TCP\/IP \u5b9a\u4e49\u4e86\u7535\u5b50\u8bbe\u5907\u5982\u4f55\u8fde\u5165\u56e0\u7279\u7f51\uff0c\u4ee5\u53ca\u6570\u636e\u5982\u4f55\u5728\u5b83\u4eec\u4e4b\u95f4\u4f20\u8f93\u7684\u6807\u51c6\u3002\u534f\u8bae\u91c7\u7528\u4e864\u5c42\u7684\u5c42\u7ea7\u7ed3\u6784\uff0c\u6bcf\u4e00\u5c42\u90fd\u547c\u53eb\u5b83\u7684\u4e0b\u4e00\u5c42\u6240\u63d0\u4f9b\u7684\u534f\u8bae\u6765\u5b8c\u6210\u81ea\u5df1\u7684\u9700\u6c42\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u80cc\u666f<\/strong><\/div>\n

\u548c\u5973\u670b\u53cb\u5f02\u5730\u604b\u4e00\u5e74\u591a\uff0c\u4e3a\u4e86\u4fdd\u6301\u611f\u60c5\u6211\u63d0\u8bae\u6bcf\u5929\u665a\u4e0a\u89c6\u9891\u804a\u5929\u4e00\u6b21\u3002<\/p>\n

\u4ece\u597d\u4e0a\u5f00\u59cb\uff0c\u5230\u73b0\u5728\uff0c\u4e00\u5e74\u591a\u4e5f\u7b97\u575a\u6301\u4e0b\u6765\u4e86\u3002<\/p>\n

\u95ee\u9898<\/p>\n

\u6709\u65f6\u5019\u804a\u5929\u7684\u8fc7\u7a0b\u4e2d\uff0c\u6211\u7684\u7f51\u7edc\u6216\u8005\u5979\u7684\u7f51\u7edc\u53ef\u80fd\u4f1a\u4e0d\u597d\uff0c\u89c6\u9891\u5c31\u4f1a\u5361\u4f4f\uff0c\u542c\u4e0d\u5230\u5bf9\u65b9\u7684\u58f0\u97f3\uff0c\u8fc7\u4e00\u4f1a\u513f\u4e4b\u540e\u624d\u4f1a\u6062\u590d\u3002<\/p>\n

\u4e2d\u95f4\u53cc\u65b9\u53ef\u80fd\u5c31\u8981\u4e0d\u65ad\u7684\u786e\u8ba4\u7f51\u7edc\u662f\u5426\u6062\u590d\uff0c\u4f46\u662f\u6709\u65f6\u5019\u4f1a\uff1a<\/p>\n

\u5979\uff1a\u201c\u4f60\u53ef\u4ee5\u542c\u5230\u4e86\u5417\uff1f\u201d<\/p>\n

\u6211\uff1a\u201c\u53ef\u4ee5\u4e86\uff0c\u4f60\u5462\uff1f\u201d\u3001<\/p>\n

\u5979\uff1a\u201c\u5582\u5582\uff0c\u4f60\u53ef\u4ee5\u542c\u5230\u4e86\u5417\uff1f\u201d<\/p>\n

\u6211\uff1a\u201c\u53ef\u4ee5\u4e86\uff0c\u6211\u53ef\u4ee5\u542c\u5230\u4e86\uff0c\u4f60\u5462\uff1f\u201d<\/p>\n

\u5979\uff1a\u201c\u4f60\u53ef\u4ee5\u542c\u5230\u4e86\u5417\uff1f\u201d<\/p>\n

.....<\/p>\n

\u8fd9\u79cd\u60c5\u51b5\u5f88\u86cb\u75bc\uff0c\u90a3\u4e48\u600e\u6837\u624d\u80fd\u627e\u4e00\u4e2a\u7b80\u5355\u7684\u529e\u6cd5\uff0c\u8ba9\u4e24\u4e2a\u4eba\u90fd\u786e\u8ba4\u81ea\u5df1\u53ef\u4ee5\u542c\u5230\u5bf9\u65b9\u7684\u58f0\u97f3\uff0c\u5bf9\u65b9\u4e5f\u53ef\u4ee5\u542c\u5230\u81ea\u5df1\u7684\u58f0\u97f3\u5462\uff1f<\/p>\n

\u6ce8\uff1a\u4ee5\u4e0b\u60c5\u8282\u7eaf\u5c5e\u865a\u6784<\/p>\n

\u65b9\u6848<\/strong><\/div>\n

TCP\u5efa\u7acb\u8fde\u63a5\u4e3a\u4ec0\u4e48\u662f\u4e09\u6b21\u63e1\u624b\uff0c\u800c\u4e0d\u662f\u4e24\u6b21\u6216\u56db\u6b21\uff1f<\/p>\n

TCP\uff0c\u540d\u4e3a\u4f20\u8f93\u63a7\u5236\u534f\u8bae\uff0c\u662f\u4e00\u79cd\u53ef\u9760\u7684\u4f20\u8f93\u5c42\u534f\u8bae\uff0cIP\u534f\u8bae\u53f7\u4e3a6\u3002<\/p>\n

\u987a\u4fbf\u8bf4\u4e00\u53e5\uff0c\u539f\u5219\u4e0a\u4efb\u4f55\u6570\u636e\u4f20\u8f93\u90fd\u65e0\u6cd5\u786e\u4fdd\u7edd\u5bf9\u53ef\u9760\uff0c\u4e09\u6b21\u63e1\u624b\u53ea\u662f\u786e\u4fdd\u53ef\u9760\u7684\u57fa\u672c\u9700\u8981\u3002<\/p>\n

\u4e3e\u4e2a\u65e5\u5e38\u4f8b\u5b50\uff0c\u6253\u7535\u8bdd\u65f6\u6211\u4eec\u5bf9\u8bdd\u5982\u4e0b\uff1a<\/p>\n

\"\"<\/p>\n

\u5bf9\u5e94\u4e3a\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u5668\u4e4b\u95f4\u7684\u901a\u4fe1\uff1a<\/p>\n

\"\"
\n\"\"<\/p>\n

\u4e8e\u662f\u6709\u4e86\u5982\u4e0b\u5bf9\u8bdd\uff1a<\/p>\n

\u6211\uff1a1+1\u7b49\u4e8e\u51e0\uff1f<\/p>\n

\u5979\uff1a2,2+2\u7b49\u4e8e\u51e0\uff1f<\/p>\n

\u6211\uff1a4<\/p>\n

\u9996\u5148\u4e24\u4e2a\u4eba\u7ea6\u5b9a\u534f\u8bae<\/p>\n

1.\u611f\u89c9\u7f51\u7edc\u60c5\u51b5\u4e0d\u5bf9\u7684\u65f6\u5019\uff0c\u4efb\u4f55\u4e00\u65b9\u90fd\u53ef\u4ee5\u53d1\u8d77\u8be2\u95ee<\/p>\n

2.\u4efb\u4f55\u60c5\u51b5\u4e0b\uff0c\u82e5\u53d1\u8d77\u8be2\u95ee\u540e5\u79d2\u8fd8\u6ca1\u6536\u5230\u56de\u590d\uff0c\u5219\u8ba4\u4e3a\u7f51\u7edc\u4e0d\u901a<\/p>\n

3.\u7f51\u7edc\u4e0d\u901a\u7684\u60c5\u51b5\u4e0b\u7b491min\u8def\u7531\u5668\u4e4b\u540e\u518d\u53d1\u8d77\u8be2\u95ee<\/p>\n

\u5bf9\u4e8e\u6211\u800c\u8a00\uff0c\u53d1\u8d77 \u201c1+1\u7b49\u4e8e\u51e0\u201d\u7684\u8be2\u95ee\u540e<\/p>\n

1. \u82e55s\u5185\u6ca1\u6709\u6536\u5230\u56de\u590d\uff0c\u5219\u8ba4\u4e3a\u7f51\u7edc\u4e0d\u901a<\/p>\n

2. \u82e5\u6536\u5230\u56de\u590d\uff0c\u5219\u6211\u786e\u8ba4\u2460\u6211\u80fd\u542c\u5230\u5979\u7684\u6d88\u606f \u2461\u5979\u80fd\u542c\u5230\u6211\u7684\u6d88\u606f\uff0c\u7136\u540e\u56de\u590d\u5979\u7684\u95ee\u9898\u7684\u7b54\u6848<\/p>\n

\u5bf9\u4e8e\u5979\u800c\u8a00\uff0c\u5f53\u611f\u89c9\u7f51\u7edc\u60c5\u51b5\u4e0d\u5bf9\u7684\u65f6\u5019<\/p>\n

1. \u82e5\u6ca1\u6709\u6536\u5230\u6211\u7684\u8be2\u95ee\uff0c\u5219\u5979\u53d1\u8d77\u8be2\u95ee<\/p>\n

2. \u82e5\u6536\u5230\u201c1+1\u7b49\u4e8e\u51e0\u201d\uff0c\u5219\u5979\u786e\u8ba4 \u2460\u5979\u53ef\u4ee5\u542c\u5230\u6211\u7684\u6d88\u606f\uff0c\u7136\u540e\u56de\u590d\u6211\u7684\u95ee\u9898\u7684\u7b54\u6848\u548c\u5979\u7684\u95ee\u9898\u201c2\uff0c2+2\u7b49\u4e8e\u51e0\u201d<\/p>\n

3. \u82e55s\u5185\u6ca1\u6709\u6536\u5230\u6211\u7684\u56de\u590d\u201c4\u201d\uff0c\u5219\u5979\u786e\u8ba4 \u2461\u6211\u542c\u4e0d\u89c1\u5979\u7684\u6d88\u606f<\/p>\n

4. \u82e55s\u5185\u6536\u5230\u4e86\u6211\u7684\u56de\u590d\u201c4\u201d\uff0c\u5219\u5979\u786e\u8ba4 \u2461\u6211\u53ef\u4ee5\u542c\u89c1\u5979\u7684\u6d88\u606f<\/p>\n

\u8fd9\u6837\uff0c\u5982\u679c\u4e0a\u9762\u7684\u5bf9\u8bdd\u5f97\u4ee5\u5b8c\u6210\uff0c\u5c31\u8bc1\u660e\u53cc\u65b9\u90fd\u53ef\u4ee5\u786e\u8ba4\u81ea\u5df1\u53ef\u4ee5\u542c\u5230\u5bf9\u65b9\u7684\u58f0\u97f3\uff0c\u5bf9\u65b9\u4e5f\u53ef\u4ee5\u542c\u5230\u81ea\u5df1\u7684\u58f0\u97f3\uff01<\/p>\n

\u8fd9\u4e2a\u6545\u4e8b\u53ef\u4ee5\u89e3\u91caTCP\u4e3a\u4ec0\u4e48\u8981\u4e09\u6b21\u63e1\u624b\u5417 ... \u56e7<\/p>\n

\u5173\u4e8e\u56db\u6b21\u6325\u624b<\/strong><\/div>\n

\u5148\u7531\u5ba2\u6237\u7aef\u5411\u670d\u52a1\u5668\u7aef\u53d1\u9001\u4e00\u4e2aFIN\uff0c\u8bf7\u6c42\u5173\u95ed\u6570\u636e\u4f20\u8f93\u3002<\/p>\n

\u5f53\u670d\u52a1\u5668\u63a5\u6536\u5230\u5ba2\u6237\u7aef\u7684FIN\u65f6\uff0c\u5411\u5ba2\u6237\u7aef\u53d1\u9001\u4e00\u4e2aACK\uff0c\u5176\u4e2dack\u7684\u503c\u7b49\u4e8eFIN+SEQ<\/p>\n

\u7136\u540e\u670d\u52a1\u5668\u5411\u5ba2\u6237\u7aef\u53d1\u9001\u4e00\u4e2aFIN\uff0c\u544a\u8bc9\u5ba2\u6237\u7aef\u5e94\u7528\u7a0b\u5e8f\u5173\u95ed\u3002<\/p>\n

\u5f53\u5ba2\u6237\u7aef\u6536\u5230\u670d\u52a1\u5668\u7aef\u7684FIN\u662f\uff0c\u56de\u590d\u4e00\u4e2aACK\u7ed9\u670d\u52a1\u5668\u7aef\u3002\u5176\u4e2dack\u7684\u503c\u7b49\u4e8eFIN+SEQ<\/p>\n

\"\"<\/p>\n

\u4e3a\u4ec0\u4e48\u89814\u6b21\u6325\u624b\uff1f
\n<\/strong><\/div>\n

\u786e\u4fdd\u6570\u636e\u80fd\u591f\u5b8c\u6574\u4f20\u8f93\u3002<\/p>\n

\u5f53\u88ab\u52a8\u65b9\u6536\u5230\u4e3b\u52a8\u65b9\u7684FIN\u62a5\u6587\u901a\u77e5\u65f6\uff0c\u5b83\u4ec5\u4ec5\u8868\u793a\u4e3b\u52a8\u65b9\u6ca1\u6709\u6570\u636e\u518d\u53d1\u9001\u7ed9\u88ab\u52a8\u65b9\u4e86\u3002<\/p>\n

\u4f46\u672a\u5fc5\u88ab\u52a8\u65b9\u6240\u6709\u7684\u6570\u636e\u90fd\u5b8c\u6574\u7684\u53d1\u9001\u7ed9\u4e86\u4e3b\u52a8\u65b9\uff0c\u6240\u4ee5\u88ab\u52a8\u65b9\u4e0d\u4f1a\u9a6c\u4e0a\u5173\u95edSOCKET,\u5b83\u53ef\u80fd\u8fd8\u9700\u8981\u53d1\u9001\u4e00\u4e9b\u6570\u636e\u7ed9\u4e3b\u52a8\u65b9\u540e\uff0c<\/p>\n

\u518d\u53d1\u9001FIN\u62a5\u6587\u7ed9\u4e3b\u52a8\u65b9\uff0c\u544a\u8bc9\u4e3b\u52a8\u65b9\u540c\u610f\u5173\u95ed\u8fde\u63a5\uff0c\u6240\u4ee5\u8fd9\u91cc\u7684ACK\u62a5\u6587\u548cFIN\u62a5\u6587\u591a\u6570\u60c5\u51b5\u4e0b\u90fd\u662f\u5206\u5f00\u53d1\u9001\u7684\u3002<\/p>\n

\u4e00\u3001TCP\u62a5\u6587\u683c\u5f0f
\n<\/strong><\/div>\n

TCP\u62a5\u6587\u683c\u5f0f\u56fe\uff1a<\/p>\n

\u4e0a\u56fe\u4e2d\u6709\u51e0\u4e2a\u5b57\u6bb5\u9700\u8981\u91cd\u70b9\u4ecb\u7ecd\u4e0b\uff1a<\/p>\n

\"\"<\/p>\n

\uff081\uff09\u5e8f\u53f7\uff1aSeq\u5e8f\u53f7\uff0c\u536032\u4f4d\uff0c\u7528\u6765\u6807\u8bc6\u4eceTCP\u6e90\u7aef\u5411\u76ee\u7684\u7aef\u53d1\u9001\u7684\u5b57\u8282\u6d41\uff0c\u53d1\u8d77\u65b9\u53d1\u9001\u6570\u636e\u65f6\u5bf9\u6b64\u8fdb\u884c\u6807\u8bb0\u3002<\/p>\n

\uff082\uff09\u786e\u8ba4\u5e8f\u53f7\uff1aAck\u5e8f\u53f7\uff0c\u536032\u4f4d\uff0c\u53ea\u6709ACK\u6807\u5fd7\u4f4d\u4e3a1\u65f6\uff0c\u786e\u8ba4\u5e8f\u53f7\u5b57\u6bb5\u624d\u6709\u6548\uff0cAck=Seq+1\u3002<\/p>\n

\uff083\uff09\u6807\u5fd7\u4f4d\uff1a\u51716\u4e2a\uff0c\u5373URG\u3001ACK\u3001PSH\u3001RST\u3001SYN\u3001FIN\u7b49\uff0c\u5177\u4f53\u542b\u4e49\u5982\u4e0b\uff1a<\/p>\n

\uff08A\uff09URG\uff1a\u7d27\u6025\u6307\u9488\uff08urgent pointer\uff09\u6709\u6548\u3002<\/p>\n

\uff08B\uff09ACK\uff1a\u786e\u8ba4\u5e8f\u53f7\u6709\u6548\u3002<\/p>\n

\uff08C\uff09PSH\uff1a\u63a5\u6536\u65b9\u5e94\u8be5\u5c3d\u5feb\u5c06\u8fd9\u4e2a\u62a5\u6587\u4ea4\u7ed9\u5e94\u7528\u5c42\u3002<\/p>\n

\uff08D\uff09RST\uff1a\u91cd\u7f6e\u8fde\u63a5\u3002<\/p>\n

\uff08E\uff09SYN\uff1a\u53d1\u8d77\u4e00\u4e2a\u65b0\u8fde\u63a5\u3002<\/p>\n

\uff08F\uff09FIN\uff1a\u91ca\u653e\u4e00\u4e2a\u8fde\u63a5\u3002<\/p>\n

\u9700\u8981\u6ce8\u610f\u7684\u662f\uff1a<\/p>\n

\uff08A\uff09\u4e0d\u8981\u5c06\u786e\u8ba4\u5e8f\u53f7Ack\u4e0e\u6807\u5fd7\u4f4d\u4e2d\u7684ACK\u641e\u6df7\u4e86\u3002<\/p>\n

\uff08B\uff09\u786e\u8ba4\u65b9Ack=\u53d1\u8d77\u65b9Req+1\uff0c\u4e24\u7aef\u914d\u5bf9\u3002<\/p>\n

\u4e8c\u3001\u4e09\u6b21\u63e1\u624b<\/strong><\/div>\n

TCP(Transmission Control Protocol)\u3000\u4f20\u8f93\u63a7\u5236\u534f\u8bae<\/p>\n

TCP\u662f\u4e3b\u673a\u5bf9\u4e3b\u673a\u5c42\u7684\u4f20\u8f93\u63a7\u5236\u534f\u8bae\uff0c\u63d0\u4f9b\u53ef\u9760\u7684\u8fde\u63a5\u670d\u52a1\uff0c\u91c7\u7528\u4e09\u6b21\u63e1\u624b\u786e\u8ba4\u5efa\u7acb\u4e00\u4e2a\u8fde\u63a5<\/p>\n

\u4f4d\u7801\u5373tcp\u6807\u5fd7\u4f4d,\u67096\u79cd\u6807\u793a:<\/p>\n

SYN(synchronous\u5efa\u7acb\u8054\u673a)
\nACK(acknowledgement \u786e\u8ba4)
\nPSH(push\u4f20\u9001)
\nFIN(finish\u7ed3\u675f)
\nRST(reset\u91cd\u7f6e)
\nURG(urgent\u7d27\u6025)
\nSequence number(\u987a\u5e8f\u53f7\u7801)
\nAcknowledge number(\u786e\u8ba4\u53f7\u7801)
\nestablish \u5efa\u7acb\uff0c\u521b\u5efa
\n\u6240\u8c13\u4e09\u6b21\u63e1\u624b\uff08Three-Way Handshake\uff09\u5373\u5efa\u7acbTCP\u8fde\u63a5\uff0c\u662f\u6307\u5efa\u7acb\u4e00\u4e2aTCP\u8fde\u63a5\u65f6\uff0c\u9700\u8981\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u7aef\u603b\u5171\u53d1\u90013\u4e2a\u5305\u4ee5\u786e\u8ba4\u8fde\u63a5\u7684\u5efa\u7acb\u3002\u5728socket\u7f16\u7a0b\u4e2d\uff0c\u8fd9\u4e00\u8fc7\u7a0b\u7531\u5ba2\u6237\u7aef\u6267\u884cconnect\u6765\u89e6\u53d1\uff0c\u6574\u4e2a\u6d41\u7a0b\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n

\"\"<\/p>\n

\uff081\uff09\u7b2c\u4e00\u6b21\u63e1\u624b\uff1aClient\u5c06\u6807\u5fd7\u4f4dSYN\u7f6e\u4e3a1\uff0c\u968f\u673a\u4ea7\u751f\u4e00\u4e2a\u503cseq=J\uff0c\u5e76\u5c06\u8be5\u6570\u636e\u5305\u53d1\u9001\u7ed9Server\uff0cClient\u8fdb\u5165SYN_SENT\u72b6\u6001\uff0c\u7b49\u5f85Server\u786e\u8ba4\u3002<\/p>\n

\uff082\uff09\u7b2c\u4e8c\u6b21\u63e1\u624b\uff1aServer\u6536\u5230\u6570\u636e\u5305\u540e\u7531\u6807\u5fd7\u4f4dSYN=1\u77e5\u9053Client\u8bf7\u6c42\u5efa\u7acb\u8fde\u63a5\uff0cServer\u5c06\u6807\u5fd7\u4f4dSYN\u548cACK\u90fd\u7f6e\u4e3a1\uff0cack (number )=J+1\uff0c\u968f\u673a\u4ea7\u751f\u4e00\u4e2a\u503cseq=K\uff0c\u5e76\u5c06\u8be5\u6570\u636e\u5305\u53d1\u9001\u7ed9Client\u4ee5\u786e\u8ba4\u8fde\u63a5\u8bf7\u6c42\uff0cServer\u8fdb\u5165SYN_RCVD\u72b6\u6001\u3002<\/p>\n

\uff083\uff09\u7b2c\u4e09\u6b21\u63e1\u624b\uff1aClient\u6536\u5230\u786e\u8ba4\u540e\uff0c\u68c0\u67e5ack\u662f\u5426\u4e3aJ+1\uff0cACK\u662f\u5426\u4e3a1\uff0c\u5982\u679c\u6b63\u786e\u5219\u5c06\u6807\u5fd7\u4f4dACK\u7f6e\u4e3a1\uff0cack=K+1\uff0c\u5e76\u5c06\u8be5\u6570\u636e\u5305\u53d1\u9001\u7ed9Server\uff0cServer\u68c0\u67e5ack\u662f\u5426\u4e3aK+1\uff0cACK\u662f\u5426\u4e3a1\uff0c\u5982\u679c\u6b63\u786e\u5219\u8fde\u63a5\u5efa\u7acb\u6210\u529f\uff0cClient\u548cServer\u8fdb\u5165ESTABLISHED\u72b6\u6001\uff0c\u5b8c\u6210\u4e09\u6b21\u63e1\u624b\uff0c\u968f\u540eClient\u4e0eServer\u4e4b\u95f4\u53ef\u4ee5\u5f00\u59cb\u4f20\u8f93\u6570\u636e\u4e86\u3002<\/p>\n

\"\"<\/p>\n

SYN\u653b\u51fb\uff1a<\/p>\n

\u5728\u4e09\u6b21\u63e1\u624b\u8fc7\u7a0b\u4e2d\uff0cServer\u53d1\u9001SYN-ACK\u4e4b\u540e\uff0c\u6536\u5230Client\u7684ACK\u4e4b\u524d\u7684TCP\u8fde\u63a5\u79f0\u4e3a\u534a\u8fde\u63a5\uff08half-open connect\uff09\uff0c\u6b64\u65f6Server\u5904\u4e8eSYN_RCVD\u72b6\u6001\uff0c\u5f53\u6536\u5230ACK\u540e\uff0cServer\u8f6c\u5165ESTABLISHED\u72b6\u6001\u3002SYN\u653b\u51fb\u5c31\u662fClient\u5728\u77ed\u65f6\u95f4\u5185\u4f2a\u9020\u5927\u91cf\u4e0d\u5b58\u5728\u7684IP\u5730\u5740\uff0c\u5e76\u5411Server\u4e0d\u65ad\u5730\u53d1\u9001SYN\u5305\uff0cServer\u56de\u590d\u786e\u8ba4\u5305\uff0c\u5e76\u7b49\u5f85Client\u7684\u786e\u8ba4\uff0c\u7531\u4e8e\u6e90\u5730\u5740\u662f\u4e0d\u5b58\u5728\u7684\uff0c\u56e0\u6b64\uff0cServer\u9700\u8981\u4e0d\u65ad\u91cd\u53d1\u76f4\u81f3\u8d85\u65f6\uff0c\u8fd9\u4e9b\u4f2a\u9020\u7684SYN\u5305\u5c06\u957f\u65f6\u95f4\u5360\u7528\u672a\u8fde\u63a5\u961f\u5217\uff0c\u5bfc\u81f4\u6b63\u5e38\u7684SYN\u8bf7\u6c42\u56e0\u4e3a\u961f\u5217\u6ee1\u800c\u88ab\u4e22\u5f03\uff0c\u4ece\u800c\u5f15\u8d77\u7f51\u7edc\u5835\u585e\u751a\u81f3\u7cfb\u7edf\u762b\u75ea\u3002SYN\u653b\u51fb\u65f6\u4e00\u79cd\u5178\u578b\u7684DDOS\u653b\u51fb\uff0c\u68c0\u6d4bSYN\u653b\u51fb\u7684\u65b9\u5f0f\u975e\u5e38\u7b80\u5355\uff0c\u5373\u5f53Server\u4e0a\u6709\u5927\u91cf\u534a\u8fde\u63a5\u72b6\u6001\u4e14\u6e90IP\u5730\u5740\u662f\u968f\u673a\u7684\uff0c\u5219\u53ef\u4ee5\u65ad\u5b9a\u906d\u5230SYN\u653b\u51fb\u4e86\uff0c\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\u53ef\u4ee5\u8ba9\u4e4b\u73b0\u884c\uff1a<\/p>\n

#netstat -nap | grep SYN_RECV<\/pre>\n
\u4e09\u3001\u56db\u6b21\u6325\u624b<\/strong><\/div>\n

\u4e09\u6b21\u63e1\u624b\u8033\u719f\u80fd\u8be6\uff0c\u56db\u6b21\u6325\u624b\u4f30\u8ba1\u5c31..\u6240\u8c13\u56db\u6b21\u6325\u624b\uff08Four-Way Wavehand\uff09\u5373\u7ec8\u6b62TCP\u8fde\u63a5\uff0c\u5c31\u662f\u6307\u65ad\u5f00\u4e00\u4e2aTCP\u8fde\u63a5\u65f6\uff0c\u9700\u8981\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u7aef\u603b\u5171\u53d1\u90014\u4e2a\u5305\u4ee5\u786e\u8ba4\u8fde\u63a5\u7684\u65ad\u5f00\u3002\u5728socket\u7f16\u7a0b\u4e2d\uff0c\u8fd9\u4e00\u8fc7\u7a0b\u7531\u5ba2\u6237\u7aef\u6216\u670d\u52a1\u7aef\u4efb\u4e00\u65b9\u6267\u884cclose\u6765\u89e6\u53d1\uff0c\u6574\u4e2a\u6d41\u7a0b\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n

\"\"<\/p>\n

\u7531\u4e8eTCP\u8fde\u63a5\u65f6\u5168\u53cc\u5de5\u7684\uff0c\u56e0\u6b64\uff0c\u6bcf\u4e2a\u65b9\u5411\u90fd\u5fc5\u987b\u8981\u5355\u72ec\u8fdb\u884c\u5173\u95ed\uff0c\u8fd9\u4e00\u539f\u5219\u662f\u5f53\u4e00\u65b9\u5b8c\u6210\u6570\u636e\u53d1\u9001\u4efb\u52a1\u540e\uff0c\u53d1\u9001\u4e00\u4e2aFIN\u6765\u7ec8\u6b62\u8fd9\u4e00\u65b9\u5411\u7684\u8fde\u63a5\uff0c\u6536\u5230\u4e00\u4e2aFIN\u53ea\u662f\u610f\u5473\u7740\u8fd9\u4e00\u65b9\u5411\u4e0a\u6ca1\u6709\u6570\u636e\u6d41\u52a8\u4e86\uff0c\u5373\u4e0d\u4f1a\u518d\u6536\u5230\u6570\u636e\u4e86\uff0c\u4f46\u662f\u5728\u8fd9\u4e2aTCP\u8fde\u63a5\u4e0a\u4ecd\u7136\u80fd\u591f\u53d1\u9001\u6570\u636e\uff0c\u76f4\u5230\u8fd9\u4e00\u65b9\u5411\u4e5f\u53d1\u9001\u4e86FIN\u3002\u9996\u5148\u8fdb\u884c\u5173\u95ed\u7684\u4e00\u65b9\u5c06\u6267\u884c\u4e3b\u52a8\u5173\u95ed\uff0c\u800c\u53e6\u4e00\u65b9\u5219\u6267\u884c\u88ab\u52a8\u5173\u95ed\uff0c\u4e0a\u56fe\u63cf\u8ff0\u7684\u5373\u662f\u5982\u6b64\u3002<\/p>\n

\uff081\uff09\u7b2c\u4e00\u6b21\u6325\u624b\uff1aClient\u53d1\u9001\u4e00\u4e2aFIN\uff0c\u7528\u6765\u5173\u95edClient\u5230Server\u7684\u6570\u636e\u4f20\u9001\uff0cClient\u8fdb\u5165FIN_WAIT_1\u72b6\u6001\u3002<\/p>\n

\uff082\uff09\u7b2c\u4e8c\u6b21\u6325\u624b\uff1aServer\u6536\u5230FIN\u540e\uff0c\u53d1\u9001\u4e00\u4e2aACK\u7ed9Client\uff0c\u786e\u8ba4\u5e8f\u53f7\u4e3a\u6536\u5230\u5e8f\u53f7+1\uff08\u4e0eSYN\u76f8\u540c\uff0c\u4e00\u4e2aFIN\u5360\u7528\u4e00\u4e2a\u5e8f\u53f7\uff09\uff0cServer\u8fdb\u5165CLOSE_WAIT\u72b6\u6001\u3002<\/p>\n

\uff083\uff09\u7b2c\u4e09\u6b21\u6325\u624b\uff1aServer\u53d1\u9001\u4e00\u4e2aFIN\uff0c\u7528\u6765\u5173\u95edServer\u5230Client\u7684\u6570\u636e\u4f20\u9001\uff0cServer\u8fdb\u5165LAST_ACK\u72b6\u6001\u3002<\/p>\n

\uff084\uff09\u7b2c\u56db\u6b21\u6325\u624b\uff1aClient\u6536\u5230FIN\u540e\uff0cClient\u8fdb\u5165TIME_WAIT\u72b6\u6001\uff0c\u63a5\u7740\u53d1\u9001\u4e00\u4e2aACK\u7ed9Server\uff0c\u786e\u8ba4\u5e8f\u53f7\u4e3a\u6536\u5230\u5e8f\u53f7+1\uff0cServer\u8fdb\u5165CLOSED\u72b6\u6001\uff0c\u5b8c\u6210\u56db\u6b21\u6325\u624b\u3002<\/p>\n

\"\"<\/p>\n

\u4e0a\u9762\u662f\u4e00\u65b9\u4e3b\u52a8\u5173\u95ed\uff0c\u53e6\u4e00\u65b9\u88ab\u52a8\u5173\u95ed\u7684\u60c5\u51b5\uff0c\u5b9e\u9645\u4e2d\u8fd8\u4f1a\u51fa\u73b0\u540c\u65f6\u53d1\u8d77\u4e3b\u52a8\u5173\u95ed\u7684\u60c5\u51b5\uff0c\u5177\u4f53\u6d41\u7a0b\u5982\u4e0b\u56fe\uff1a<\/p>\n

\"\"<\/p>\n

\u56db\u3001\u9644\u6ce8<\/strong><\/div>\n

\u5173\u4e8e\u4e09\u6b21\u63e1\u624b\u4e0e\u56db\u6b21\u6325\u624b\u901a\u5e38\u90fd\u4f1a\u6709\u5178\u578b\u7684\u9762\u8bd5\u9898\uff0c\u5728\u6b64\u63d0\u51fa\u4f9b\u6709\u9700\u6c42\u7684\u540c\u5b66\u4eec\u53c2\u8003\uff1a<\/p>\n

\uff081\uff09\u4e09\u6b21\u63e1\u624b\u662f\u4ec0\u4e48\u6216\u8005\u6d41\u7a0b\uff1f\u56db\u6b21\u63e1\u624b\u5462\uff1f\u7b54\u6848\u524d\u9762\u5206\u6790\u5c31\u662f\u3002<\/p>\n

\uff082\uff09\u4e3a\u4ec0\u4e48\u5efa\u7acb\u8fde\u63a5\u662f\u4e09\u6b21\u63e1\u624b\uff0c\u800c\u5173\u95ed\u8fde\u63a5\u5374\u662f\u56db\u6b21\u6325\u624b\u5462\uff1f<\/p>\n

\u8fd9\u662f\u56e0\u4e3a\u670d\u52a1\u7aef\u5728LISTEN\u72b6\u6001\u4e0b\uff0c\u6536\u5230\u5efa\u7acb\u8fde\u63a5\u8bf7\u6c42\u7684SYN\u62a5\u6587\u540e\uff0c\u628aACK\u548cSYN\u653e\u5728\u4e00\u4e2a\u62a5\u6587\u91cc\u53d1\u9001\u7ed9\u5ba2\u6237\u7aef\u3002\u800c\u5173\u95ed\u8fde\u63a5\u65f6\uff0c\u5f53\u6536\u5230\u5bf9\u65b9\u7684FIN\u62a5\u6587\u65f6\uff0c\u4ec5\u4ec5\u8868\u793a\u5bf9\u65b9\u4e0d\u518d\u53d1\u9001\u6570\u636e\u4e86\u4f46\u662f\u8fd8\u80fd\u63a5\u6536\u6570\u636e\uff0c\u5df1\u65b9\u4e5f\u672a\u5fc5\u5168\u90e8\u6570\u636e\u90fd\u53d1\u9001\u7ed9\u5bf9\u65b9\u4e86\uff0c\u6240\u4ee5\u5df1\u65b9\u53ef\u4ee5\u7acb\u5373close\uff0c\u4e5f\u53ef\u4ee5\u53d1\u9001\u4e00\u4e9b\u6570\u636e\u7ed9\u5bf9\u65b9\u540e\uff0c\u518d\u53d1\u9001FIN\u62a5\u6587\u7ed9\u5bf9\u65b9\u6765\u8868\u793a\u540c\u610f\u73b0\u5728\u5173\u95ed\u8fde\u63a5\uff0c\u56e0\u6b64\uff0c\u5df1\u65b9ACK\u548cFIN\u4e00\u822c\u90fd\u4f1a\u5206\u5f00\u53d1\u9001\u3002<\/p>\n

\n

\u539f\u6587\u6765\u81ea\uff1ahttps:\/\/zhuanlan.zhihu.com\/p\/35768805<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1ahttps:\/\/lrxjmw.cn\/tcp-ip-protocol.html<\/a>\u7f16\u8f91\uff1a\u51af\u745e\u6d9b\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u5bfc\u8bfb Transmission Control Protocol\/Internet Protocol\u7684\u7b80\u5199\uff0c\u4e2d […]<\/p>\n","protected":false},"author":1329,"featured_media":103908,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-103895","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/103895","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1329"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=103895"}],"version-history":[{"count":4,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/103895\/revisions"}],"predecessor-version":[{"id":292848,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/103895\/revisions\/292848"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/103908"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=103895"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=103895"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=103895"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}