{"id":290584,"date":"2024-03-29T21:45:40","date_gmt":"2024-03-29T13:45:40","guid":{"rendered":"https:\/\/lrxjmw.cn\/lsjkstswspbg.html"},"modified":"2024-03-29T21:45:40","modified_gmt":"2024-03-29T13:45:40","slug":"lsjkstswspbg","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/lsjkstswspbg.html","title":{"rendered":"Linux\u795e\u6280\uff01\u5feb\u901f\u63d0\u5347\u7f51\u901f\u3001\u5c4f\u853d\u5e7f\u544a\uff0c\u4e00\u62db\u641e\u5b9ahosts\u6587\u4ef6\u4fee\u6539"},"content":{"rendered":"

\u4ec0\u4e48\u662fhosts\u6587\u4ef6<\/b><\/p>\n

hosts\u6587\u4ef6\u91c7\u7528\u7eaf\u6587\u672c\u683c\u5f0f\uff0c\u7528\u4e8e\u786e\u4fdd\u5728\u590d\u6742\u4e92\u8054\u7f51\u73af\u5883\u4e0b\u6b63\u786e\u5730\u5c06\u4e3b\u673a\u540d\u79f0\u53caIP\u5730\u5740\u5173\u8054\u5339\u914d\u3002\u901a\u8fc7\u624b\u52a8\u8c03\u6574\u8fd9\u4e2a\u6587\u4ef6\u4e2d\u57df\u540d\u4e0eIP\u5730\u5740\u7684\u5bf9\u5e94\u5173\u7cfb\uff0c\u53ef\u4ee5\u5b9e\u73b0\u7cbe\u51c6\u7684\u57df\u540d\u81ea\u89e3\u6790\u529f\u80fd\u3002\u5728\u4e3b\u6d41\u7684Linux<\/a>\u7cfb\u7edf<\/a>\u4e2d\uff0c\u8fd9\u7c7b\u6587\u4ef6\u901a\u5e38\u4f1a\u88ab\u4fdd\u5b58\u81f3\"\/etc\/hostias\"\u8fd9\u4e2a\u8def\u5f84\u4f4d\u7f6e\u3002<\/p>\n

\u4e3a\u4ec0\u4e48\u9700\u8981\u4fee\u6539hosts\u6587\u4ef6<\/b><\/p>\n

\u901a\u8fc7\u5c06\u57df\u540d\u76f4\u63a5\u672c\u5730\u6620\u5c04\u81f3IP\u5730\u5740\uff0c\u53ef\u663e\u8457\u63d0\u5347\u7f51\u9875\u8bbf\u95ee\u901f\u5ea6\uff0c\u65e0\u9700\u7ecf\u5386DNS\u89e3\u6790\u8fc7\u7a0b\u7684\u989d\u5916\u5ef6\u8fdf\u3002<\/p>\n

\u901a\u8fc7\u5728\u4e3b\u673a\u6587\u4ef6\u4e2d\u5f55\u5165\u5e7f\u544a\u670d\u52a1\u5668IP\u5730\u5740\uff0c\u53ef\u6709\u6548\u5c4f\u853d\u7279\u5b9a\u7f51\u9875\u5e7f\u544a\u3002<\/p>\n

\u4fee\u6539\u6587\u4ef6\u7c7b\u578b_\u4fee\u6539\u6587\u4ef6\u540d\u7684\u5feb\u6377\u952e_linux hosts\u6587\u4ef6\u4fee\u6539<\/p>\n

\u8c03\u8282\u7f51\u7edc\u72b6\u51b5\uff1a\u901a\u8fc7\u4fee\u6539Hosts\u6587\u4ef6\uff0c\u786e\u4fdd\u9879\u76ee\u7814\u53d1\u8fdb\u7a0b\u4e2d\u53ef\u4fbf\u5229\u5730\u6a21\u62df\u5404\u7c7b\u7f51\u7edc\u73af\u5883\uff0c\u5e76\u8fdb\u884c\u8c03\u8bd5\u548c\u6d4b\u5b9a\u3002<\/p>\n

\u5982\u4f55\u4fee\u6539hosts\u6587\u4ef6<\/b><\/p>\n

\u542f\u52a8\u7ec8\u7aef\uff1a\u8fc5\u901f\u6309\"Ctrl+Alt+T\"\uff0c\u542f\u52a8\u4e07\u80fd\u7684Linux\u7ec8\u7aef\u673a\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n

\u4e3a\u4e86\u83b7\u5f97root\u6743\u9650\uff1a\u53ea\u9700\u5728\u547d\u4ee4<\/a>\u884c\u8f93\u5165\"sudo su\"\uff0c\u6309\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u540e\u5373\u53ef\u83b7\u5f97\u4fee\u6539hosts\u6587\u4ef6\u6240\u9700\u7684\u8d85\u7ea7\u7528\u6237\u6743\u9650\u3002<\/p>\n

\u4fee\u6539\u6587\u4ef6\u540d\u7684\u5feb\u6377\u952e_\u4fee\u6539\u6587\u4ef6\u7c7b\u578b_linux hosts\u6587\u4ef6\u4fee\u6539<\/p>\n

\u66f4\u6539\u4e3b\u673a\u6587\u4ef6\uff1a\u9009\u7528\u57fa\u4e8e\u547d\u4ee4\u7684\u7eaf\u6587\u672c\u7f16\u8f91\u6cd5\uff08\u5982vim\u6216nano\uff09\u5e76\u6267\u884c\"vi \/etc\/hosts\"\u3002\u8fdb\u5165\u7f16\u8f91\u72b6\u6001\u540elinux\u66f4\u6539ip\u5730\u5740\uff0c\u901a\u8fc7\u6309\u4e0b\"i\"\u952e\u53ef\u5bf9\u5185\u5bb9\u8fdb\u884c\u4fee\u6539\u3002<\/p>\n

\u521b\u5efaDNS\u8bb0\u5f55\uff1a\u9996\u5148\u9700\u8981\u521b\u5efa\u6240\u9700\u7684DNS\u8bb0\u5f55\uff1b<\/p>\n

\u586b\u5145\u76f8\u5e94\u4fe1\u606f\uff1a\u63a5\u4e0b\u6765\uff0c\u6839\u636e\u7f51\u7ad9\/\u5e94\u7528\u663e\u793a\u7684IP\u5730\u5740\u4ee5\u53ca\u57df\u540d\u8fdb\u884c\u8be6\u7ec6\u586b\u5199\uff0c\u4f8b\u5982\uff0c\"127.0.0.1 \"\u3002<\/p>\n

\u786e\u7acb\u6620\u5c04:\u6267\u884c\u5b8c\u4e0a\u8ff0\u6b65\u9aa4linux vi\uff0c\u6587\u4ef6\u672b\u5c3e\u5e94\u660e\u786e\u6807\u6ce8\u6620\u5c04\u5173\u7cfb\u3002<\/p>\n

\u575a\u5b88\u9000\u683c\u4e0e\u7ed3\u675f\u64cd\u4f5c\uff1a\u6309\u4e0b\u201cESC\u201d\u5feb\u6377\u952e\u544a\u522b\u7f16\u8f91\u529f\u80fd\uff0c\u7136\u540e\u7c98\u8d34\u5165\":wq\"\u547d\u4ee4\u5b8c\u6210VI\u5185\u7684\u6570\u636e\u50a8\u5b58\uff0c\u6700\u7ec8\u987a\u5229\u8131\u79bb\u7f16\u8f91\u73af\u5883\u3002<\/p>\n

\u5e38\u89c1\u95ee\u9898\u53ca\u89e3\u51b3\u65b9\u6cd5<\/b><\/p>\n

\u987b\u77e5,\u82e5\u5728\u64cd\u4f5c\u8fc7\u7a0b\u4e2d\uff0c\u60a8\u65e0\u6cd5\u66f4\u6539hosts\u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528sudo\u547d\u4ee4\u4e34\u65f6\u83b7\u53d6\u81f3root\u6743\u9650\u8fdb\u884c\u64cd\u4f5c\u3002<\/p>\n

\u683c\u5f0f\u8981\u6c42\u5982\u4e0b\uff1a\u6bcf\u4e2a\u6620\u5c04\u5fc5\u987b\u72ec\u7acb\u5360\u636e\u4e00\u884c\uff0c\u4f9d\u6b21\u6392\u5217IP\u5730\u5740\u4e0e\u6240\u5c5e\u903b\u8f91\u57df\u540d\uff0c\u5176\u95f4\u4ee5\u4e00\u4e2a\u7a7a\u683c\u5206\u9694\u3002<\/p>\n

\u52a1\u5fc5\u6ce8\u610f\u7b2c\u4e09\u70b9\uff1a\u4fee\u6b63\u5b8c\u6bd5\u540elinux hosts\u6587\u4ef6\u4fee\u6539<\/strong>\uff0c\u8bf7\u6e05\u9664DNS\u7f13\u5b58\u5e76\u91cd\u65b0\u542f\u52a8\u7f51\u7edc\u670d\u52a1\uff0c\u4ee5\u4fbf\u786e\u4fdd\u914d\u7f6e\u53d8\u66f4\u53ca\u65f6\u751f\u6548\u3002<\/p>\n

\u6ce8\u610f\u4e8b\u9879<\/b><\/p>\n

\u5907\u4efd\u6e90\u6587\u4ef6\uff1a\u9644\u4ee5\u4fdd\u969c\u7cfb\u7edf\u7a33\u5b9a\uff0c\u5efa\u8bae\u4e8b\u5148\u5907\u4efdHosts\u539f\u6587\u6863linux hosts\u6587\u4ef6\u4fee\u6539<\/strong>\uff0c\u9884\u9632\u6f5c\u5728\u672a\u77e5\u98ce\u9669\u3002<\/p>\n

\u4e25\u7981\u4e3a\u54fa\u4e73\u52a8\u7269\u7cfb\u7edf\u73af\u5883\u6210\u5458\u7ad9\u70b9\u64c5\u81ea\u9644\u52a0\u6587\u6863\uff0c\u4ee5\u9632\u6b62\u5f71\u54cd\u7f51\u7edc\u8fde\u63a5\u7a33\u5b9a\u6027\u6216\u5bfc\u81f4\u6f5c\u5728\u5b89\u5168\u9690\u60a3\u3002<\/p>\n

\u5468\u671f\u6027\u5ba1\u67e5\u4e0e\u4fee\u8ba2\uff1a\u5b9e\u65bd\u4e3b\u673a\u5217\u8868\u7684\u53cd\u590d\u68c0\u67e5\u4ee5\u53ca\u76f8\u5e94\u7684\u53d8\u66f4\u5904\u7406\uff0c\u4ee5\u786e\u4fdd\u6620\u5c04\u6570\u636e\u51c6\u786e\u65e0\u8bef\u5e76\u9002\u5e94\u73b0\u6709\u7f51\u7edc\u73af\u5883\u3002<\/p>\n

\u603b\u7ed3<\/b><\/p>\n

\u672c\u6587\u8be6\u7ec6\u4ecb\u7ecd\u4e86Linux\u73af\u5883\u4e2d\u7684hosts\u6587\u4ef6\u539f\u7406\u53ca\u5176\u8c03\u6574\u548c\u89e3\u51b3\u5e38\u89c1\u95ee\u9898\u7684\u65b9\u6cd5\u3002\u5728\u6b63\u786e\u4f7f\u7528\u4e0b\uff0c\u9002\u5f53\u66f4\u65b0host\u6587\u4ef6\uff0c\u6709\u52a9\u4e8e\u63d0\u9ad8\u7f51\u7edc\u8bbf\u95ee\u901f\u7387\u53ca\u5b89\u5168\u6027\uff0c\u8fdb\u4e00\u6b65\u4fc3\u8fdb\u7f51\u7edc\u8c03\u8bd5\u53ca\u6d4b\u8bd5\u5de5\u4f5c\u7684\u987a\u5229\u8fdb\u884c\u3002\u56e0\u6b64\uff0c\u7cbe\u901ahosts\u6587\u4ef6\u8c03\u6574\u6280\u5de7\u5bf9Linux\u7528\u6237\u6709\u7740\u4e3e\u8db3\u8f7b\u91cd\u7684\u610f\u4e49\u3002<\/p>\n

\u672c\u6587\u5b97\u65e8\u5728\u4e8e\u6df1\u5316\u8bfb\u8005\u5bf9hosts\u6587\u4ef6\u7684\u8ba4\u8bc6\u53ca\u5e94\u7528\u5b9e\u8df5\u80fd\u529b\uff0c\u4f7f\u5176\u80fd\u5728\u65e5\u5e38\u7f51\u7edc\u914d\u7f6e\u548c\u7ba1\u7406\u8fc7\u7a0b\u4e2d\u6e38\u5203\u6709\u4f59\u5730\u5e94\u5bf9\u6311\u6218\u3002<\/p>\n

\u5bf9\u4e8eLinux\u7cfb\u7edf\u4e3b\u673a\u6587\u4ef6\u7684\u8c03\u6574\u64cd\u4f5c\uff0c\u60a8\u6216\u8bb8\u8fd8\u6709\u5176\u4ed6\u7591\u60d1\u6216\u5c1a\u672a\u5f97\u5230\u89e3\u7b54\u7684\u95ee\u9898\u5417?\u6211\u4eec\u671f\u5f85\u60a8\u968f\u65f6\u63d0\u4f9b\u6709\u76ca\u5efa\u8bae\u5e76\u4e0e\u6211\u4eec\u5171\u540c\u63a2\u8ba8\u76f8\u5173\u7ec6\u8282\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u901a\u8fc7\u5728\u4e3b\u673a\u6587\u4ef6\u4e2d\u5f55\u5165\u5e7f\u544a\u670d\u52a1\u5668IP\u5730\u5740\uff0c\u53ef\u6709\u6548\u5c4f\u853d\u7279\u5b9a\u7f51\u9875\u5e7f\u544a\u3002su\uff0c\u6309\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u540e\u5373\u53ef\u83b7\u5f97\u4fee\u6539hosts\u6587\u4ef6\u6240\u9700\u7684\u8d85\u7ea7\u7528\u6237\u6743\u9650\u3002\u987b\u77e5,\u82e5\u5728\u64cd\u4f5c\u8fc7\u7a0b\u4e2d\uff0c\u60a8\u65e0\u6cd5\u66f4\u6539hosts\u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528sudo\u547d\u4ee4\u4e34\u65f6\u83b7\u53d6\u81f3root\u6743\u9650\u8fdb\u884c\u64cd\u4f5c\u3002<\/p>\n","protected":false},"author":1,"featured_media":290585,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[999],"class_list":["post-290584","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-999"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/290584","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\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=290584"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/290584\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/290585"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=290584"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=290584"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=290584"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}