{"id":208155,"date":"2021-01-04T10:40:56","date_gmt":"2021-01-04T02:40:56","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=208155"},"modified":"2020-12-28T08:41:44","modified_gmt":"2020-12-28T00:41:44","slug":"fabao-linux","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/fabao-linux.html","title":{"rendered":"\u4f60\u4e0d\u597d\u5947 Linux \u662f\u5982\u4f55\u6536\u53d1\u7f51\u7edc\u5305\u7684\uff1f"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | \u4e3a\u4e86\u4f7f\u5f97\u591a\u79cd\u8bbe\u5907\u80fd\u901a\u8fc7\u7f51\u7edc\u76f8\u4e92\u901a\u4fe1\uff0c\u548c\u4e3a\u4e86\u89e3\u51b3\u5404\u79cd\u4e0d\u540c\u8bbe\u5907\u5728\u7f51\u7edc\u4e92\u8054\u4e2d\u7684\u517c\u5bb9\u6027\u95ee\u9898\uff0c\u56fd\u9645\u6807\u6807\u51c6\u5316\u7ec4\u7ec7\u5236\u5b9a\u4e86\u5f00\u653e\u5f0f\u7cfb\u7edf\u4e92\u8054\u901a\u4fe1\u53c2\u8003\u6a21\u578b\uff08open System Interconnection Reference Model\uff09\uff0c\u4e5f\u5c31\u662f OSI \u7f51\u7edc\u6a21\u578b\uff0c\u8be5\u6a21\u578b\u4e3b\u8981\u6709 7 \u5c42\uff0c\u5206\u522b\u662f\u5e94\u7528\u5c42\u3001\u8868\u793a\u5c42\u3001\u4f1a\u8bdd\u5c42\u3001\u4f20\u8f93\u5c42\u3001\u7f51\u7edc\u5c42\u3001\u6570\u636e\u94fe\u8def\u5c42\u4ee5\u53ca\u7269\u7406\u5c42\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u2022\u5e94\u7528\u5c42\uff0c\u8d1f\u8d23\u7ed9\u5e94\u7528\u7a0b\u5e8f\u63d0\u4f9b\u7edf\u4e00\u7684\u63a5\u53e3\uff1b<\/p>\n \u2022\u8868\u793a\u5c42\uff0c\u8d1f\u8d23\u628a\u6570\u636e\u8f6c\u6362\u6210\u517c\u5bb9\u53e6\u4e00\u4e2a\u7cfb\u7edf\u80fd\u8bc6\u522b\u7684\u683c\u5f0f\uff1b<\/p>\n \u2022\u4f1a\u8bdd\u5c42\uff0c\u8d1f\u8d23\u5efa\u7acb\u3001\u7ba1\u7406\u548c\u7ec8\u6b62\u8868\u793a\u5c42\u5b9e\u4f53\u4e4b\u95f4\u7684\u901a\u4fe1\u4f1a\u8bdd\uff1b<\/p>\n \u2022\u4f20\u8f93\u5c42\uff0c\u8d1f\u8d23\u7aef\u5230\u7aef\u7684\u6570\u636e\u4f20\u8f93\uff1b<\/p>\n \u2022\u7f51\u7edc\u5c42\uff0c\u8d1f\u8d23\u6570\u636e\u7684\u8def\u7531\u3001\u8f6c\u53d1\u3001\u5206\u7247\uff1b<\/p>\n \u2022\u6570\u636e\u94fe\u8def\u5c42\uff0c\u8d1f\u8d23\u6570\u636e\u7684\u5c01\u5e27\u548c\u5dee\u9519\u68c0\u6d4b\uff0c\u4ee5\u53ca MAC \u5bfb\u5740\uff1b<\/p>\n \u2022\u7269\u7406\u5c42\uff0c\u8d1f\u8d23\u5728\u7269\u7406\u7f51\u7edc\u4e2d\u4f20\u8f93\u6570\u636e\u5e27\uff1b<\/p>\n \u7531\u4e8e OSI \u6a21\u578b\u5b9e\u5728\u592a\u590d\u6742\uff0c\u63d0\u51fa\u7684\u4e5f\u53ea\u662f\u6982\u5ff5\u7406\u8bba\u4e0a\u7684\u5206\u5c42\uff0c\u5e76\u6ca1\u6709\u63d0\u4f9b\u5177\u4f53\u7684\u5b9e\u73b0\u65b9\u6848\u3002\u4e8b\u5b9e\u4e0a\uff0c\u6211\u4eec\u6bd4\u8f83\u5e38\u89c1\uff0c\u4e5f\u6bd4\u8f83\u5b9e\u7528\u7684\u662f\u56db\u5c42\u6a21\u578b\uff0c\u5373 TCP\/IP \u7f51\u7edc\u6a21\u578b\uff0cLinux \u7cfb\u7edf\u6b63\u662f\u6309\u7167\u8fd9\u5957\u7f51\u7edc\u6a21\u578b\u6765\u5b9e\u73b0\u7f51\u7edc\u534f\u8bae\u6808\u7684\u3002<\/p>\n TCP\/IP \u7f51\u7edc\u6a21\u578b\u5171\u6709 4 \u5c42\uff0c\u5206\u522b\u662f\u5e94\u7528\u5c42\u3001\u4f20\u8f93\u5c42\u3001\u7f51\u7edc\u5c42\u548c\u7f51\u7edc\u63a5\u53e3\u5c42\uff0c\u6bcf\u4e00\u5c42\u8d1f\u8d23\u7684\u804c\u80fd\u5982\u4e0b\uff1a<\/p>\n \u2022\u5e94\u7528\u5c42\uff0c\u8d1f\u8d23\u5411\u7528\u6237\u63d0\u4f9b\u4e00\u7ec4\u5e94\u7528\u7a0b\u5e8f\uff0c\u6bd4\u5982 HTTP\u3001DNS\u3001FTP \u7b49;<\/p>\n \u2022\u4f20\u8f93\u5c42\uff0c\u8d1f\u8d23\u7aef\u5230\u7aef\u7684\u901a\u4fe1\uff0c\u6bd4\u5982 TCP\u3001UDP \u7b49\uff1b<\/p>\n \u2022\u7f51\u7edc\u5c42\uff0c\u8d1f\u8d23\u7f51\u7edc\u5305\u7684\u5c01\u88c5\u3001\u5206\u7247\u3001\u8def\u7531\u3001\u8f6c\u53d1\uff0c\u6bd4\u5982 IP\u3001ICMP \u7b49\uff1b<\/p>\n \u2022\u7f51\u7edc\u63a5\u53e3\u5c42\uff0c\u8d1f\u8d23\u7f51\u7edc\u5305\u5728\u7269\u7406\u7f51\u7edc\u4e2d\u7684\u4f20\u8f93\uff0c\u6bd4\u5982\u7f51\u7edc\u5305\u7684\u5c01\u5e27\u3001 MAC \u5bfb\u5740\u3001\u5dee\u9519\u68c0\u6d4b\uff0c\u4ee5\u53ca\u901a\u8fc7\u7f51\u5361\u4f20\u8f93\u7f51\u7edc\u5e27\u7b49\uff1b<\/p>\n TCP\/IP \u7f51\u7edc\u6a21\u578b\u76f8\u6bd4 OSI \u7f51\u7edc\u6a21\u578b\u7b80\u5316\u4e86\u4e0d\u5c11\uff0c\u4e5f\u66f4\u52a0\u6613\u8bb0\uff0c\u5b83\u4eec\u4e4b\u95f4\u7684\u5173\u7cfb\u5982\u4e0b\u56fe\uff1a<\/p>\n
Linux \u7f51\u7edc\u534f\u8bae\u6808<\/strong><\/div>\n \u6211\u4eec\u53ef\u4ee5\u628a\u81ea\u5df1\u7684\u8eab\u4f53\u6bd4\u4f5c\u5e94\u7528\u5c42\u4e2d\u7684\u6570\u636e\uff0c\u6253\u5e95\u8863\u670d\u6bd4\u4f5c\u4f20\u8f93\u5c42\u4e2d\u7684 TCP \u5934\uff0c\u5916\u5957\u6bd4\u4f5c\u7f51\u7edc\u5c42\u4e2d IP \u5934\uff0c\u5e3d\u5b50\u548c\u978b\u5b50\u5206\u522b\u6bd4\u4f5c\u7f51\u7edc\u63a5\u53e3\u5c42\u7684\u5e27\u5934\u548c\u5e27\u5c3e\u3002<\/p>\n \u5728\u51ac\u5929\u8fd9\u4e2a\u5b63\u8282\uff0c\u5f53\u6211\u4eec\u8981\u4ece\u5bb6\u91cc\u51fa\u53bb\u73a9\u7684\u65f6\u5019\uff0c\u81ea\u7136\u8981\u5148\u7a7f\u4e2a\u6253\u5e95\u8863\u670d\uff0c\u518d\u5957\u4e0a\u4fdd\u6696\u5916\u5957\uff0c\u6700\u540e\u7a7f\u4e0a\u5e3d\u5b50\u548c\u978b\u5b50\u624d\u51fa\u95e8\uff0c\u8fd9\u4e2a\u8fc7\u7a0b\u5c31\u597d\u50cf\u6211\u4eec\u628a TCP \u534f\u8bae\u901a\u4fe1\u7684\u7f51\u7edc\u5305\u53d1\u51fa\u53bb\u7684\u65f6\u5019\uff0c\u4f1a\u628a\u5e94\u7528\u5c42\u7684\u6570\u636e\u6309\u7167\u7f51\u7edc\u534f\u8bae\u6808\u5c42\u5c42\u5c01\u88c5\u548c\u5904\u7406\u3002<\/p>\n \u4f60\u4ece\u4e0b\u9762\u8fd9\u5f20\u56fe\u53ef\u4ee5\u770b\u5230\uff0c\u5e94\u7528\u5c42\u6570\u636e\u5728\u6bcf\u4e00\u5c42\u7684\u5c01\u88c5\u683c\u5f0f\u3002<\/p>\n
\u2022\u4f20\u8f93\u5c42\uff0c\u7ed9\u5e94\u7528\u6570\u636e\u524d\u9762\u589e\u52a0\u4e86 TCP \u5934\uff1b<\/p>\n \u2022\u7f51\u7edc\u5c42\uff0c\u7ed9 TCP \u6570\u636e\u5305\u524d\u9762\u589e\u52a0\u4e86 IP \u5934\uff1b<\/p>\n \u2022\u7f51\u7edc\u63a5\u53e3\u5c42\uff0c\u7ed9 IP \u6570\u636e\u5305\u524d\u540e\u5206\u522b\u589e\u52a0\u4e86\u5e27\u5934\u548c\u5e27\u5c3e\uff1b<\/p>\n \u8fd9\u4e9b\u65b0\u589e\u548c\u5934\u90e8\u548c\u5c3e\u90e8\uff0c\u90fd\u6709\u5404\u81ea\u7684\u4f5c\u7528\uff0c\u4e5f\u90fd\u662f\u6309\u7167\u7279\u5b9a\u7684\u534f\u8bae\u683c\u5f0f\u586b\u5145\uff0c\u8fd9\u6bcf\u4e00\u5c42\u90fd\u589e\u52a0\u4e86\u5404\u81ea\u7684\u534f\u8bae\u5934\uff0c\u90a3\u81ea\u7136\u7f51\u7edc\u5305\u7684\u5927\u5c0f\u5c31\u589e\u5927\u4e86\uff0c\u4f46\u7269\u7406\u94fe\u8def\u5e76\u4e0d\u80fd\u4f20\u8f93\u4efb\u610f\u5927\u5c0f\u7684\u6570\u636e\u5305\uff0c\u6240\u4ee5\u5728\u4ee5\u592a\u7f51\u4e2d\uff0c\u89c4\u5b9a\u4e86\u6700\u5927\u4f20\u8f93\u5355\u5143\uff08MTU\uff09\u662f 1500 \u5b57\u8282\uff0c\u4e5f\u5c31\u662f\u89c4\u5b9a\u4e86\u5355\u6b21\u4f20\u8f93\u7684\u6700\u5927 IP \u5305\u5927\u5c0f\u3002<\/p>\n \u5f53\u7f51\u7edc\u5305\u8d85\u8fc7 MTU \u7684\u5927\u5c0f\uff0c\u5c31\u4f1a\u5728\u7f51\u7edc\u5c42\u5206\u7247\uff0c\u4ee5\u786e\u4fdd\u5206\u7247\u540e\u7684 IP \u5305\u4e0d\u4f1a\u8d85\u8fc7 MTU \u5927\u5c0f\uff0c\u5982\u679c MTU \u8d8a\u5c0f\uff0c\u9700\u8981\u7684\u5206\u5305\u5c31\u8d8a\u591a\uff0c\u90a3\u4e48\u7f51\u7edc\u541e\u5410\u80fd\u529b\u5c31\u8d8a\u5dee\uff0c\u76f8\u53cd\u7684\uff0c\u5982\u679c MTU \u8d8a\u5927\uff0c\u9700\u8981\u7684\u5206\u5305\u5c31\u8d8a\u5c0f\uff0c\u90a3\u4e48\u7f51\u7edc\u541e\u5410\u80fd\u529b\u5c31\u8d8a\u597d\u3002<\/p>\n \u77e5\u9053\u4e86 TCP\/IP \u7f51\u7edc\u6a21\u578b\uff0c\u4ee5\u53ca\u7f51\u7edc\u5305\u7684\u5c01\u88c5\u539f\u7406\u540e\uff0c\u90a3\u4e48 Linux \u7f51\u7edc\u534f\u8bae\u6808\u7684\u6837\u5b50\uff0c\u4f60\u60f3\u5fc5\u731c\u5230\u4e86\u5927\u6982\uff0c\u5b83\u5176\u5b9e\u5c31\u7c7b\u4f3c\u4e8e TCP\/IP \u7684\u56db\u5c42\u7ed3\u6784\uff1a<\/p>\n
\u2022\u5e94\u7528\u7a0b\u5e8f\u9700\u8981\u901a\u8fc7\u7cfb\u7edf\u8c03\u7528\uff0c\u6765\u8ddf Socket \u5c42\u8fdb\u884c\u6570\u636e\u4ea4\u4e92\uff1b<\/p>\n \u2022Socket \u5c42\u7684\u4e0b\u9762\u5c31\u662f\u4f20\u8f93\u5c42\u3001\u7f51\u7edc\u5c42\u548c\u7f51\u7edc\u63a5\u53e3\u5c42\uff1b<\/p>\n \u2022\u6700\u4e0b\u9762\u7684\u4e00\u5c42\uff0c\u5219\u662f\u7f51\u5361\u9a71\u52a8\u7a0b\u5e8f\u548c\u786c\u4ef6\u7f51\u5361\u8bbe\u5907\uff1b<\/p>\n Linux \u63a5\u6536\u7f51\u7edc\u5305\u7684\u6d41\u7a0b<\/strong><\/div>\n \u7f51\u5361\u662f\u8ba1\u7b97\u673a\u91cc\u7684\u4e00\u4e2a\u786c\u4ef6\uff0c\u4e13\u95e8\u8d1f\u8d23\u63a5\u6536\u548c\u53d1\u9001\u7f51\u7edc\u5305\uff0c\u5f53\u7f51\u5361\u63a5\u6536\u5230\u4e00\u4e2a\u7f51\u7edc\u5305\u540e\uff0c\u4f1a\u901a\u8fc7 DMA \u6280\u672f\uff0c\u5c06\u7f51\u7edc\u5305\u653e\u5165\u5230 Ring Buffer\uff0c\u8fd9\u4e2a\u662f\u4e00\u4e2a\u73af\u5f62\u7f13\u51b2\u533a\uff0c\u8be5\u7f13\u51b2\u533a\u5728\u5185\u6838\u5185\u5b58\u4e2d\u7684\u7f51\u5361\u9a71\u52a8\u91cc\u3002<\/p>\n \u90a3\u63a5\u6536\u5230\u7f51\u7edc\u5305\u540e\uff0c\u5e94\u8be5\u600e\u4e48\u544a\u8bc9\u64cd\u4f5c\u7cfb\u7edf\u8fd9\u4e2a\u7f51\u7edc\u5305\u5df2\u7ecf\u5230\u8fbe\u4e86\u5462\uff1f<\/p>\n \u6700\u7b80\u5355\u7684\u4e00\u79cd\u65b9\u5f0f\u5c31\u662f\u89e6\u53d1\u4e2d\u65ad\uff0c\u4e5f\u5c31\u662f\u6bcf\u5f53\u7f51\u5361\u6536\u5230\u4e00\u4e2a\u7f51\u7edc\u5305\uff0c\u5c31\u89e6\u53d1\u4e00\u4e2a\u4e2d\u65ad\u544a\u8bc9\u64cd\u4f5c\u7cfb\u7edf\u3002<\/p>\n \u4f46\u662f\uff0c\u8fd9\u5b58\u5728\u4e00\u4e2a\u95ee\u9898\uff0c\u5728\u9ad8\u6027\u80fd\u7f51\u7edc\u573a\u666f\u4e0b\uff0c\u7f51\u7edc\u5305\u7684\u6570\u91cf\u4f1a\u975e\u5e38\u591a\uff0c\u90a3\u4e48\u5c31\u4f1a\u89e6\u53d1\u975e\u5e38\u591a\u7684\u4e2d\u65ad\uff0c\u8981\u77e5\u9053\u5f53 CPU \u6536\u5230\u4e86\u4e2d\u65ad\uff0c\u5c31\u4f1a\u505c\u4e0b\u624b\u91cc\u7684\u4e8b\u60c5\uff0c\u800c\u53bb\u5904\u7406\u8fd9\u4e9b\u7f51\u7edc\u5305\uff0c\u5904\u7406\u5b8c\u6bd5\u540e\uff0c\u624d\u4f1a\u56de\u53bb\u7ee7\u7eed\u5176\u4ed6\u4e8b\u60c5\uff0c\u90a3\u4e48\u9891\u7e41\u5730\u89e6\u53d1\u4e2d\u65ad\uff0c\u5219\u4f1a\u5bfc\u81f4 CPU \u4e00\u76f4\u6ca1\u73a9\u6ca1\u4e86\u7684\u5904\u7406\u4e2d\u65ad\uff0c\u800c\u5bfc\u81f4\u5176\u4ed6\u4efb\u52a1\u53ef\u80fd\u65e0\u6cd5\u7ee7\u7eed\u524d\u8fdb\uff0c\u4ece\u800c\u5f71\u54cd\u7cfb\u7edf\u7684\u6574\u4f53\u6548\u7387\u3002<\/p>\n \u6240\u4ee5\u4e3a\u4e86\u89e3\u51b3\u9891\u7e41\u4e2d\u65ad\u5e26\u6765\u7684\u6027\u80fd\u5f00\u9500\uff0cLinux \u5185\u6838\u5728 2.6 \u7248\u672c\u4e2d\u5f15\u5165\u4e86 NAPI \u673a\u5236\uff0c\u5b83\u662f\u6df7\u5408\u300c\u4e2d\u65ad\u548c\u8f6e\u8be2\u300d\u7684\u65b9\u5f0f\u6765\u63a5\u6536\u7f51\u7edc\u5305\uff0c\u5b83\u7684\u6838\u5fc3\u6982\u5ff5\u5c31\u662f\u4e0d\u91c7\u7528\u4e2d\u65ad\u7684\u65b9\u5f0f\u8bfb\u53d6\u6570\u636e\uff0c\u800c\u662f\u9996\u5148\u91c7\u7528\u4e2d\u65ad\u5524\u9192\u6570\u636e\u63a5\u6536\u7684\u670d\u52a1\u7a0b\u5e8f\uff0c\u7136\u540e poll \u7684\u65b9\u6cd5\u6765\u8f6e\u8be2\u6570\u636e\u3002<\/p>\n \u6bd4\u5982\uff0c\u5f53\u6709\u7f51\u7edc\u5305\u5230\u8fbe\u65f6\uff0c\u7f51\u5361\u53d1\u8d77\u786c\u4ef6\u4e2d\u65ad\uff0c\u4e8e\u662f\u4f1a\u6267\u884c\u7f51\u5361\u786c\u4ef6\u4e2d\u65ad\u5904\u7406\u51fd\u6570\uff0c\u4e2d\u65ad\u5904\u7406\u51fd\u6570\u5904\u7406\u5b8c\u9700\u8981\u300c\u6682\u65f6\u5c4f\u853d\u4e2d\u65ad\u300d\uff0c\u7136\u540e\u5524\u9192\u300c\u8f6f\u4e2d\u65ad\u300d\u6765\u8f6e\u8be2\u5904\u7406\u6570\u636e\uff0c\u76f4\u5230\u6ca1\u6709\u65b0\u6570\u636e\u65f6\u624d\u6062\u590d\u4e2d\u65ad\uff0c\u8fd9\u6837\u4e00\u6b21\u4e2d\u65ad\u5904\u7406\u591a\u4e2a\u7f51\u7edc\u5305\uff0c\u4e8e\u662f\u5c31\u53ef\u4ee5\u964d\u4f4e\u7f51\u5361\u4e2d\u65ad\u5e26\u6765\u7684\u6027\u80fd\u5f00\u9500\u3002<\/p>\n \u90a3\u8f6f\u4e2d\u65ad\u662f\u600e\u4e48\u5904\u7406\u7f51\u7edc\u5305\u7684\u5462\uff1f\u5b83\u4f1a\u4ece Ring Buffer \u4e2d\u62f7\u8d1d\u6570\u636e\u5230\u5185\u6838 struct sk_buff \u7f13\u51b2\u533a\u4e2d\uff0c\u4ece\u800c\u53ef\u4ee5\u4f5c\u4e3a\u4e00\u4e2a\u7f51\u7edc\u5305\u4ea4\u7ed9\u7f51\u7edc\u534f\u8bae\u6808\u8fdb\u884c\u9010\u5c42\u5904\u7406\u3002<\/p>\n \u9996\u5148\uff0c\u4f1a\u5148\u8fdb\u5165\u5230\u7f51\u7edc\u63a5\u53e3\u5c42\uff0c\u5728\u8fd9\u4e00\u5c42\u4f1a\u68c0\u67e5\u62a5\u6587\u7684\u5408\u6cd5\u6027\uff0c\u5982\u679c\u4e0d\u5408\u6cd5\u5219\u4e22\u5f03\uff0c\u5408\u6cd5\u5219\u4f1a\u627e\u51fa\u8be5\u7f51\u7edc\u5305\u7684\u4e0a\u5c42\u534f\u8bae\u7684\u7c7b\u578b\uff0c\u6bd4\u5982\u662f IPv4\uff0c\u8fd8\u662f IPv6\uff0c\u63a5\u7740\u518d\u53bb\u6389\u5e27\u5934\u548c\u5e27\u5c3e\uff0c\u7136\u540e\u4ea4\u7ed9\u7f51\u7edc\u5c42\u3002<\/p>\n \u5230\u4e86\u7f51\u7edc\u5c42\uff0c\u5219\u53d6\u51fa IP \u5305\uff0c\u5224\u65ad\u7f51\u7edc\u5305\u4e0b\u4e00\u6b65\u7684\u8d70\u5411\uff0c\u6bd4\u5982\u662f\u4ea4\u7ed9\u4e0a\u5c42\u5904\u7406\u8fd8\u662f\u8f6c\u53d1\u51fa\u53bb\u3002\u5f53\u786e\u8ba4\u8fd9\u4e2a\u7f51\u7edc\u5305\u8981\u53d1\u9001\u7ed9\u672c\u673a\u540e\uff0c\u5c31\u4f1a\u4ece IP \u5934\u91cc\u770b\u770b\u4e0a\u4e00\u5c42\u534f\u8bae\u7684\u7c7b\u578b\u662f TCP \u8fd8\u662f UDP\uff0c\u63a5\u7740\u53bb\u6389 IP \u5934\uff0c\u7136\u540e\u4ea4\u7ed9\u4f20\u8f93\u5c42\u3002<\/p>\n \u4f20\u8f93\u5c42\u53d6\u51fa TCP \u5934\u6216 UDP \u5934\uff0c\u6839\u636e\u56db\u5143\u7ec4\u300c\u6e90 IP\u3001\u6e90\u7aef\u53e3\u3001\u76ee\u7684 IP\u3001\u76ee\u7684\u7aef\u53e3\u300d \u4f5c\u4e3a\u6807\u8bc6\uff0c\u627e\u51fa\u5bf9\u5e94\u7684 Socket\uff0c\u5e76\u628a\u6570\u636e\u62f7\u8d1d\u5230 Socket \u7684\u63a5\u6536\u7f13\u51b2\u533a\u3002<\/p>\n \u6700\u540e\uff0c\u5e94\u7528\u5c42\u7a0b\u5e8f\u8c03\u7528 Socket \u63a5\u53e3\uff0c\u4ece\u5185\u6838\u7684 Socket \u63a5\u6536\u7f13\u51b2\u533a\u8bfb\u53d6\u65b0\u5230\u6765\u7684\u6570\u636e\u5230\u5e94\u7528\u5c42\u3002<\/p>\n \u81f3\u6b64\uff0c\u4e00\u4e2a\u7f51\u7edc\u5305\u7684\u63a5\u6536\u8fc7\u7a0b\u5c31\u5df2\u7ecf\u7ed3\u675f\u4e86\uff0c\u4f60\u4e5f\u53ef\u4ee5\u4ece\u4e0b\u56fe\u5de6\u8fb9\u90e8\u5206\u770b\u5230\u7f51\u7edc\u5305\u63a5\u6536\u7684\u6d41\u7a0b\uff0c\u53f3\u8fb9\u90e8\u5206\u521a\u597d\u53cd\u8fc7\u6765\uff0c\u5b83\u662f\u7f51\u7edc\u5305\u53d1\u9001\u7684\u6d41\u7a0b\u3002<\/p>\n <\/p>\n Linux \u53d1\u9001\u7f51\u7edc\u5305\u7684\u6d41\u7a0b<\/strong><\/div>\n \u5982\u4e0a\u56fe\u7684\u6709\u534a\u90e8\u5206\uff0c\u53d1\u9001\u7f51\u7edc\u5305\u7684\u6d41\u7a0b\u6b63\u597d\u548c\u63a5\u6536\u6d41\u7a0b\u76f8\u53cd\u3002<\/p>\n \u9996\u5148\uff0c\u5e94\u7528\u7a0b\u5e8f\u4f1a\u8c03\u7528 Socket \u53d1\u9001\u6570\u636e\u5305\u7684\u63a5\u53e3\uff0c\u7531\u4e8e\u8fd9\u4e2a\u662f\u7cfb\u7edf\u8c03\u7528\uff0c\u6240\u4ee5\u4f1a\u4ece\u7528\u6237\u6001\u9677\u5165\u5230\u5185\u6838\u6001\u4e2d\u7684 Socket \u5c42\uff0cSocket \u5c42\u4f1a\u5c06\u5e94\u7528\u5c42\u6570\u636e\u62f7\u8d1d\u5230 Socket \u53d1\u9001\u7f13\u51b2\u533a\u4e2d\u3002<\/p>\n \u63a5\u4e0b\u6765\uff0c\u7f51\u7edc\u534f\u8bae\u6808\u4ece Socket \u53d1\u9001\u7f13\u51b2\u533a\u4e2d\u53d6\u51fa\u6570\u636e\u5305\uff0c\u5e76\u6309\u7167 TCP\/IP \u534f\u8bae\u6808\u4ece\u4e0a\u5230\u4e0b\u9010\u5c42\u5904\u7406\u3002<\/p>\n \u5982\u679c\u4f7f\u7528\u7684\u662f TCP \u4f20\u8f93\u534f\u8bae\u53d1\u9001\u6570\u636e\uff0c\u90a3\u4e48\u4f1a\u5728\u4f20\u8f93\u5c42\u589e\u52a0 TCP \u5305\u5934\uff0c\u7136\u540e\u4ea4\u7ed9\u7f51\u7edc\u5c42\uff0c\u7f51\u7edc\u5c42\u4f1a\u7ed9\u6570\u636e\u5305\u589e\u52a0 IP \u5305\uff0c\u7136\u540e\u901a\u8fc7\u67e5\u8be2\u8def\u7531\u8868\u786e\u8ba4\u4e0b\u4e00\u8df3\u7684 IP\uff0c\u5e76\u6309\u7167 MTU \u5927\u5c0f\u8fdb\u884c\u5206\u7247\u3002<\/p>\n \u5206\u7247\u540e\u7684\u7f51\u7edc\u5305\uff0c\u5c31\u4f1a\u88ab\u9001\u5230\u7f51\u7edc\u63a5\u53e3\u5c42\uff0c\u5728\u8fd9\u91cc\u4f1a\u901a\u8fc7 ARP \u534f\u8bae\u83b7\u5f97\u4e0b\u4e00\u8df3\u7684 MAC \u5730\u5740\uff0c\u7136\u540e\u589e\u52a0\u5e27\u5934\u548c\u5e27\u5c3e\uff0c\u653e\u5230\u53d1\u5305\u961f\u5217\u4e2d\u3002<\/p>\n \u8fd9\u4e00\u4e9b\u51c6\u5907\u597d\u540e\uff0c\u4f1a\u89e6\u53d1\u8f6f\u4e2d\u65ad\u544a\u8bc9\u7f51\u5361\u9a71\u52a8\u7a0b\u5e8f\uff0c\u8fd9\u91cc\u6709\u65b0\u7684\u7f51\u7edc\u5305\u9700\u8981\u53d1\u9001\uff0c\u6700\u540e\u9a71\u52a8\u7a0b\u5e8f\u901a\u8fc7 DMA\uff0c\u4ece\u53d1\u5305\u961f\u5217\u4e2d\u8bfb\u53d6\u7f51\u7edc\u5305\uff0c\u5c06\u5176\u653e\u5165\u5230\u786c\u4ef6\u7f51\u5361\u7684\u961f\u5217\u4e2d\uff0c\u968f\u540e\u7269\u7406\u7f51\u5361\u518d\u5c06\u5b83\u53d1\u9001\u51fa\u53bb\u3002<\/p>\n \u603b\u7ed3<\/strong><\/div>\n \u7535\u8111\u4e0e\u7535\u8111\u4e4b\u95f4\u901a\u5e38\u90fd\u662f\u901a\u8bdd\u7f51\u5361\u3001\u4ea4\u6362\u673a\u3001\u8def\u7531\u5668\u7b49\u7f51\u7edc\u8bbe\u5907\u8fde\u63a5\u5230\u4e00\u8d77\uff0c\u90a3\u7531\u4e8e\u7f51\u7edc\u8bbe\u5907\u7684\u5f02\u6784\u6027\uff0c\u56fd\u9645\u6807\u51c6\u5316\u7ec4\u7ec7\u5b9a\u4e49\u4e86\u4e00\u4e2a\u4e03\u5c42\u7684 OSI \u7f51\u7edc\u6a21\u578b\uff0c\u4f46\u662f\u8fd9\u4e2a\u6a21\u578b\u7531\u4e8e\u6bd4\u8f83\u590d\u6742\uff0c\u5b9e\u9645\u5e94\u7528\u4e2d\u5e76\u6ca1\u6709\u91c7\u7528\uff0c\u800c\u662f\u91c7\u7528\u4e86\u66f4\u4e3a\u7b80\u5316\u7684 TCP\/IP \u6a21\u578b\uff0cLinux \u7f51\u7edc\u534f\u8bae\u6808\u5c31\u662f\u6309\u7167\u4e86\u8be5\u6a21\u578b\u6765\u5b9e\u73b0\u7684\u3002<\/p>\n TCP\/IP \u6a21\u578b\u4e3b\u8981\u5206\u4e3a\u5e94\u7528\u5c42\u3001\u4f20\u8f93\u5c42\u3001\u7f51\u7edc\u5c42\u3001\u7f51\u7edc\u63a5\u53e3\u5c42\u56db\u5c42\uff0c\u6bcf\u4e00\u5c42\u8d1f\u8d23\u7684\u804c\u8d23\u90fd\u4e0d\u540c\uff0c\u8fd9\u4e5f\u662f Linux \u7f51\u7edc\u534f\u8bae\u6808\u4e3b\u8981\u6784\u6210\u90e8\u5206\u3002<\/p>\n \u5f53\u5e94\u7528\u7a0b\u5e8f\u901a\u8fc7 Socket \u63a5\u53e3\u53d1\u9001\u6570\u636e\u5305\uff0c\u6570\u636e\u5305\u4f1a\u88ab\u7f51\u7edc\u534f\u8bae\u6808\u4ece\u4e0a\u5230\u4e0b\u8fdb\u884c\u9010\u5c42\u5904\u7406\u540e\uff0c\u624d\u4f1a\u88ab\u9001\u5230\u7f51\u5361\u961f\u5217\u4e2d\uff0c\u968f\u540e\u7531\u7f51\u5361\u5c06\u7f51\u7edc\u5305\u53d1\u9001\u51fa\u53bb\u3002<\/p>\n \u800c\u5728\u63a5\u6536\u7f51\u7edc\u5305\u65f6\uff0c\u540c\u6837\u4e5f\u8981\u5148\u7ecf\u8fc7\u7f51\u7edc\u534f\u8bae\u6808\u4ece\u4e0b\u5230\u4e0a\u7684\u9010\u5c42\u5904\u7406\uff0c\u6700\u540e\u624d\u4f1a\u88ab\u9001\u5230\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":" \u6bcf\u4e00\u5c42\u8d1f\u8d23\u7684\u804c\u80fd\u90fd\u4e0d\u540c\uff0c\u5982\u4e0b\uff1a \u2022\u5e94\u7528\u5c42\uff0c\u8d1f\u8d23\u7ed9\u5e94\u7528\u7a0b\u5e8f\u63d0\u4f9b\u7edf\u4e00\u7684\u63a5\u53e3\uff1b \u2022\u8868\u793a\u5c42\uff0c\u8d1f\u8d23\u628a\u6570\u636e\u8f6c\u6362\u6210\u517c\u5bb9\u53e6\u4e00\u4e2a […]<\/p>\n","protected":false},"author":1469,"featured_media":208161,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-208155","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\/208155","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\/1469"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=208155"}],"version-history":[{"count":1,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/208155\/revisions"}],"predecessor-version":[{"id":208162,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/208155\/revisions\/208162"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/208161"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=208155"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=208155"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=208155"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}} |