{"id":6318,"date":"2022-01-12T11:58:28","date_gmt":"2022-01-12T03:58:28","guid":{"rendered":"https:\/\/blog.ywdevops.cn\/?p=6318"},"modified":"2024-06-19T17:26:35","modified_gmt":"2024-06-19T09:26:35","slug":"ubuntu-3","status":"publish","type":"post","link":"https:\/\/blog.ywdevops.cn\/index.php\/2022\/01\/12\/ubuntu-3\/","title":{"rendered":"ubuntu\u5982\u4f55\u8bbe\u7f6e\u9759\u6001IP"},"content":{"rendered":"\n<p class=\"has-text-align-center wp-block-paragraph\" style=\"font-size:clamp(16.293px, 1.018rem + ((1vw - 3.2px) * 0.68), 25px);\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">ubuntu\u7248\u672c\u4e3a18.04<\/mark><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001\u9996\u5148\u67e5\u627e\/etc\/netplan\u4e0b\u7684\u9ed8\u8ba4\u7f51\u5361\u914d\u7f6e\u6587\u4ef6\uff0c\u540d\u79f0\u4e3a\uff1a01-network-manager-all.yaml\uff0c\u5982\u679c\u6ca1\u6709\u53ef\u4ee5\u65b0\u5efa(\u8fd9\u4e2a\u540d\u5b57\u662f\u53ef\u4ee5\u81ea\u5b9a\u4e49\u7684\uff0c\u4e0d\u4e00\u5b9a\u975e\u8981\u662f01-network&#8230;&#8230;)\uff0c\u7f16\u8f91\u5185\u5bb9\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"704\" height=\"258\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/16-1.png\" alt=\"\" class=\"wp-image-6319\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/16-1.png 704w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/16-1-300x110.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/01\/16-1-600x220.png 600w\" sizes=\"auto, (max-width: 704px) 100vw, 704px\" \/><\/figure>\n\n\n\n<p class=\"has-luminous-vivid-amber-background-color has-background wp-block-paragraph\">\u6ce8\u610f\uff1a\u4eceethernets\u5f00\u59cb\u5230\u6700\u540e\u4e3a\u65b0\u589e\u52a0\u5185\u5bb9\uff0c\u5176\u4f59\u4e3a\u81ea\u5e26\u5185\u5bb9<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Let NetworkManager manage all devices on this system\nnetwork:\n  version: 2\n  renderer: NetworkManager\n  ethernets:\n     ens33: #\u914d\u7f6e\u7684\u7f51\u5361\u540d\u79f0,\u4f7f\u7528ifconfig -a\u67e5\u770b\u5f97\u5230\n       dhcp4: no #dhcp4\u5173\u95ed\n       addresses: &#91;192.168.42.129\/24] #\u8bbe\u7f6e\u672c\u673aIP\u53ca\u63a9\u7801\n       gateway4: 192.168.42.2 #\u8bbe\u7f6e\u7f51\u5173\n       nameservers:\n         addresses: &#91;8.8.8.8] #\u8bbe\u7f6eDNS\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u914d\u7f6e\u5b8c\u6210\u540e\uff0c\u6267\u884c\u547d\u4ee4\u8ba9\u4fee\u6539\u7f51\u5361\u751f\u6548\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>netplan apply                       #\u5e94\u7528netplan\u914d\u7f6e\nsystemctl restart systemd-networkd  #\u91cd\u542f\u7f51\u7edc\u670d\u52a1(\u53ef\u9009)<\/code><\/pre>\n\n\n\n<p class=\"has-text-align-center wp-block-paragraph\" style=\"font-size:clamp(16.293px, 1.018rem + ((1vw - 3.2px) * 0.68), 25px);\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">ubuntu\u7248\u672c\u4e3a24.04<\/mark><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1\u3001\u67e5\u627e\/etc\/netplan\u4e0b\u7684\u9ed8\u8ba4\u7f51\u5361\u914d\u7f6e\u6587\u4ef6\uff0c\u540d\u79f0\u4e3a\uff1a01-network-manager-all.yaml\uff0c\u5982\u679c\u6ca1\u6709\u53ef\u4ee5\u65b0\u5efa(\u6743\u9650\u8981\u662f600\u624d\u53ef\u4ee5)\uff0c\u7f16\u8f91\u5185\u5bb9\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"695\" height=\"473\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2024\/06\/1.jpg\" alt=\"\" class=\"wp-image-17164\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2024\/06\/1.jpg 695w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2024\/06\/1-300x204.jpg 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2024\/06\/1-600x408.jpg 600w\" sizes=\"auto, (max-width: 695px) 100vw, 695px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u8bbe\u7f6e\u5b8c\u6210\u540e\uff0c\u6267\u884c\u5982\u4e0b\u547d\u4ee4\u5373\u53ef\uff0c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>netplan apply                       #\u5e94\u7528netplan\u914d\u7f6e\nsystemctl restart systemd-networkd  #\u91cd\u542f\u7f51\u7edc\u670d\u52a1(\u53ef\u9009)<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"691\" height=\"160\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2024\/06\/2-1.jpg\" alt=\"\" class=\"wp-image-17165\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2024\/06\/2-1.jpg 691w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2024\/06\/2-1-300x69.jpg 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2024\/06\/2-1-600x139.jpg 600w\" sizes=\"auto, (max-width: 691px) 100vw, 691px\" \/><\/figure>\n\n\n\n<p class=\"has-luminous-vivid-amber-background-color has-background wp-block-paragraph\">\u6ce8\u610f:  01-network-manager-all.yaml\u6587\u4ef6\u6743\u9650\u8981\u662f600\u624d\u53ef\u4ee5\uff0c\u5426\u5219\u4f1a\u62a5\u9519<\/p>\n","protected":false},"excerpt":{"rendered":"<p>ubuntu\u7248\u672c\u4e3a18.04 1\u3001\u9996\u5148\u67e5\u627e\/etc\/netplan\u4e0b\u7684\u9ed8\u8ba4\u7f51\u5361\u914d\u7f6e\u6587\u4ef6\uff0c\u540d\u79f0\u4e3a\uff1a01-netw [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":6321,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34],"tags":[],"class_list":["post-6318","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":8}},"_links":{"self":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/6318","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/comments?post=6318"}],"version-history":[{"count":22,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/6318\/revisions"}],"predecessor-version":[{"id":17177,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/6318\/revisions\/17177"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media\/6321"}],"wp:attachment":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media?parent=6318"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/categories?post=6318"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/tags?post=6318"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}