{"id":440136,"date":"2021-04-13T03:20:08","date_gmt":"2021-04-12T19:20:08","guid":{"rendered":"http:\/\/4563.org\/?p=440136"},"modified":"2021-04-13T03:20:08","modified_gmt":"2021-04-12T19:20:08","slug":"%e4%b8%ba%e4%bb%80%e4%b9%88-tcp-%e5%85%81%e8%ae%b8%e5%a4%9a%e4%b8%aa%e7%a8%8b%e5%ba%8f%e7%bb%91%e5%ae%9a%e5%90%8c%e4%b8%80%e4%b8%aa-ip-%e5%92%8c%e7%ab%af%e5%8f%a3%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=440136","title":{"rendered":"\u4e3a\u4ec0\u4e48 TCP \u5141\u8bb8\u591a\u4e2a\u7a0b\u5e8f\u7ed1\u5b9a\u540c\u4e00\u4e2a IP \u548c\u7aef\u53e3\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u4e3a\u4ec0\u4e48 TCP \u5141\u8bb8\u591a\u4e2a\u7a0b\u5e8f\u7ed1\u5b9a\u540c\u4e00\u4e2a IP \u548c\u7aef\u53e3\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : 3dwelcome <\/span>  <span><i><\/i> 14<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u5728 Windows \u4e0a\uff0c\u8fd9\u663e\u7136\u662f\u4e0d\u5141\u8bb8\u7684\uff0c\u4f60\u53ef\u4ee5\u7528\u591a\u4e2a IP \u5206\u522b\u7ed1\u5b9a\u540c\u4e00\u4e2a PORT\uff0c\u4f46\u662f\u4e0d\u5141\u8bb8\u540c\u4e00\u4e2a IP+PORT \u88ab\u591a\u6b21\u7ed1\u5b9a\u3002<\/p>\n<p>\u5728 Linux \u4e0a\uff0c\u4ee5\u524d\u4e5f\u662f\u4e0d\u5141\u8bb8\uff0c\u4f46\u540e\u6765\u4fee\u6539\u4e86\u5185\u6838\uff0c\u4ece 3.9 \u5f00\u59cb\uff0cTCP \u53d8\u5f97\u548c UDP \u4e00\u6837\uff0c\u53ef\u4ee5\u591a\u4e2a\u7a0b\u5e8f\u540c\u65f6\u76d1\u542c\u540c\u4e00\u4e2a IP+\u7aef\u53e3\u3002<\/p>\n<p>\u8fd9\u6837\u7684\u8bdd\uff0c\u53ea\u8981\u4f60\u6709\u670d\u52a1\u5668 ROOT \u6743\u9650\uff0c\u5f00\u4e00\u4e2a\u548c nginx \u4e00\u6837\u7684 80 \u7aef\u53e3\u7a0b\u5e8f\uff0c\u5c31\u53ef\u4ee5\u5f00\u5fc3\u548c\u4ed6\u62a2\u6570\u636e\u4e86\u3002<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>10<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"5678394\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : hxndg <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e3a\u5565\u4e0d\u5141\u8bb8\u5462\uff1f TCP \u4e94\u5143\u7ec4\u554a\uff0c\u53ea\u8981\u80fd\u5728 TCP \u4e0a\u5c42\u533a\u5206\u5f00\u5230\u5e95\u8be5\u4ea4\u7ed9\u8c01\uff0c\u4e3a\u5565\u4e0d\u80fd\u7ed1\u5b9a\u540c\u4e00\u4e2a\u7aef\u53e3\u5462\uff1f<br \/>\u6211\u53f8\u590d\u6742\u5747\u8861\uff0c\u81ea\u5df1\u5b9e\u73b0 2-7 \u5c42\uff0c\u6211\u4eec\u81ea\u5df1\u7ef4\u62a4 PCB\uff0c\u5b9e\u73b0\u7684\u65f6\u5019\u5b8c\u5168\u53ef\u4ee5\u5171\u4eab\u7aef\u53e3\u3002<br \/>\u5f53\u7136\u524d\u63d0\u662f PCB \u81ea\u5df1\u7ef4\u62a4\uff0c\u4e5f\u5c31\u662f\u7b5b\u9009\u6570\u636e\u5305\u7ed9\u8c01\u81ea\u5df1\u7ef4\u62a4                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5678395\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : 3dwelcome <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @hxndg UDP \u6211\u80fd\u7406\u89e3\uff0c\u5305\u662f\u5355\u72ec\u7684\uff0c\u6700\u7ec8\u7ed9\u8c01\u90fd\u80fd\u76f4\u63a5\u5904\u7406\u3002<br \/>\u53ef TCP \u662f\u6d41\u5f0f\u6570\u636e\uff0c\u600e\u4e48\u5207\u5206\u6210\u5c0f\u5305\uff0c\u662f\u5e95\u5c42\u51b3\u5b9a\u7684\uff0c\u53c8\u4e0d\u662f\u7531\u7a0b\u5e8f\u51b3\u5b9a\u7684\u3002<br \/>\u6bd4\u5982 HTTP \u4f60\u7a0b\u5e8f\u8d1f\u8f7d\u5747\u8861\uff0c\u53ea\u62ff\u5230\u7528\u6237 HTTP \u8bf7\u6c42\u4e2d\u95f4\u90a3\u4e48\u4e00\u5c0f\u6bb5\uff0c\u4e5f\u6ca1\u529e\u6cd5\u5904\u7406\u554a\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5678396\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : hxndg <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @3dwelcome <br \/>\u9996\u5148\uff0c\u8d1f\u8f7d\u5747\u8861\u53ef\u4ee5\u5750\u5728\u56db\u5c42\u4e5f\u53ef\u4ee5\u5750\u5728\u4e03\u5c42<br \/>\u5176\u6b21\uff0c\u4f60\u53ef\u4ee5\u81ea\u5df1\u7ef4\u62a4\u8d1f\u8f7d\u5747\u8861\uff0c\u4e5f\u53ef\u4ee5\u8ba9\u7cfb\u7edf\u5e95\u5c42\u7ef4\u62a4\u8d1f\u8f7d\u5747\u8861\u3002\u8fd8\u662f\u90a3\u53e5\u8bdd\u4e94\u5143\u7ec4\u53ef\u4ee5\u533a\u5206\u5f00\u5177\u4f53\u8be5\u4ea4\u7ed9\u54ea\u4e2a\u7ebf\u7a0b\u4e86\u3002<br \/>lwn.net \u4e0a\u7684\u4ecb\u7ecd https:\/\/lwn.net\/Articles\/542629\/                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5678397\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : hxndg <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u641e\u6df7\u4e86\u4e24\u4e2a\u6982\u5ff5\uff0c\u4e00\u4e2a\u662f TCP \u7684\u5206\u5305\uff0c\u4e00\u4e2a\u662f\u8d1f\u8f7d\u5747\u8861\u3002\u4e24\u4e2a\u662f\u5b8c\u5168\u4e0d\u540c\u7684\u6982\u5ff5<br \/>\u76f4\u63a5\u770b\u8fd9\u4e2a\u7f51\u5740\u5427\uff0c\u8bf4\u7684\u591f\u7b80\u5355\u4e86 https:\/\/medium.com\/uckey\/so-reuseport-addr-2-2-how-packets-forwarded-to-multiple-sockets-ce4b83cd0fd2                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5678398\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : 3dwelcome <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @hxndg &#8220;\u8fd8\u662f\u90a3\u53e5\u8bdd\uff0cTCP \u4e94\u5143\u7ec4\u53ef\u4ee5\u533a\u5206\u5f00\u5177\u4f53\u8be5\u4ea4\u7ed9\u54ea\u4e2a\u7ebf\u7a0b\u4e86\u3002&#8221;<br \/>\u4e0d\u5bf9\u554a\u3002<br \/>\u6211\u767e\u5ea6\u641c\u4e86\u4e00\u4e0b\uff0c\u4e94\u5143\u7956\u5c31\u662f\u6e90 IP+\u6e90\u7aef\u53e3+\u76ee\u6807 IP+\u76ee\u6807\u7aef\u53e3\uff0c\u53ef\u5e76\u4e0d\u662f\u552f\u4e00\u7684\uff0c\u5f88\u5bb9\u6613\u5c31\u88ab\u4e2d\u95f4 NAT \u4fee\u6539\u4e86( https:\/\/www.liangzl.com\/get-article-detail-227271.html)<\/p>\n<p>\u90a3\u4e48\u5f88\u6709\u53ef\u80fd\uff0c\u5230\u5177\u4f53\u7ebf\u7a0b\u91cc\uff0c\u4e24\u6761\u4e0d\u540c TCP \u901a\u9053\uff0c\u6e90 IP+\u6e90\u7aef\u53e3+\u76ee\u6807 IP+\u76ee\u6807\u7aef\u53e3\u662f\u4e00\u6837\u7684\u3002<br \/>\u9996\u5148 SO_REUSEPORT \u4f1a\u786e\u4fdd\u5728\u591a\u6761 TCP \u901a\u9053\u91cc\uff0c\u672c\u673a IP \u548c\u672c\u5730\u7ed1\u5b9a\u7aef\u53e3\u662f\u4e00\u81f4\u7684\u3002<br \/>\u5176\u6b21 NAT \u4e0b\u9762\u591a\u6761 TCP \u901a\u9053\u91cc\uff0c\u53d1\u8d77 IP \u548c\u53d1\u8d77\u7684\u7aef\u53e3\u662f\u6709\u53ef\u80fd\u51b2\u7a81\u7684\uff08\u7aef\u53e3\u53ea\u6709\u53cc\u5b57\u8282\u4e0a\u9650\uff0c\u800c NAT \u4e0b\u9762\u53ef\u4ee5\u6269\u5c55\u5f88\u591a\u7535\u8111\uff0c\u6bcf\u53f0\u7535\u8111\u5bf9\u76f8\u540c\u670d\u52a1\u5668\u7aef\u53e3\u53d1\u51fa\u8bf7\u6c42\uff0c\u603b\u6709\u7535\u8111\u603b\u8fde\u63a5\u6570\u8d85\u8fc7 65535\uff0c\u5c31\u5fc5\u7136\u4f1a\u9020\u6210 TCP \u4e94\u5143\u7ec4\u51b2\u7a81\uff09                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5678399\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : hxndg <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u7b97\u4e86\uff0c\u4f60\u8bf4\u7684\u90fd\u5bf9\uff0c\u4f60\u5f00\u5fc3\u5c31\u597d                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5678400\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : 3dwelcome <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @hxndg \u6211\u53ea\u662f\u597d\u5947\u8ba8\u8bba\u4e00\u4e0b\u3002<br \/>\u4e00\u822c\u60c5\u51b5\uff0c\u4e00\u53f0 PC \u786e\u5b9e\u53ea\u6709 2 \u4e07\u591a\u4e2a\u5ba2\u6237\u7aef\u8fde\u63a5\u7aef\u53e3\u53ef\u7528(\u9ed8\u8ba4 net.ipv4.ip_local_port_range = 32768 61000)\u3002\u5c31\u7b97\u4e0d\u7528 IPV4\uff0c\u6539\u7528 IPV6\uff0c\u534f\u8bae\u4e5f\u6ca1\u589e\u52a0\u4efb\u4f55\u7aef\u53e3\u4e0a\u9650\uff0c\u8fd8\u662f 16bit \u7ed9\u5199\u6b7b\u4e86\u3002<br \/>\u6240\u4ee5\u5982\u679c\u8fd9\u53f0 PC\uff0c\u521a\u5de7\u662f NAT \u51fa\u53e3\uff0c\u5c31\u4f1a\u9047\u5230\u672c\u673a\u7aef\u53e3\u8017\u5c3d\u7684\u60c5\u51b5\u3002TCP \u4e94\u5143\u7956\u51b2\u7a81\u5e94\u8be5\u4e0d\u4f1a\uff0c\u5c31\u662f TCP \u8fde\u63a5\u76f4\u63a5\u5931\u8d25\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5678401\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : julyclyde <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u80fd\u7406\u89e3\u4f60\u7684\u63d0\u95ee\u7684\u4eba\u90fd\u4e0d\u592a\u591a<br \/>\u5efa\u8bae\u4f60\u8fd8\u662f\u628a\u201c3.9 \u5f00\u59cb\u201d\u90a3\u4e2a\u529f\u80fd\u7684\u539f\u6587\u53d1\u4e0a\u6765                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5678402\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : SmartKeyerror <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @hxndg \u6211\u5bfb\u601d\u7740 TCP \u5305\u91cc\u9762\u53ea\u5305\u542b\u6e90\u7aef\u53e3\u53f7+\u76ee\u7684\u7aef\u53e3\u53f7\uff0cIP \u5305\u91cc\u9762\u624d\u662f\u6e90 IP \u5730\u5740 + \u76ee\u7684 IP \u5730\u5740\uff0cTCP \u533a\u5206\u63a5\u6536\u7a0b\u5e8f\u96be\u9053\u4e0d\u662f\u901a\u8fc7\u7aef\u53e3\u53f7\u533a\u5206\u7684? TCP \u4e0a\u5c42\u662f\u4e2a\u4ec0\u4e48\u4e1c\u897f?                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5678403\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : hxndg <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @SmartKeyerror <br \/>\u56db\u5c42\u8d1f\u8f7d\u5747\u8861\u548c\u4e03\u5c42\u8d1f\u8f7d\u5747\u8861\u7684\u533a\u522b\uff0c\u81ea\u5b9a\u534f\u8bae\u548c\u975e\u81ea\u5b9a\u534f\u8bae\u800c\u5df2<br \/>\u800c\u4e14\u534f\u8bae\u6808\u5982\u679c\u81ea\u5df1\u5199\uff0c\u60f3\u5e72\u4ec0\u4e48\u5e72\u4ec0\u4e48\uff0c\u4e3a\u4ec0\u4e48\u4e0d\u80fd\u62ff\u5230\u4e94\u5143\u7ec4\u5462\uff1f<br \/>\u5982\u679c\u53ea\u80fd\u5229\u7528\u7aef\u53e3\u53f7\u533a\u5206\uff0c\u90a3\u4e48\u591a\u7684\u8d1f\u8f7d\u5747\u8861\u516c\u53f8\u90fd\u662f\u5728\u626f\u6de1\u5417\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u4e3a\u4ec0\u4e48 TCP \u5141\u8bb8\u591a\u4e2a\u7a0b\u5e8f\u7ed1\u5b9a\u540c&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/440136"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=440136"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/440136\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=440136"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=440136"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=440136"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}