
{"id":186,"date":"2008-05-09T21:18:00","date_gmt":"2008-05-09T21:18:00","guid":{"rendered":"http:\/\/www.sincebirth.cn\/?p=186"},"modified":"2008-05-09T21:18:00","modified_gmt":"2008-05-09T21:18:00","slug":"%e5%85%b3%e4%ba%8eubuntu%e7%9a%84ip%e8%ae%be%e7%bd%ae","status":"publish","type":"post","link":"https:\/\/niuduer.sincebirth.space\/?p=186","title":{"rendered":"\u5173\u4e8eUbuntu\u7684ip\u8bbe\u7f6e"},"content":{"rendered":"<div id=\"blog_text\" class=\"cnt\">\n<p>\u5728\u5355\u4f4d\u7684\u4e00\u53f0\u673a\u5668\u5b8c\u5168\u88c5\u4e86Ubuntu Server\uff0c\u4f46\u56de\u5bb6\u53ea\u80fd\u5728XP\u4e0aVM\u4e00\u4e2a\uff0c\u88c5\u7684\u65f6\u5019\u7f51\u5361\u662fDHCP\u7684\uff0c\u7528ifconfig\u67e5\u4e86\u4e00\u4e0bip\u662f192.168.92.128,\u53ef\u4ee5ping\u901a\u3002<\/p>\n<p>\u8f6c\u8f7d\u4e0d\u662f\u9519\uff1a<\/p>\n<p><u><font color=\"#0000ff\">Ubuntu\u547d\u4ee4\u884c\u4fee\u6539\u7f51\u7edc\u914d\u7f6e\u65b9\u6cd5<\/font><\/u><\/p>\n<p>\/etc\/network\/interfaces<br \/>\n\u6253\u5f00\u540e\u91cc\u9762\u53ef\u8bbe\u7f6eDHCP\u6216\u624b\u52a8\u8bbe\u7f6e\u9759\u6001ip\u3002\u524d\u9762auto eth0\uff0c\u8ba9\u7f51\u5361\u5f00\u673a\u81ea\u52a8\u6302\u8f7d.<\/p>\n<p><strong>1. <\/strong><strong>\u4ee5DHCP\u65b9\u5f0f<\/strong><strong>\u914d\u7f6e<\/strong><strong>\u7f51\u5361<\/strong><\/p>\n<p>\u7f16\u8f91\u6587\u4ef6\/etc\/network\/interfaces:<br \/>\n<code><font face=\"\u65b0\u5b8b\u4f53\">sudo vi \/etc\/network\/interfaces<\/font><\/code><\/p>\n<p>\u5e76\u7528\u4e0b\u9762\u7684\u884c\u6765\u66ff\u6362\u6709\u5173eth0\u7684\u884c:<br \/>\n<code><font face=\"\u65b0\u5b8b\u4f53\"># The primary network interface - use DHCP to find our address<br \/>\nauto eth0<br \/>\niface eth0 inet dhcp<\/font><\/code><\/p>\n<p>\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u4f7f\u7f51\u7edc\u8bbe\u7f6e\u751f\u6548:<br \/>\n<font face=\"\u65b0\u5b8b\u4f53\"><code>sudo \/etc\/init.d\/networking restart<\/code><br \/>\n<\/font>\u4e5f\u53ef\u4ee5\u5728\u547d\u4ee4\u884c\u4e0b\u76f4\u63a5\u8f93\u5165\u4e0b\u9762\u7684\u547d\u4ee4\u6765\u83b7\u53d6\u5730\u5740<\/p>\n<p><font face=\"\u65b0\u5b8b\u4f53\"><code>sudo dhclient eth0<\/code><br \/>\n<\/font><strong><br \/>\n2. \u4e3a\u7f51\u5361\u914d\u7f6e\u9759\u6001IP\u5730\u5740<\/strong><\/p>\n<p>\u7f16\u8f91\u6587\u4ef6\/etc\/network\/interfaces:<\/p>\n<p><code><font face=\"\u65b0\u5b8b\u4f53\">sudo vi \/etc\/network\/interfaces<\/font><\/code><\/p>\n<p>\u5e76\u7528\u4e0b\u9762\u7684\u884c\u6765\u66ff\u6362\u6709\u5173eth0\u7684\u884c:# The primary network interface<br \/>\n<code><font face=\"\u65b0\u5b8b\u4f53\">auto eth0<br \/>\niface eth0 inet static<br \/>\naddress 192.168.3.90<br \/>\ngateway 192.168.3.1<br \/>\nnetmask 255.255.255.0<br \/>\n#network 192.168.3.0<br \/>\n#broadcast 192.168.3.255<\/font><\/code><\/p>\n<p>\u5c06\u4e0a\u9762\u7684ip\u5730\u5740\u7b49\u4fe1\u606f\u6362\u6210\u4f60\u81ea\u5df1\u5c31\u53ef\u4ee5\u4e86.\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u4f7f\u7f51\u7edc\u8bbe\u7f6e\u751f\u6548:<br \/>\n<code><font face=\"\u65b0\u5b8b\u4f53\">sudo \/etc\/init.d\/networking restart<\/font><\/code><\/p>\n<p><strong>3. \u8bbe\u5b9a\u7b2c\u4e8c\u4e2aIP\u5730\u5740(\u865a\u62dfIP\u5730\u5740)<\/strong><\/p>\n<p>\u7f16\u8f91\u6587\u4ef6\/etc\/network\/interfaces:<\/p>\n<p><code><font face=\"\u65b0\u5b8b\u4f53\">sudo vi \/etc\/network\/interfaces<\/font><\/code><\/p>\n<p>\u5728\u8be5\u6587\u4ef6\u4e2d\u6dfb\u52a0\u5982\u4e0b\u7684\u884c:<br \/>\n<code><font face=\"\u65b0\u5b8b\u4f53\">auto eth0:1<br \/>\niface eth0:1 inet static<br \/>\naddress 192.168.1.60<br \/>\nnetmask 255.255.255.0<br \/>\nnetwork x.x.x.x<br \/>\nbroadcast x.x.x.x<br \/>\ngateway x.x.x.x<\/font><\/code><\/p>\n<p>\u6839\u636e\u4f60\u7684\u60c5\u51b5\u586b\u4e0a\u6240\u6709\u8bf8\u5982address,netmask,network,broadcast\u548cgateways\u7b49\u4fe1\u606f.<br \/>\n\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u4f7f\u7f51\u7edc\u8bbe\u7f6e\u751f\u6548:<br \/>\n<code><font face=\"\u65b0\u5b8b\u4f53\">sudo \/etc\/init.d\/networking restart<\/font><\/code><\/p>\n<p><strong>4. \u8bbe\u7f6e\u4e3b\u673a\u540d\u79f0(hostname)<\/strong><\/p>\n<p>\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u6765\u67e5\u770b\u5f53\u524d\u4e3b\u673a\u7684\u4e3b\u673a\u540d\u79f0:<\/p>\n<p><code><font face=\"\u65b0\u5b8b\u4f53\">sudo \/bin\/hostname<\/font><\/code><\/p>\n<p>\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u6765\u8bbe\u7f6e\u5f53\u524d\u4e3b\u673a\u7684\u4e3b\u673a\u540d\u79f0:<br \/>\n<code><br \/>\n<font face=\"\u65b0\u5b8b\u4f53\">sudo \/bin\/hostname newname<\/font><\/code><\/p>\n<p>\u7cfb\u7edf\u542f\u52a8\u65f6,\u5b83\u4f1a\u4ece\/etc\/hostname\u6765\u8bfb\u53d6\u4e3b\u673a\u7684\u540d\u79f0.<\/p>\n<p>\u5173\u4e8e\u8bbe\u7f6e\u4e3b\u673a\u540d\u79f0\u7684\u66f4\u591a\u4fe1\u606f,\u8bf7\u8bbf\u95ee<a href=\"http:\/\/www.debianadmin.com\/change-hostname-or-server-name-of-a-linux-machine.html\" target=\"_blank\">\u8fd9\u91cc<\/a><\/p>\n<p><strong>5. \u914d\u7f6eDNS<\/strong><\/p>\n<p>\u9996\u5148,\u4f60\u53ef\u4ee5\u5728\/etc\/hosts\u4e2d\u52a0\u5165\u4e00\u4e9b\u4e3b\u673a\u540d\u79f0\u548c\u8fd9\u4e9b\u4e3b\u673a\u540d\u79f0\u5bf9\u5e94\u7684IP\u5730\u5740,\u8fd9\u662f\u7b80\u5355\u4f7f\u7528\u672c\u673a\u7684\u9759\u6001\u67e5\u8be2.<\/p>\n<p>\u8981\u8bbf\u95eeDNS \u670d\u52a1\u5668\u6765\u8fdb\u884c\u67e5\u8be2,\u9700\u8981\u8bbe\u7f6e\/etc\/resolv.conf\u6587\u4ef6.<br \/>\n\u5047\u8bbeDNS\u670d\u52a1\u5668\u7684IP\u5730\u5740\u662f192.168.3.2, \u90a3\u4e48\/etc\/resolv.conf\u6587\u4ef6\u7684\u5185\u5bb9\u5e94\u4e3a:<\/p>\n<p><code><font face=\"\u65b0\u5b8b\u4f53\">search test.com<br \/>\nnameserver 192.168.3.2<\/font><\/code><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u5355\u4f4d\u7684\u4e00\u53f0\u673a\u5668\u5b8c\u5168\u88c5\u4e86Ubuntu Server\uff0c\u4f46\u56de\u5bb6\u53ea\u80fd\u5728XP\u4e0aVM\u4e00\u4e2a\uff0c\u88c5\u7684\u65f6\u5019\u7f51\u5361\u662fDHCP\u7684\uff0c\u7528i [&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":[],"class_list":["post-186","post","type-post","status-publish","format-standard","hentry","category-all"],"views":1028,"_links":{"self":[{"href":"https:\/\/niuduer.sincebirth.space\/index.php?rest_route=\/wp\/v2\/posts\/186","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/niuduer.sincebirth.space\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/niuduer.sincebirth.space\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/niuduer.sincebirth.space\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/niuduer.sincebirth.space\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=186"}],"version-history":[{"count":0,"href":"https:\/\/niuduer.sincebirth.space\/index.php?rest_route=\/wp\/v2\/posts\/186\/revisions"}],"wp:attachment":[{"href":"https:\/\/niuduer.sincebirth.space\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=186"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/niuduer.sincebirth.space\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=186"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/niuduer.sincebirth.space\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=186"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}