{"id":192165,"date":"2020-06-03T09:23:33","date_gmt":"2020-06-03T01:23:33","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=192165"},"modified":"2020-05-23T11:24:37","modified_gmt":"2020-05-23T03:24:37","slug":"ubuntu-server18-04-ip","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/ubuntu-server18-04-ip.html","title":{"rendered":"Ubuntu Server18.04 \u9759\u6001 IP \u914d\u7f6e\u6559\u7a0b"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u672c\u6587\u6559\u4f60\u5982\u4f55\u5728Ubuntu Server 18.04 \u4e2d\u914d\u7f6e\u9759\u6001IP\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\u5728Ubuntu18.04\u4e2d\uff0c\u4f20\u7edf\u7684\u914d\u7f6e\/etc\/network\/interfaces\u5df2\u65e0\u7528\uff0c\u65b0\u7684\u7f51\u7edc\u914d\u7f6e\u6587\u4ef6\u5728\uff1a\/etc\/netplan\/50-cloud-init.yaml<\/p>\n

\"\"
\n\"\"<\/p>\n

\u7528vim\u8fdb\u884c\u7f16\u8f91\u6587\u4ef6 \u6ce8\u610f\u683c\u5f0f \u5192\u53f7\u540e\u8fb9\u6709\u4e2a\u7a7a\u683c\uff1a<\/p>\n

network:\r\n    ethernets:\r\n        ens33:\r\n            dhcp4: false\r\n            addresses: [192.168.37.188\/24]\r\n            gateway4: 192.168.37.2\r\n            nameservers:\r\n                    addresses: [114.114.114.114,8.8.8.8]\r\n    version: 2<\/pre>\n
    \n
  • ens33\uff1a\u4f60\u5f53\u524d\u7684\u7f51\u5361\u540d\u79f0\uff1b<\/li>\n
  • dhcp4\uff1aipv4\u63a5\u53e3\u7684dhcp\u5f00\u5173\uff0cfalse\u4e3a\u5173\u95ed\uff0ctrue\u4e3a\u5f00\u542f<\/li>\n
  • addresses\uff1a\u9759\u6001IP\u5730\u5740\/\u63a9\u7801<\/li>\n
  • gateway4\uff1aipv4\u7f51\u5173<\/li>\n
  • nameservers\uff1aDNS\u670d\u52a1\u5668 \u9017\u53f7\u5206\u5272<\/li>\n<\/ul>\n

    \u7f16\u8f91\u597d \u6700\u540e\u4fdd\u5b58\u914d\u7f6e\u6587\u4ef6\uff0c\u6267\u884c\u547d\u4ee4\u91cd\u542f\u7f51\u7edc\u670d\u52a1\u751f\u6548\uff1a<\/p>\n

    sudo netplan apply<\/pre>\n

    \"\"<\/p>\n

    \u5982\u679cping\u5916\u7f51\u57df\u540d\u62a5\u9519\u4e3aTemporary failure in name resolution\u4e3a\u65e0\u6cd5\u89e3\u6790\uff0c\u7ecf\u6d4b\u8bd5ping\u4e5f\u4e0d\u901a\uff0c\u4f46\u662fDNS\u4ec0\u4e48\u7684\u8bbe\u7f6e\u6ca1\u6709\u95ee\u9898\u3002<\/p>\n

    \u89e3\u51b3\u65b9\u6cd5\uff1a\u7f16\u8f91\/etc\/resolv.conf \u6587\u4ef6\u00a0 \u52a0\u4e0a\u4e00\u4e2adns\u89e3\u6790reboot\u91cd\u542f\u5373\u53ef\u3002<\/p>\n

    \"\"<\/p>\n","protected":false},"excerpt":{"rendered":"

    \u5728Ubuntu18.04\u4e2d\uff0c\u4f20\u7edf\u7684\u914d\u7f6e\/etc\/network\/interfaces\u5df2\u65e0\u7528\uff0c\u65b0\u7684\u7f51\u7edc\u914d\u7f6e\u6587\u4ef6\u5728 […]<\/p>\n","protected":false},"author":63,"featured_media":192170,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-192165","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\/192165","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\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=192165"}],"version-history":[{"count":2,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/192165\/revisions"}],"predecessor-version":[{"id":192173,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/192165\/revisions\/192173"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/192170"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=192165"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=192165"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=192165"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}