{"id":211095,"date":"2021-02-20T08:38:41","date_gmt":"2021-02-20T00:38:41","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=211095"},"modified":"2021-02-04T14:29:59","modified_gmt":"2021-02-04T06:29:59","slug":"linux-route-check","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-route-check.html","title":{"rendered":"Linux\u7f51\u7edc\u8def\u7531\u7b80\u4ecb-\u67e5\u770b\u7f51\u7edc\u8def\u7531"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n \u672c\u6587\u5bf9\u7528\u4e8e\u7406\u89e3\u7b80\u5355\u73af\u5883\u7684Linux\u8ba1\u7b97\u673a\u7684\u8def\u7531\u8fdb\u884c\u4e86\u975e\u5e38\u7b80\u77ed\u7684\u4ecb\u7ecd\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"<\/p>\n

linux \u67e5\u770b\u7f51\u7edc\u8def\u7531<\/strong><\/div>\n

\u8fde\u63a5\u5230\u7f51\u7edc\u7684\u6bcf\u53f0\u8ba1\u7b97\u673a\u5728\u79bb\u5f00\u672c\u5730\u4e3b\u673a\u65f6\u90fd\u9700\u8981\u9488\u5bf9\u7f51\u7edcTCP \/ IP\u6570\u636e\u5305\u7684\u67d0\u79cd\u8def\u7531\u8bf4\u660e\u3002 \u8fd9\u901a\u5e38\u975e\u5e38\u7b80\u5355\uff0c\u56e0\u4e3a\u5927\u591a\u6570\u7f51\u7edc\u73af\u5883\u90fd\u975e\u5e38\u7b80\u5355\uff0c\u5e76\u4e14\u79bb\u5f00\u6570\u636e\u5305\u53ea\u6709\u4e24\u79cd\u9009\u62e9\u3002 \u6240\u6709\u6570\u636e\u5305\u90fd\u53d1\u9001\u5230\u672c\u5730\u7f51\u7edc\u4e0a\u7684\u8bbe\u5907\u6216\u5176\u4ed6\u8fdc\u7a0b\u7f51\u7edc\u4e0a\u3002<\/p>\n

\u786e\u4fdd\u5c06\u201c\u672c\u5730\u201d\u7f51\u7edc\u5b9a\u4e49\u4e3a\u672c\u5730\u4e3b\u673a\u6240\u5728\u7684\u903b\u8f91\u7f51\u7edc\uff0c\u901a\u5e38\u4e5f\u5b9a\u4e49\u4e3a\u7269\u7406\u7f51\u7edc\u3002 \u4ece\u903b\u8f91\u4e0a\u8bb2\uff0c\u8fd9\u662f\u6307\u5728\u5176\u4e2d\u4e3a\u4e3b\u673a\u5206\u914d\u4e86\u672c\u5730\u5b50\u7f51IP\u5730\u5740\u8303\u56f4\u4e4b\u4e00\u7684\u672c\u5730\u5b50\u7f51\u3002 \u4ece\u7269\u7406\u4e0a\u8bb2\uff0c\u8fd9\u610f\u5473\u7740\u4e3b\u673a\u5df2\u8fde\u63a5\u5230\u4e00\u53f0\u6216\u591a\u53f0\u4ea4\u6362\u673a\uff0c\u8fd9\u4e9b\u4ea4\u6362\u673a\u4e5f\u5df2\u8fde\u63a5\u5230\u672c\u5730\u7f51\u7edc\u7684\u5176\u4f59\u90e8\u5206\u3002<\/p>\n

TCP \/ IP\u7f51\u7edc\u6a21\u578b<\/strong><\/div>\n

\n\u5728\u8fdb\u884c\u8def\u7531\u9009\u62e9\u4e4b\u524d\uff0c\u5148\u4e86\u89e3\u4e00\u4e9b\u6709\u5173\u6570\u636e\u5305\u5982\u4f55\u627e\u5230\u901a\u5f80\u7f51\u7edc\u4e0a\u6b63\u786e\u4e3b\u673a\u7684\u65b9\u5f0f\u7684\u5e2e\u52a9\u3002 TCP \/ IP \u7f51\u7edc\u6a21\u578b\u5b9a\u4e49\u4e86\u4e00\u4e2a\u4e94\u5c42\u5806\u6808\uff0c\u8be5\u5806\u6808\u63cf\u8ff0\u4e86\u5c06\u6570\u636e\u5305\u4ece\u4e00\u53f0\u4e3b\u673a\u79fb\u52a8\u5230\u53e6\u4e00\u53f0\u4e3b\u673a\u6240\u5fc5\u9700\u7684\u673a\u5236\uff0c\u65e0\u8bba\u8be5\u4e3b\u673a\u662f\u5728\u672c\u5730\u7f51\u7edc\u4e0a\u8fd8\u662f\u5728\u4e16\u754c\u8303\u56f4\u5185\u3002 \u5728\u6b64\u6a21\u578b\u7684\u4ee5\u4e0b\u63cf\u8ff0\u4e2d\uff0c\u6bcf\u4e2a\u5c42\u90fd\u6709\u7f16\u53f7\uff0c\u5e76\u4e14\u8fd8\u5305\u542b\u8be5\u5c42\u5904\u7406\u7684\u6570\u636e\u5355\u5143\u7684\u540d\u79f0\u3002<\/p>\n

5.\u5e94\u7528\u7a0b\u5e8f\u5c42\uff1a\u6d88\u606f\u8be5\u5c42\u5305\u62ec\u5404\u79cd\u7f51\u7edc\u5e94\u7528\u7a0b\u5e8f\u8fdb\u884c\u901a\u4fe1\u6240\u9700\u7684\u8fde\u63a5\u534f\u8bae\uff0c\u4f8b\u5982HTTP\uff0cDHCP\uff0cSSH\uff0cFTP\uff0cSMTP\uff0cIMAP\u7b49\u3002 \u5f53\u60a8\u4ece\u8fdc\u7a0b\u7f51\u7ad9\u8bf7\u6c42\u7f51\u9875\u65f6\uff0c\u8fde\u63a5\u8bf7\u6c42\u5c06\u53d1\u9001\u5230Web\u670d\u52a1\u5668\uff0c\u54cd\u5e94\u4f1a\u53d1\u9001\u56de\u8be5\u5c42\u7684\u4e3b\u673a\uff0c\u7136\u540e\u6d4f\u89c8\u5668\u5c06\u5728\u5176\u7a97\u53e3\u4e2d\u663e\u793a\u8be5\u7f51\u9875\u3002<\/p>\n

4.\u4f20\u8f93\u5c42\uff1aTCP\u6bb5\u3002 \u4f20\u8f93\u5c42\u63d0\u4f9b\u7aef\u5230\u7aef\u6570\u636e\u4f20\u8f93\u548c\u6d41\u7ba1\u7406\u670d\u52a1\uff0c\u8fd9\u4e9b\u670d\u52a1\u4e0e\u6570\u636e\u548c\u6240\u4f20\u8f93\u534f\u8bae\u7684\u7c7b\u578b\u65e0\u5173\u3002 \u5b83\u4f7f\u7528\u7aef\u53e380\uff08\u4f8b\u5982HTTP\uff09\u548c25\uff08SMTP\uff09\u5728\u53d1\u9001\u4e3b\u673a\u548c\u8fdc\u7a0b\u4e3b\u673a\u4e4b\u95f4\u5efa\u7acb\u8fde\u63a5\u3002<\/p>\n

3. Internet\u5c42\uff1a\u6570\u636e\u5305\u3002 \u6570\u636e\u5305\u8def\u7531\u5728Internet\u5c42\u4e0a\u6267\u884c\u3002 \u8be5\u5c42\u8d1f\u8d23\u5728\u4e24\u4e2a\u6216\u591a\u4e2a\u4e0d\u540c\u7684\u7f51\u7edc\u4e0a\u8def\u7531\u6570\u636e\u5305\uff0c\u4ee5\u5230\u8fbe\u5176\u6700\u7ec8\u76ee\u7684\u5730\u3002 \u8be5\u5c42\u4f7f\u7528IP\u5730\u5740\u548c\u8def\u7531\u8868\u6765\u786e\u5b9a\u5c06\u6570\u636e\u5305\u53d1\u9001\u5230\u4e0b\u4e00\u4e2a\u8bbe\u5907\u3002 \u5982\u679c\u53d1\u9001\u5230\u8def\u7531\u5668\uff0c\u5219\u6bcf\u4e2a\u8def\u7531\u5668\u4ec5\u8d1f\u8d23\u5c06\u6570\u636e\u5305\u53d1\u9001\u5230\u8be5\u7cfb\u5217\u4e2d\u7684\u4e0b\u4e00\u4e2a\u8def\u7531\u5668\uff0c\u800c\u4e0d\u8d1f\u8d23\u6620\u5c04\u4ece\u672c\u5730\u4e3b\u673a\u5230\u76ee\u6807\u4e3b\u673a\u7684\u6574\u4e2a\u8def\u7531\u3002 Internet\u5c42\u4e3b\u8981\u662f\u5173\u4e8e\u8def\u7531\u5668\u4e0e\u8def\u7531\u5668\u8fdb\u884c\u5bf9\u8bdd\uff0c\u4ee5\u786e\u5b9a\u94fe\u8def\u4e2d\u7684\u4e0b\u4e00\u4e2a\u8def\u7531\u5668\u3002<\/p>\n

2.\u6570\u636e\u94fe\u8def\u5c42\uff1a\u6846\u67b6\u3002 \u94fe\u8def\u5c42\u7ba1\u7406\u5355\u4e2a\u672c\u5730\u903b\u8f91\u903b\u8f91\u7f51\u7edc\u4e0a\u786c\u4ef6\u4e3b\u673a\u4e4b\u95f4\u7684\u76f4\u63a5\u8fde\u63a5\u3002 \u8be5\u5c42\u4f7f\u7528\u5d4c\u5165\u5728\u7f51\u7edc\u63a5\u53e3\u5361\uff08NIC\uff09\u4e2d\u7684\u5a92\u4f53\u8bbf\u95ee\u63a7\u5236\uff08M AC \uff09 \u5730\u5740\u6765\u8bc6\u522b\u8fde\u63a5\u5230\u672c\u5730\u7f51\u7edc\u7684\u7269\u7406\u8bbe\u5907\u3002 \u8be5\u5c42\u65e0\u6cd5\u8bbf\u95ee\u4e0d\u5728\u672c\u5730\u7f51\u7edc\u4e0a\u7684\u4e3b\u673a\u3002<\/p>\n

1.\u7269\u7406\u5c42\uff1a\u4f4d\u3002 \u8fd9\u662f\u786c\u4ef6\u5c42\uff0c\u7531NIC\u548c\u7269\u7406\u4ee5\u592a\u7f51\u7535\u7f06\u4ee5\u53ca\u7528\u4e8e\u5728\u6784\u6210\u4efb\u4f55\u4e24\u4e2a\u4e3b\u673a\u6216\u672c\u5730\u8fde\u63a5\u7684\u5176\u4ed6\u7f51\u7edc\u8282\u70b9\u4e4b\u95f4\u4f20\u8f93\u6784\u6210\u6570\u636e\u5e27\u7684\u5404\u4e2a\u4f4d\u7684\u786c\u4ef6\u7ea7\u522b\u534f\u8bae\u7ec4\u6210\u3002<\/p>\n

\u4e00\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50<\/strong><\/div>\n

\u90a3\u4e48\uff0c\u5f53\u4e3b\u673a\u5b9e\u9645\u4e0a\u4f7f\u7528TCP \/ IP\u7f51\u7edc\u6a21\u578b\u5728\u7f51\u7edc\u4e0a\u53d1\u9001\u6570\u636e\u65f6\uff0c\u4f1a\u662f\u4ec0\u4e48\u6837\uff1f \u8fd9\u662f\u6211\u5bf9\u6570\u636e\u5982\u4f55\u4ece\u4e00\u4e2a\u7f51\u7edc\u79fb\u52a8\u5230\u53e6\u4e00\u4e2a\u7f51\u7edc\u7684\u5b8c\u6574\u63cf\u8ff0\u3002 \u5728\u6b64\u793a\u4f8b\u4e2d\uff0c\u6211\u7684\u8ba1\u7b97\u673a\u6b63\u5728\u5411\u8fdc\u7a0b\u670d\u52a1\u5668\u53d1\u9001\u7f51\u9875\u8bf7\u6c42\u3002<\/p>\n

  • \u5728\u5e94\u7528\u7a0b\u5e8f\u5c42\u4e0a\uff0c\u6d4f\u89c8\u5668\u5411\u8fdc\u7a0b\u4e3b\u673awww.example.com\u53d1\u8d77HTTP\u8fde\u63a5\u8bf7\u6c42\u6d88\u606f\uff0c\u4ee5\u53d1\u9001\u56de\u5305\u542b\u7f51\u9875\u5185\u5bb9\u7684\u6570\u636e\u3002 \u8fd9\u662f\u6d88\u606f\uff0c\u5b83\u4ec5\u5305\u542b\u8fdc\u7a0bWeb\u670d\u52a1\u5668\u7684IP\u5730\u5740\u3002<\/li>\n
  • \u4f20\u8f93\u5c42\u5c06\u5305\u542b\u7f51\u9875\u8bf7\u6c42\u7684\u6d88\u606f\u5c01\u88c5\u5728\u4ee5\u8fdc\u7a0bWeb\u670d\u52a1\u5668\u7684IP\u5730\u5740\u4f5c\u4e3a\u76ee\u6807\u7684TCP\u6570\u636e\u62a5\u4e2d\u3002 \u73b0\u5728\uff0c\u8be5\u6570\u636e\u5305\u4e0e\u539f\u59cb\u8bf7\u6c42\u6570\u636e\u5305\u4e00\u8d77\u5305\u62ec\u53d1\u51fa\u8bf7\u6c42\u7684\u6e90\u7aef\u53e3\uff0c\u901a\u5e38\u662f\u4e00\u4e2a\u975e\u5e38\u5927\u7684\u968f\u673a\u7aef\u53e3\uff0c\u4ee5\u4fbf\u8fd4\u56de\u6570\u636e\u77e5\u9053\u6d4f\u89c8\u5668\u6b63\u5728\u4fa6\u542c\u54ea\u4e2a\u7aef\u53e3\u3002 \u4ee5\u53ca\u8fdc\u7a0b\u4e3b\u673a\u4e0a\u7684\u76ee\u6807\u7aef\u53e3\uff08\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\u4e3a\u7aef\u53e380\uff09\u3002<\/li>\n
  • Internet\u5c42\u5c06TCP\u6570\u636e\u62a5\u5c01\u88c5\u5728\u4e00\u4e2a\u5305\u4e2d\uff0c\u8be5\u5305\u8fd8\u5305\u542b\u6e90IP\u5730\u5740\u548c\u76ee\u6807IP\u5730\u5740\u3002<\/li>\n
  • \u6570\u636e\u94fe\u8def\u5c42\u4f7f\u7528\u5730\u5740\u89e3\u6790\u534f\u8bae\uff08ARP\uff09\u6765\u6807\u8bc6\u9ed8\u8ba4\u8def\u7531\u5668\u7684\u7269\u7406MAC\u5730\u5740\uff0c\u5e76\u5c06Internet\u6570\u636e\u5305\u5c01\u88c5\u5728\u5305\u542b\u6e90MAC\u5730\u5740\u548c\u76ee\u6807MAC\u5730\u5740\u7684\u5e27\u4e2d\u3002<\/li>\n
  • \u5e27\u901a\u8fc7\u7535\u7ebf\uff08\u901a\u5e38\u662fCAT5\u6216CAT6\uff09\u4ece\u672c\u5730\u4e3b\u673a\u4e0a\u7684NIC\u53d1\u9001\u5230\u9ed8\u8ba4\u8def\u7531\u5668\u4e0a\u7684NIC\u3002<\/li>\n
  • \u9ed8\u8ba4\u8def\u7531\u5668\u6253\u5f00\u6570\u636e\u62a5\u5e76\u786e\u5b9a\u76ee\u6807IP\u5730\u5740\u3002 \u8def\u7531\u5668\u4f7f\u7528\u81ea\u5df1\u7684\u8def\u7531\u8868\u6765\u6807\u8bc6\u5c06\u628a\u8be5\u5e27\u5e26\u5165\u4e0b\u4e00\u6b65\u7684\u4e0b\u4e00\u53f0\u8def\u7531\u5668\u7684IP\u5730\u5740\u3002 \u7136\u540e\uff0c\u8def\u7531\u5668\u5c06\u5e27\u91cd\u65b0\u5c01\u88c5\u5230\u4e00\u4e2a\u65b0\u7684\u6570\u636e\u62a5\u4e2d\uff0c\u8be5\u6570\u636e\u62a5\u5305\u542b\u5176\u81ea\u5df1\u7684MAC\u4f5c\u4e3a\u6e90\u4ee5\u53ca\u4e0b\u4e00\u4e2a\u8def\u7531\u5668\u7684MAC\u5730\u5740\uff0c\u7136\u540e\u901a\u8fc7\u9002\u5f53\u7684\u63a5\u53e3\u5c06\u5176\u53d1\u9001\u3002 \u8def\u7531\u5668\u5728\u7b2c3\u5c42\uff08Internet\u5c42\uff09\u6267\u884c\u5176\u8def\u7531\u4efb\u52a1\u3002<\/li>\n

    \u8bf7\u6ce8\u610f\uff0c\u5bf9\u4e8e\u7b2c\u4e8c\u5c42\u53ca\u7b2c\u4e8c\u5c42\u4ee5\u4e0a\u7684\u6240\u6709\u534f\u8bae\u800c\u8a00\uff0c\u5f00\u5173\u662f\u4e0d\u53ef\u89c1\u7684\uff0c\u56e0\u6b64\u5b83\u4eec\u4e0d\u4f1a\u4ee5\u4efb\u4f55\u903b\u8f91\u65b9\u5f0f\u5f71\u54cd\u6570\u636e\u7684\u4f20\u8f93\u3002 \u4ea4\u6362\u673a\u7684\u529f\u80fd\u4ec5\u4ec5\u662f\u63d0\u4f9b\u4e00\u79cd\u7b80\u5355\u7684\u65b9\u6cd5\uff0c\u5373\u901a\u8fc7\u4ee5\u592a\u7f51\u7535\u7f06\u7684\u957f\u5ea6\u5c06\u591a\u4e2a\u4e3b\u673a\u8fde\u63a5\u5230\u5355\u4e2a\u7269\u7406\u7f51\u7edc\u4e2d\u3002<\/p>\n

    \u60a8\u53ef\u4ee5\u4f7f\u7528arp [-n]\u547d\u4ee4\u67e5\u770b\u4e3b\u673a\u5df2\u5728\u5176arp\u8868\u4e2d\u5b58\u50a8\u7684\u6240\u6709MAC\u5730\u5740\u3002 \u8fd9\u4e9b\u59cb\u7ec8\u662f\u672c\u5730\u7f51\u7edc\u4e0a\u7684\u4e3b\u673a\u3002<\/p>\n

    \u8def\u7531\u8868<\/strong><\/div>\n

    \u6240\u6709\u7f51\u7edc\u8bbe\u5907\uff0c\u65e0\u8bba\u5b83\u4eec\u662f\u4e3b\u673a\uff0c\u8def\u7531\u5668\u8fd8\u662f\u5176\u4ed6\u7c7b\u578b\u7684\u7f51\u7edc\u8282\u70b9\uff0c\u4f8b\u5982\u7f51\u7edc\u8fde\u63a5\u7684\u6253\u5370\u673a\uff0c\u90fd\u9700\u8981\u51b3\u5b9a\u5c06TCP \/ IP\u6570\u636e\u5305\u8def\u7531\u5230\u4f55\u5904\u3002 \u8def\u7531\u8868\u63d0\u4f9b\u4e86\u505a\u51fa\u8fd9\u4e9b\u51b3\u5b9a\u6240\u9700\u7684\u914d\u7f6e\u4fe1\u606f\u3002\u4e0e\u56fe1\u4e2d\u975e\u5e38\u7b80\u5355\u7684\u8def\u7531\u8868\u7c7b\u4f3c\uff0c\u8be5\u8def\u7531\u8868\u7528\u4e8e\u5b9a\u4e49\u5178\u578b\u672c\u5730\u4e3b\u673a\u53ef\u7528\u7684\u5355\u4e2a\u8def\u7531\uff0c\u5e76\u786e\u5b9a\u662f\u5426\u5c06\u6570\u636e\u5305\u53d1\u9001\u5230\u9ed8\u8ba4\u7f51\u5173\u8def\u7531\u5668\u3002 \u3002 route -n\u547d\u4ee4\u5217\u51fa\u4e86\u8def\u7531\u8868\uff1b -n\u9009\u9879\u4ec5\u5c06\u7ed3\u679c\u663e\u793a\u4e3aIP\u5730\u5740\uff0c\u5e76\u4e14\u4e0d\u5c1d\u8bd5\u6267\u884cDNS\u67e5\u627e\uff0c\u8be5DNS\u67e5\u627e\u5c06\u4f7f\u7528\u4e3b\u673a\u540d\u66ff\u6362IP\u5730\u5740\uff08\u5982\u679c\u53ef\u7528\uff09\u3002 \u4f7f\u7528netstat - R N\u547d\u4ee4\u4ea7\u751f\u7684\u7ed3\u679c\u975e\u5e38\u76f8\u4f3c\u3002<\/p>\n

    \r\n[root@host1 ~]# route -n\r\nKernel IP routing table\r\nDestination     Gateway         Genmask         Flags Metric Ref    Use Iface\r\n0.0.0.0         192.168.0.254   0.0.0.0         UG    100    0        0 eno1\r\n192.168.0.0     0.0.0.0         255.255.255.0   U     100    0        0 eno1\r\n<\/pre>\n

    \u56fe1\uff1a\u4e00\u4e2a\u7b80\u5355\u7684\u8def\u7531\u8868\u3002<\/p>\n

    \u4f7f\u7528-n\u9009\u9879\u65f6\uff0c\u9ed8\u8ba4\u7f51\u5173\u59cb\u7ec8\u4e0e\u76ee\u68070.0.0.0\u4e00\u8d77\u663e\u793a\u3002 \u5982\u679c\u672a\u4f7f\u7528-n\uff0c\u5219\u5355\u8bcd\u201c Default\u201d\u51fa\u73b0\u5728\u8f93\u51fa\u7684Destination\u5217\u4e2d\u3002 \u7f51\u5173\u5217\u4e2d\u7684IP\u5730\u5740\u662f\u51fa\u7ad9\u7f51\u5173\u8def\u7531\u5668\u7684IP\u5730\u5740\u3002 \u9ed8\u8ba4\u7f51\u5173\u7684\u7f51\u7edc\u63a9\u7801\u4e3a0.0.0.0\u610f\u5473\u7740\uff0c\u65e0\u8bba\u7f51\u7edc\u7c7b\u522b\u5982\u4f55\uff0c\u8def\u7531\u8868\u4e2d\u672a\u901a\u8fc7\u9644\u52a0\u6761\u76ee\u5bfb\u5740\u5230\u672c\u5730\u7f51\u7edc\u6216\u53e6\u4e00\u4e2a\u51fa\u7ad9\u8def\u7531\u5668\u7684\u4efb\u4f55\u6570\u636e\u5305\u90fd\u5c06\u53d1\u9001\u5230\u9ed8\u8ba4\u7f51\u5173\u3002<\/p>\n

    \u56fe1\u4e2d\u7684Iface\uff08\u63a5\u53e3\uff09\u5217\u662f\u51fa\u7ad9NIC\u7684\u540d\u79f0\uff0c\u5728\u672c\u4f8b\u4e2d\u4e3aeno1\u3002 \u5bf9\u4e8e\u5145\u5f53\u8def\u7531\u5668\u7684\u4e3b\u673a\uff0c\u53ef\u80fd\u81f3\u5c11\u4f1a\u4f7f\u7528\u4e24\u4e2a\uff0c\u6709\u65f6\u8fd8\u4f1a\u4f7f\u7528\u66f4\u591a\u7684NIC\u3002 \u6bcf\u4e2a\u7528\u4f5c\u8def\u7531\u7684NIC\u5c06\u8fde\u63a5\u5230\u4e0d\u540c\u7684\u7269\u7406\u548c\u903b\u8f91\u7f51\u7edc\u3002 \u201c\u6807\u5fd7\u201d\u5217\u4e2d\u7684\u6807\u5fd7\u6307\u793a\u8be5\u8def\u7531\u4e3aUp\uff08U\uff09\uff0c\u8fd9\u662f\u9ed8\u8ba4\u7f51\u5173\uff08G\uff09\u3002 \u5176\u4ed6\u6807\u5fd7\u4e5f\u53ef\u80fd\u51fa\u73b0\u3002<\/p>\n

    \u5bf9\u4e8e\u5927\u591a\u6570\u4e3b\u673a\u800c\u8a00\uff0c\u8def\u7531\u51b3\u7b56\u975e\u5e38\u7b80\u5355\uff1a<\/p>\n

    \u5982\u679c\u76ee\u6807\u4e3b\u673a\u5728\u672c\u5730\u7f51\u7edc\u4e0a\uff0c\u5219\u5c06\u6570\u636e\u76f4\u63a5\u53d1\u9001\u5230\u76ee\u6807\u4e3b\u673a\u3002
    \n\u5982\u679c\u76ee\u6807\u4e3b\u673a\u4f4d\u4e8e\u901a\u8fc7\u8def\u7531\u8868\u4e2d\u5217\u51fa\u7684\u672c\u5730\u7f51\u5173\u53ef\u8bbf\u95ee\u7684\u8fdc\u7a0b\u7f51\u7edc\u4e0a\uff0c\u8bf7\u5c06\u5176\u53d1\u9001\u5230\u663e\u5f0f\u5b9a\u4e49\u7684\u7f51\u5173\u3002
    \n\u5982\u679c\u76ee\u6807\u4e3b\u673a\u4f4d\u4e8e\u8fdc\u7a0b\u7f51\u7edc\u4e0a\uff0c\u5e76\u4e14\u6ca1\u6709\u5176\u4ed6\u6761\u76ee\u5b9a\u4e49\u5230\u8be5\u4e3b\u673a\u7684\u8def\u7531\uff0c\u5219\u5c06\u6570\u636e\u53d1\u9001\u5230\u9ed8\u8ba4\u7f51\u5173\u3002
    \n\u8fd9\u4e9b\u89c4\u5219\u53ea\u662f\u610f\u5473\u7740\uff0c\u5982\u679c\u7531\u4e8e\u4e0d\u5339\u914d\u800c\u5bfc\u81f4\u6240\u6709\u5176\u4ed6\u64cd\u4f5c\u5931\u8d25\uff0c\u5219\u5c06\u6570\u636e\u5305\u53d1\u9001\u5230\u9ed8\u8ba4\u7f51\u5173\u3002<\/p>\n

    \u4e0b\u9762\u7684\u56fe2\u4e2d\u7684\u8def\u7531\u8868\u7a0d\u5fae\u590d\u6742\u4e00\u70b9\uff0c\u56e0\u4e3a\u5b83\u5c5e\u4e8eLinux\u4e3b\u673a\uff0c\u5145\u5f53\u8fde\u63a5\u5230\u4e09\u4e2a\u7f51\u7edc\u7684\u8def\u7531\u5668\uff0c\u5176\u4e2d\u4e00\u4e2a\u7f51\u7edc\u901a\u5411Internet\u3002 \u672c\u5730C\u7c7b\u7f51\u7edc\uff08\u63a5\u53e3eth1\u4e0a\u7684192.168.0.0\/24\u3001eth2\u4e0a\u7684192.168.25.0\/24\uff09\u5728\u8868\u4e2d\u90fd\u6709\u6761\u76ee\uff0c\u4ee5\u53ca\u5728eth0\u4e0a\u901a\u5f80\u4e16\u754c\u5176\u4ed6\u5730\u533a\u7684\u9ed8\u8ba4\u8def\u7531\u3002<\/p>\n

    \r\n[root@host2 ~]# route -n\r\nKernel IP routing table\r\nDestination     Gateway         Genmask         Flags Metric Ref    Use Iface\r\n192.168.1.24    0.0.0.0         255.255.255.252 U     0      0        0 eth0\r\n192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1\r\n192.168.25.0    0.0.0.0         255.255.255.0   U     0      0        0 eth2\r\n0.0.0.0         192.168.1.25    0.0.0.0         UG    0      0        0 eth0\r\n<\/pre>\n

    \u56fe2\uff1a\u5177\u6709\u591a\u4e2a\u7f51\u7edc\u7684\u66f4\u590d\u6742\u7684\u8def\u7531\u8868\u3002<\/p>\n

    \u8bf7\u6ce8\u610f\uff0c\u4ecd\u7136\u53ea\u6709\u4e00\u4e2a\u9ed8\u8ba4\u7f51\u5173\uff0c\u5b83\u4f4d\u4e8e\u63a5\u53e3eth0\u4e0a\u3002 \u4f46\u662f\uff0c\u9664\u4e86\u76f4\u63a5\u6307\u5411\u8def\u7531\u5668\u7684LAN\u7aefIP\u5730\u5740\u7684\u9ed8\u8ba4\u8def\u7531\u6761\u76ee\u5916\uff0c\u6574\u4e2a192.168.1.24\/30\u7f51\u7edc\u4e5f\u5b58\u5728\u4e00\u4e2a\u6761\u76ee\u3002 \u8be5\u7f51\u7edc\u4ec5\u5305\u542b\u4e24\u4e2a\u53ef\u7528\u7684IP\u5730\u5740\uff0c\u4e00\u4e2a\u7528\u4e8e\u8def\u7531\u5668LAN\u7aef\uff0c\u4e00\u4e2a192.168.1.25\/30\uff0c\u4e00\u4e2a\u7528\u4e8e\u4e3b\u673a\u672c\u8eab\uff0c\u4e00\u4e2a192.168.1.26\/30\u3002<\/p>\n

    \u8def\u7531\u914d\u7f6e<\/strong><\/div>\n

    \u90a3\u4e48\u5982\u4f55\u914d\u7f6e\u8def\u7531\u8868\uff1f \u5bf9\u4e8e\u4f7f\u7528DHCP\u8fde\u63a5\u5230\u7f51\u7edc\u7684\u4e3b\u673a\uff0cDHCP\u670d\u52a1\u5668\u63d0\u4f9b\u8be5\u9ed8\u8ba4\u8def\u7531\u7684\u914d\u7f6e\u4fe1\u606f\u4ee5\u53caDNS\uff0c\u4e3b\u673aIP\u5730\u5740\u4ee5\u53ca\u53ef\u80fd\u7684\u5176\u4ed6\u4fe1\u606f\uff08\u4f8b\u5982NTP\u670d\u52a1\u5668\u7684IP\u5730\u5740\uff09\u3002 \u5bf9\u4e8e\u9759\u6001\u914d\u7f6e\uff0c\u5b83\u901a\u5e38\u5f88\u7b80\u5355\uff0c\u4f46\u6709\u65f6\u53ef\u80fd\u4f1a\u6709\u4e9b\u590d\u6742\u3002<\/p>\n

    \u5728\u5927\u591a\u6570\u60c5\u51b5\u4e0b\uff0c\u5c06\u9ed8\u8ba4\u8def\u7531\u6dfb\u52a0\u5230\/ etc \/ sysconfig \/ network\u6587\u4ef6\u4f1a\u5bfc\u81f4\u7f51\u7edc\u5728\u8def\u7531\u8868\u4e2d\u914d\u7f6e\u9ed8\u8ba4\u200b\u200b\u8def\u7531\u3002 \u8be5\u6761\u76ee\u7c7b\u4f3c\u4e8e\u56fe3\u4e2d\u7684\u793a\u4f8b\u3002<\/p>\n

    GATEWAY=192.168.0.1\r\n<\/pre>\n

    \u56fe3\uff1a\u7f51\u7edc\u6587\u4ef6\u4e2d\u7684\u7f51\u5173\u6761\u76ee\u3002<\/p>\n

    \u4f7f\u7528\u7f51\u7edc\u6587\u4ef6\u53ea\u80fd\u914d\u7f6e\u9ed8\u8ba4\u7f51\u5173\u3002<\/p>\n

    \u5728\u9759\u6001\u914d\u7f6e\u7684\u73af\u5883\u4e2d\u914d\u7f6e\u9ed8\u8ba4\u200b\u200b\u7f51\u5173\u7684\u53e6\u4e00\u79cd\u65b9\u6cd5\u662f\u5c06\u5176\u6dfb\u52a0\u5230\/ etc \/ sysconfig \/ network-scripts\u76ee\u5f55\u4e2d\u7684\u76f8\u5e94\u63a5\u53e3\u914d\u7f6e\u6587\u4ef6\u4e2d\u3002 \u8981\u5c06\u7f51\u5173\u6dfb\u52a0\u5230\u63a5\u53e3eth0\u7684\u63a5\u53e3\u914d\u7f6e\u6587\u4ef6\u4e2d\uff0c\u8bf7\u5c06\u4e0e\u4e0a\u9762\u56fe3\u76f8\u540c\u7684\u884c\u6dfb\u52a0\u5230ifcfg-eth0\u6587\u4ef6\u4e2d\u3002 \u5982\u679c\u8fd9\u6837\u505a\uff0c\u5219\u5e94\u4ece\u7f51\u7edc\u6587\u4ef6\u4e2d\u5220\u9664\u8be5\u6761\u76ee\u3002<\/p>\n

    \u5728\u66f4\u590d\u6742\u7684\u73af\u5883\u4e2d\uff0c\u4f8b\u5982\u5f53\u4e3b\u673a\u4f7f\u7528\u591a\u4e2aNIC\u8fde\u63a5\u5230\u591a\u4e2a\u7f51\u7edc\u65f6\uff0c\u4ee5\u53ca\u81f3\u5c11\u9700\u8981\u5728\u8def\u7531\u8868\u4e2d\u8f93\u5165\u4e24\u6761\u6216\u66f4\u591a\u6761\u8def\u7531\u65f6\uff0c\u60a8\u5e94\u8be5\u8003\u8651\u5728\u5176\u4e2d\u4f7f\u7528\u8def\u7531\u6587\u4ef6\u3002 \/ etc \/ sysconfig \/ network-scripts\u3002 \u5bf9\u4e8eNIC enp7s1\uff0c\u8be5\u6587\u4ef6\u5c06\u662froute-enp7s1\uff0c\u5b83\u5c06\u5305\u542b\u56fe4\u6240\u793a\u7684\u6761\u76ee\u3002<\/p>\n

    default via 192.168.0.1 dev enp7s1\r\n<\/pre>\n

    \u56fe4\uff1aenp7s1\u7684\u9ed8\u8ba4\u8def\u7531\u6761\u76ee\u3002<\/p>\n

    \u8def\u7531\u63a5\u53e3\u6587\u4ef6\u4e2d\u7684\u9ed8\u8ba4\u7f51\u5173\u8bbe\u7f6e\u5c06\u8986\u76d6\u7f51\u7edc\u6587\u4ef6\u4e2d\u53ef\u80fd\u5217\u51fa\u7684\u6240\u6709\u7f51\u5173\u3002<\/p>\n

    \u5f53\u7136\uff0c\u60a8\u59cb\u7ec8\u53ef\u4ee5\u4f7f\u7528route\u547d\u4ee4\u4ece\u547d\u4ee4\u884c\u6dfb\u52a0\u8def\u7531\u3002 \u5982\u679c\u60a8\u9700\u8981\u5728\u6bcf\u6b21\u7cfb\u7edf\u5f15\u5bfc\u65f6\u90fd\u6267\u884c\u6b64\u64cd\u4f5c\uff0c\u5219\u53ef\u80fd\u4f1a\u82b1\u8d39\u4e00\u4e9b\u65f6\u95f4\uff0c\u56e0\u6b64\u60a8\u53ef\u80fd\u8981\u8003\u8651\u4f7f\u7528\u4e0a\u8ff0\u65b9\u6cd5\uff0c\u6216\u521b\u5efa\u5728\u542f\u52a8\u65f6\u8fd0\u884c\u7684\u811a\u672c\u3002 \u6211\u4e3a\u6211\u7684\u7cfb\u7edf\u4e4b\u4e00\u7f16\u5199\u4e86\u4e00\u4e2a\u811a\u672c\uff0c\u5176\u4e2d\u5305\u542b\u4ee5\u4e0b\u4e24\u884c\uff0c\u5982\u56fe5\u6240\u793a\u3002<\/p>\n

    route del default\r\nroute add default gw 192.168.0.1\r\n<\/pre>\n

    \u56fe5\uff1a\u4ece\u547d\u4ee4\u884c\u8bbe\u7f6e\u9ed8\u8ba4\u8def\u7531\u7684\u547d\u4ee4\u3002<\/p>\n

    \u8bf7\u6ce8\u610f\uff0c\u8bbe\u5907\u540d\u79f0\u5728\u6240\u6709\u8fd9\u4e9b\u547d\u4ee4\u4e2d\u90fd\u662f\u53ef\u9009\u7684\uff0c\u5728\u56fe5\u4e2d\u672a\u4f7f\u7528\u3002<\/p>\n

    \u7ed3\u8bba<\/strong><\/div>\n

    \u9664\u4e86\u8fd9\u4e9b\u975e\u5e38\u7b80\u5355\u7684\u793a\u4f8b\uff08\u975e\u5e38\u5e38\u89c1\uff09\u4e2d\u663e\u793a\u7684\u8def\u7531\u4e4b\u5916\uff0c\u8def\u7531\u8fd8\u6709\u5f88\u591a\u5176\u4ed6\u5185\u5bb9\u3002 \u8fd9\u91cc\u7684\u4fe1\u606f\u5e94\u8be5\u4f7f\u60a8\u5165\u95e8\u3002 \u5bf9\u4e8e\u66f4\u590d\u6742\u7684\u73af\u5883\uff0c\u60a8\u53ef\u80fd\u5e0c\u671b\u53c2\u8003Craig Hunt\u7684\u300a Inside TCP \/ IP\uff0c\u7b2c\u4e8c\u7248\u300b\u6216\u300a TCP \/ IP\u7f51\u7edc\u7ba1\u7406\u300b \u3002 \u60a8\u53ef\u80fd\u8fd8\u9700\u8981\u53c2\u8003\u53d1\u884c\u7248\u7684\u6587\u6863\u4ee5\u83b7\u53d6\u66f4\u591a\u4fe1\u606f\u3002 \u5bf9\u4e8e\u57fa\u4e8erpm\u7684\u53d1\u884c\u7248\uff08\u4f8b\u5982Fedora\u548cCentOS\uff09\uff0c\u4e00\u4e2a\u5f88\u597d\u7684\u53c2\u8003\u662f\u300a Red Hat Enterprise Linux 7\u90e8\u7f72\u6307\u5357\u300b \u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

    \u8fde\u63a5\u5230\u7f51\u7edc\u7684\u6bcf\u53f0\u8ba1\u7b97\u673a\u5728\u79bb\u5f00\u672c\u5730\u4e3b\u673a\u65f6\u90fd\u9700\u8981\u9488\u5bf9\u7f51\u7edcTCP \/ IP\u6570\u636e\u5305\u7684\u67d0\u79cd\u8def\u7531\u8bf4\u660e\u3002 \u8fd9\u901a\u5e38\u975e\u5e38\u7b80\u5355\uff0c\u56e0 […]<\/p>\n","protected":false},"author":310,"featured_media":211111,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-211095","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\/211095","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\/310"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=211095"}],"version-history":[{"count":15,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/211095\/revisions"}],"predecessor-version":[{"id":211260,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/211095\/revisions\/211260"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/211111"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=211095"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=211095"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=211095"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}