{"id":490,"date":"2015-01-21T08:33:35","date_gmt":"2015-01-21T00:33:35","guid":{"rendered":"http:\/\/www.datarelab.com\/blog\/?p=490"},"modified":"2015-01-21T08:33:35","modified_gmt":"2015-01-21T00:33:35","slug":"centos%e8%99%9a%e6%8b%9f%e6%9c%banat%e6%96%b9%e5%bc%8f%e6%97%a0%e6%b3%95%e4%b8%8a%e7%bd%91%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.datarelab.com\/blog\/Technical_literature\/490.html","title":{"rendered":"CentOS\u865a\u62df\u673aNAT\u65b9\u5f0f\u65e0\u6cd5\u4e0a\u7f51\u89e3\u51b3\u65b9\u6cd5"},"content":{"rendered":"<p>\u5728\u4f7f\u7528CentOS\u865a\u62df\u673a\u65f6\uff0c\u51fa\u73b0\u4e86\u65e0\u6cd5\u4e0a\u7f51\u7684\u60c5\u51b5\uff0c\u4f7f\u7528\u4e3b\u673aping\u865a\u673a\u5730\u5740\u53ef\u4ee5ping\u901a\uff0c\u800c\u865a\u673aping\u4e0d\u901a\u4e3b\u673a\uff0c\u540c\u65f6\u865a\u673a\u4e5f\u65e0\u6cd5ping\u901a\u5176\u4ed6\u7684\u7f51\u5740\u6216ip\uff0c\u663e\u793a\u5185\u5bb9\u4e3aNetwork is unreachable\uff0c\u540e\u6765\u7ecf\u8fc7\u5728\u7f51\u4e0a\u67e5\u627e\u89e3\u51b3\u65b9\u6cd5\uff0c\u89e3\u51b3\u95ee\u9898\uff0c\u8bb0\u5f55\u5982\u4e0b\uff1a<\/p>\n<p>\u9996\u5148\u6253\u5f00\u670d\u52a1\uff0c\u5728services.msc\u4e2d\u5c06VMware\u7684DHCP\u548cNAT\u670d\u52a1\u5f00\u542f\u3002\u5e76\u4fee\u6539\u865a\u673a\u7684\u63a5\u5165\u65b9\u5f0f\uff0c\u53ef\u4ee5\u5728\u201c\u7f16\u8f91\u865a\u62df\u7f51\u7edc\u201d\u4e2d\u67e5\u770b\uff0c\u5982\u4e0b\u56fe<\/p>\n<p><a href=\"https:\/\/www.datarelab.com\/blog\/wp-content\/uploads\/2015\/01\/1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-491\" src=\"https:\/\/www.datarelab.com\/blog\/wp-content\/uploads\/2015\/01\/1.jpg\" alt=\"1\" width=\"690\" height=\"254\" srcset=\"https:\/\/www.datarelab.com\/blog\/wp-content\/uploads\/2015\/01\/1.jpg 690w, https:\/\/www.datarelab.com\/blog\/wp-content\/uploads\/2015\/01\/1-300x110.jpg 300w, https:\/\/www.datarelab.com\/blog\/wp-content\/uploads\/2015\/01\/1-624x230.jpg 624w\" sizes=\"auto, (max-width: 690px) 100vw, 690px\" \/><\/a><br \/>\n\u6253\u5f00\u540e\u5982\u4e0b<br \/>\nVMnet0\u662f\u6865\u63a5\u65b9\u5f0f\uff0cVMnet1\u662fHost-only\u65b9\u5f0f\uff0cVMnet8\u662fNAT\u65b9\u5f0f\uff0c\u5b50\u7f51IP\u53ef\u4ee5\u81ea\u5df1\u8bbe\u7f6e\uff0c\u89c11\uff0c\u4fee\u6539\u540e\uff0c\u9700\u8981\u628a2,3\u4e2d\u7684\u5730\u5740\u6bb5\u540c\u65f6\u5bf9\u5e94\u4fee\u6539\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-492\" src=\"https:\/\/www.datarelab.com\/blog\/wp-content\/uploads\/2015\/01\/2.png\" alt=\"2\" width=\"604\" height=\"537\" srcset=\"https:\/\/www.datarelab.com\/blog\/wp-content\/uploads\/2015\/01\/2.png 604w, https:\/\/www.datarelab.com\/blog\/wp-content\/uploads\/2015\/01\/2-300x267.png 300w\" sizes=\"auto, (max-width: 604px) 100vw, 604px\" \/><\/p>\n<p>\u8fd9\u65f6\u5019\u6700\u597d\u628a\u9664\u4e86NAT\u5916\u5176\u5b83\u4e24\u4e2a\u8fde\u63a5\u65b9\u5f0f\u505c\u6389\uff0c\u5c061\u4e0a\u9762\uff0cconnect\u7684\u52fe\u53bb\u6389\u5c31\u53ef\u4ee5\u4e86<\/p>\n<p>\u4e4b\u540e\u9700\u8981\u5728\u865a\u673a\u8bbe\u7f6e\u4e2d\u9009\u62e9NAT\u8fde\u63a5\u65b9\u5f0f\uff0c\uff0c\u5982\u679c\u6ca1\u6709\u7f51\u7edc\u8fde\u63a5\u65b9\u5f0f\u9700\u8981\u81ea\u5df1\u6dfb\u52a0\u4e00\u4e0b\u3002\u4ee5\u4e0a\u8fd9\u4e9b\u8bbe\u7f6e\u65b9\u6cd5\u7f51\u4e0a\u6709\u5f88\u591a\uff0c\u4e0d\u518d\u8d58\u8ff0\u3002<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-493\" src=\"https:\/\/www.datarelab.com\/blog\/wp-content\/uploads\/2015\/01\/3.jpg\" alt=\"3\" width=\"690\" height=\"571\" srcset=\"https:\/\/www.datarelab.com\/blog\/wp-content\/uploads\/2015\/01\/3.jpg 690w, https:\/\/www.datarelab.com\/blog\/wp-content\/uploads\/2015\/01\/3-300x248.jpg 300w, https:\/\/www.datarelab.com\/blog\/wp-content\/uploads\/2015\/01\/3-624x516.jpg 624w\" sizes=\"auto, (max-width: 690px) 100vw, 690px\" \/><br \/>\n\u4e4b\u540e\u4ecd\u65e7\u65e0\u6cd5\u8054\u7f51\u7684\uff0c\u9700\u8981\u6253\u5f00\u865a\u673a\u770b\u770b\u865a\u673a\u7684\u7f51\u7edc\u8bbe\u7f6e\u4e86\u3002\u547d\u4ee4\u5982\u4e0b<br \/>\n#vi \/etc\/sysconfig\/network-scripts\/ifcfg-eth0<br \/>\n\u5176\u4e2d\u90e8\u5206\u5185\u5bb9\u5982\u4e0b\uff1a<br \/>\nDEVICE=eth0 #\u8bbe\u5907\u540d\u79f0<br \/>\nBOOTPROTO=dhcp #\u8fde\u63a5\u65b9\u5f0f\uff0cdhcp\u4f1a\u81ea\u52a8\u5206\u914d\u5730\u5740\uff0c\u6b64\u65f6\u4e0d\u9700\u8981\u5728\u4e0b\u9762\u8bbe\u7f6eip\u548c\u7f51\u5173<br \/>\nHWADDR=00:0C:29:AD:66:9F #\u786c\u4ef6\u5730\u5740\uff0c\u4e0d\u8981\u4fee\u6539<br \/>\nONBOOT=yes #yes\u8868\u793a\u542f\u52a8\u5c31\u6267\u884c\u8be5\u914d\u7f6e\uff0c\u9700\u8981\u6539\u4e3ayes<br \/>\n\u7f51\u4e0a\u4f1a\u6709\u4e9b\u65b9\u6cd5\u9700\u8981\u5728\u8fd9\u91cc\u6dfb\u52a0ip\u5730\u5740\uff0c\u5b50\u7f51\u63a9\u7801\uff0cdns\u4e4b\u7c7b\u7684\uff0c\u4e4b\u524d\u5b89\u88c5\u8fd9\u4e9b\u65b9\u6cd5\u8bd5\u9a8c\u8fc7\uff0c\u90fd\u4e0d\u884c\uff0c\u800c\u4e14\u6dfb\u52a0\u7684\u8fd9\u4e9b\u5185\u5bb9\u540e\u6765\u8fd8\u5f71\u54cd\u5230\u4e86\u4e0a\u7f51\uff0c\u6240\u4ee5\uff0c\u4e0d\u5efa\u8bae\u91c7\u7528\u90a3\u4e9b\u65b9\u5f0f\u6dfb\u52a0\u8fd9\u4e9b\u5185\u5bb9\u3002<\/p>\n<p>\u4fee\u6539\u5b8c\u540e\u9700\u8981\u91cd\u542f\u7f51\u7edc\u8bbe\u7f6e\uff0c\u53ef\u4ee5<br \/>\n# service network restart<br \/>\n\u6216\u8005<br \/>\n# \/etc\/init.d\/network restart<br \/>\n\u6b64\u65f6\u5982\u679c\u8fd8\u662f\u65e0\u6cd5\u8fde\u63a5\u7f51\u7edc\uff0c\u518d\u56de\u5230\u7269\u7406\u4e3b\u673a\uff0c\u67e5\u770b\u7f51\u7edc\u8fde\u63a5\u4e2d\u7684\u672c\u5730\u8fde\u63a5\u7684\u5171\u4eab\u662f\u5426\u6253\u5f00\uff0c\u5728\u72b6\u6001-&gt;\u5c5e\u6027-&gt;\u5171\u4eab\u4e2d\u67e5\u770b\uff0c\u5982\u679c\u6ca1\u6709\u5171\u4eab\u9009\u9879\u5361\uff0c\u5c31\u627e\u767e\u5ea6\u3002\u5982\u679c\u5171\u4eab\u5df2\u7ecf\u6253\u5f00\uff0c\u5c06Host-Only Network\u548cVMnet8\u4e2d\u7684ipv4\u548cipv6\u670d\u52a1\u505c\u6389\uff0c\u524d\u9762\u7684\u52fe\u53bb\u6389<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-494\" src=\"https:\/\/www.datarelab.com\/blog\/wp-content\/uploads\/2015\/01\/4.png\" alt=\"4\" width=\"377\" height=\"442\" srcset=\"https:\/\/www.datarelab.com\/blog\/wp-content\/uploads\/2015\/01\/4.png 377w, https:\/\/www.datarelab.com\/blog\/wp-content\/uploads\/2015\/01\/4-256x300.png 256w\" sizes=\"auto, (max-width: 377px) 100vw, 377px\" \/><\/p>\n<p>\u81f3\u6b64\uff0c\u6211\u7684\u865a\u673a\u7f51\u7edc\u8fde\u63a5\u6b63\u5e38\u4e86<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u4f7f\u7528CentOS\u865a\u62df\u673a\u65f6\uff0c\u51fa\u73b0\u4e86\u65e0\u6cd5\u4e0a\u7f51\u7684\u60c5\u51b5\uff0c\u4f7f\u7528\u4e3b\u673aping\u865a\u673a\u5730\u5740\u53ef\u4ee5ping\u901a\uff0c\u800c\u865a\u673aping\u4e0d\u901a\u4e3b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[14,89],"class_list":["post-490","post","type-post","status-publish","format-standard","hentry","category-Technical_literature","tag-linux","tag-vmware"],"views":1396,"_links":{"self":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/posts\/490","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/comments?post=490"}],"version-history":[{"count":0,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/posts\/490\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/media?parent=490"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/categories?post=490"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/tags?post=490"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}