{"id":21668,"date":"2020-12-11T05:13:42","date_gmt":"2020-12-10T21:13:42","guid":{"rendered":"http:\/\/www.idc.net\/help\/21668\/"},"modified":"2022-04-29T14:34:18","modified_gmt":"2022-04-29T06:34:18","slug":"ubuntu-server-18-04%e4%b8%ad%e9%85%8d%e7%bd%ae%e9%9d%99%e6%80%81ip%e5%85%b7%e4%bd%93%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/21668\/","title":{"rendered":"Ubuntu Server 18.04\u4e2d\u914d\u7f6e\u9759\u6001IP\u5177\u4f53\u65b9\u6cd5"},"content":{"rendered":"<div class=\"idc_table\">\n<p style=\"padding-top: 8px;padding-bottom: 8px;margin: 5px 0px;line-height: 1.75;letter-spacing: 0.1em;font-size: 16px;text-align: justify\">Ubuntu Server 18.04\u4e2d\u5982\u4f55\u914d\u7f6e\u9759\u6001IP\uff1f\u672c\u7bc7\u6587\u7ae0\u91cd\u70b92\u4e3a\u5927\u5bb6\u8bb2\u89e3\u4e00\u4e0bUbuntu Server 18.04\u4e2d\u914d\u7f6e\u9759\u6001IP\u5177\u4f53\u65b9\u6cd5\u3002<\/p>\n<p><img decoding=\"async\" class=\"aligncenter\" style=\"max-width: 100%;border-radius: 5px 5px 5px 5px;margin: 0px 10px auto;width: 100%;height: 100%\" src=\"https:\/\/lxlinux.superbed.verylink.top\/item\/6146bccc2ab3f51d9154e012.jpg\">  <\/p>\n<p style=\"padding-top: 8px;padding-bottom: 8px;margin: 5px 0px;line-height: 1.75;letter-spacing: 0.1em;font-size: 16px;text-align: justify\">\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<p style=\"padding-top: 8px;padding-bottom: 8px;margin: 5px 0px;line-height: 1.75;letter-spacing: 0.1em;font-size: 16px;text-align: justify\"><img decoding=\"async\" style=\"max-width: 100%;border-radius: 5px 5px 5px 5px;margin: 0px 10px auto;width: 100%;height: 100%\" src=\"https:\/\/lxlinux.superbed.verylink.top\/item\/61681d6d2ab3f51d91714c9b.png\" class=\"aligncenter\"><img decoding=\"async\" style=\"max-width: 100%;border-radius: 5px 5px 5px 5px;margin: 0px 10px auto;width: 100%;height: 100%\" src=\"https:\/\/lxlinux.superbed.verylink.top\/item\/61681d6d2ab3f51d91714ce9.png\" class=\"aligncenter\"><\/p>\n<p style=\"padding-top: 8px;padding-bottom: 8px;margin: 5px 0px;line-height: 1.75;letter-spacing: 0.1em;font-size: 16px;text-align: justify\">\u7528vim\u8fdb\u884c\u7f16\u8f91\u6587\u4ef6 \u6ce8\u610f\u683c\u5f0f \u5192\u53f7\u540e\u8fb9\u6709\u4e2a\u7a7a\u683c\uff1a<\/p>\n<pre><code>network:\r\n&nbsp;&nbsp;&nbsp;ethernets:\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ens33:\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dhcp4:&nbsp;<span style=\"color: #569cd6;line-height: 26px\">false<\/span>\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;addresses:&nbsp;[192.168.37.188\/24]\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gateway4:&nbsp;192.168.37.2\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nameservers:\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;addresses:&nbsp;[114.114.114.114,8.8.8.8]\r\n&nbsp;&nbsp;&nbsp;version:&nbsp;2\r\n<\/code><\/pre>\n<ul>\n<li>\n<section>\n    ens33\uff1a\u4f60\u5f53\u524d\u7684\u7f51\u5361\u540d\u79f0\uff1b<br \/>\n  <\/section>\n<\/li>\n<li>\n<section>\n    dhcp4\uff1aipv4\u63a5\u53e3\u7684dhcp\u5f00\u5173\uff0cfalse\u4e3a\u5173\u95ed\uff0ctrue\u4e3a\u5f00\u542f<br \/>\n  <\/section>\n<\/li>\n<li>\n<section>\n    addresses\uff1a\u9759\u6001IP\u5730\u5740\/\u63a9\u7801<br \/>\n  <\/section>\n<\/li>\n<li>\n<section>\n    gateway4\uff1aipv4\u7f51\u5173<br \/>\n  <\/section>\n<\/li>\n<li>\n<section>\n    nameservers\uff1aDNS\u670d\u52a1\u5668 \u9017\u53f7\u5206\u5272<br \/>\n  <\/section>\n<\/li>\n<\/ul>\n<p style=\"padding-top: 8px;padding-bottom: 8px;margin: 5px 0px;line-height: 1.75;letter-spacing: 0.1em;font-size: 16px;text-align: justify\">\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<pre><code>sudo&nbsp;netplan&nbsp;apply\r\n<\/code><\/pre>\n<p><img decoding=\"async\" style=\"max-width: 100%;border-radius: 5px 5px 5px 5px;margin: 0px 10px auto;width: 100%;height: 100%\" src=\"https:\/\/lxlinux.superbed.verylink.top\/item\/61681d6d2ab3f51d91714d3d.png\" class=\"aligncenter\">  Ubuntu Server18.04 \u9759\u6001 IP \u914d\u7f6e\u6559\u7a0bUbuntu Server18.04 \u9759\u6001 IP \u914d\u7f6e\u6559\u7a0b   <\/p>\n<p style=\"padding-top: 8px;padding-bottom: 8px;margin: 5px 0px;line-height: 1.75;letter-spacing: 0.1em;font-size: 16px;text-align: justify\">\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<p style=\"padding-top: 8px;padding-bottom: 8px;margin: 5px 0px;line-height: 1.75;letter-spacing: 0.1em;font-size: 16px;text-align: justify\">\u89e3\u51b3\u65b9\u6cd5\uff1a\u7f16\u8f91\/etc\/resolv.conf \u6587\u4ef6 \u52a0\u4e0a\u4e00\u4e2adns\u89e3\u6790reboot\u91cd\u542f\u5373\u53ef\u3002<\/p>\n<p><img decoding=\"async\" style=\"max-width: 100%;border-radius: 5px 5px 5px 5px;margin: 0px 10px auto;width: 100%;height: 100%\" src=\"https:\/\/lxlinux.superbed.verylink.top\/item\/61681d6d2ab3f51d91714d76.png\" class=\"aligncenter\">  Ubuntu Server18.04 \u9759\u6001 IP \u914d\u7f6e\u6559\u7a0bUbuntu Server18.04 \u9759\u6001 IP \u914d\u7f6e\u6559\u7a0b   <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ubuntu Server 18.04\u4e2d\u5982\u4f55\u914d\u7f6e\u9759\u6001IP\uff1f\u672c\u7bc7\u6587\u7ae0\u91cd\u70b92\u4e3a\u5927\u5bb6\u8bb2\u89e3\u4e00\u4e0bUbuntu Serve [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":21669,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34,28],"tags":[],"class_list":["post-21668","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-ubuntu"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/21668","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=21668"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/21668\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media\/21669"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=21668"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=21668"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=21668"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}