{"id":63634,"date":"2025-04-29T14:05:37","date_gmt":"2025-04-29T06:05:37","guid":{"rendered":"https:\/\/fwq.ai\/blog\/63634\/"},"modified":"2025-04-29T14:05:37","modified_gmt":"2025-04-29T06:05:37","slug":"linux%e6%80%8e%e4%b9%88%e8%ae%be%e7%bd%aeip%e5%9c%b0%e5%9d%80-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/63634\/","title":{"rendered":"linux\u600e\u4e48\u8bbe\u7f6eip\u5730\u5740"},"content":{"rendered":"<blockquote><p>\n  \u5982\u4f55\u5728 linux \u4e2d\u8bbe\u7f6e ip \u5730\u5740\uff1f\u5728 linux \u4e2d\u8bbe\u7f6e ip \u5730\u5740\u7684\u6700\u5e38\u89c1\u65b9\u6cd5\u662f\u4f7f\u7528\u547d\u4ee4\u884c\u754c\u9762\uff0c\u5177\u4f53\u6b65\u9aa4\u5305\u62ec\uff1a1. \u786e\u5b9a\u7f51\u7edc\u63a5\u53e3\uff1b2. \u5206\u914d ip \u5730\u5740\uff1b3. \u8bbe\u7f6e\u7f51\u5173\uff08\u5982\u679c\u9700\u8981\uff09\uff1b4. \u8bbe\u7f6e dns \u670d\u52a1\u5668\uff1b5. \u6fc0\u6d3b\u914d\u7f6e\uff1b6. \u9a8c\u8bc1\u914d\u7f6e\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202406\/03\/2024060313002697215.jpg\" class=\"aligncenter\" title=\"linux\u600e\u4e48\u8bbe\u7f6eip\u5730\u5740\u63d2\u56fe\" alt=\"linux\u600e\u4e48\u8bbe\u7f6eip\u5730\u5740\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5728 Linux \u4e2d\u8bbe\u7f6e IP \u5730\u5740<\/strong><\/p>\n<p><strong>\u76f4\u63a5\u56de\u7b54\uff1a<\/strong><\/p>\n<p>\u5728 Linux \u4e2d\u8bbe\u7f6e IP \u5730\u5740\u7684\u6700\u5e38\u89c1\u65b9\u6cd5\u662f\u4f7f\u7528\u547d\u4ee4\u884c\u754c\u9762\u3002<\/p>\n<p><strong>\u8be6\u7ec6\u6b65\u9aa4\uff1a<\/strong><\/p>\n<p><strong>1. \u786e\u5b9a\u7f51\u7edc\u63a5\u53e3\uff1a<\/strong><\/p>\n<p>\u4f7f\u7528 ip addr \u547d\u4ee4\u5217\u51fa\u53ef\u7528\u7f51\u7edc\u63a5\u53e3\u3002\u786e\u5b9a\u8981\u914d\u7f6e\u7684\u63a5\u53e3\u540d\u79f0\uff0c\u4f8b\u5982 eth0\u3002<\/p>\n<p><strong>2. \u5206\u914d IP \u5730\u5740\uff1a<\/strong><\/p>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5206\u914d IP \u5730\u5740\uff1a<\/p>\n<pre>ifconfig &lt;interface&gt; &lt;IP address&gt;\/&lt;netmask&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4f8b\u5982\uff0c\u4e3a eth0 \u63a5\u53e3\u5206\u914d IP \u5730\u5740 192.168.1.200 \u548c\u63a9\u7801 255.255.255.0\uff1a<\/p>\n<pre>ifconfig eth0 192.168.1.200\/255.255.255.0<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>3. \u8bbe\u7f6e\u7f51\u5173\uff1a<\/strong><\/p>\n<p>\u5982\u679c\u7f51\u7edc\u9700\u8981\u9ed8\u8ba4\u7f51\u5173\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8bbe\u7f6e\uff1a<\/p>\n<pre>route add default gw &lt;gateway IP&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4f8b\u5982\uff0c\u8bbe\u7f6e\u7f51\u5173 IP \u4e3a 192.168.1.1\uff1a<\/p>\n<pre>route add default gw 192.168.1.1<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>4. \u8bbe\u7f6e DNS \u670d\u52a1\u5668\uff1a<\/strong><\/p>\n<p>\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8bbe\u7f6e DNS \u670d\u52a1\u5668\uff1a<\/p>\n<pre>nmcli connection modify &lt;connection name&gt; ipv4.dns &lt;DNS server IP&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4f8b\u5982\uff0c\u4e3a eth0 \u63a5\u53e3\u8bbe\u7f6e DNS \u670d\u52a1\u5668 IP \u4e3a 8.8.8.8\uff1a<\/p>\n<pre>nmcli connection modify eth0 ipv4.dns 8.8.8.8<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>5. \u6fc0\u6d3b\u914d\u7f6e\uff1a<\/strong><\/p>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6fc0\u6d3b\u65b0\u914d\u7f6e\uff1a<\/p>\n<pre>ifconfig &lt;interface&gt; up<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4f8b\u5982\uff0c\u6fc0\u6d3b eth0 \u63a5\u53e3\uff1a<\/p>\n<pre>ifconfig eth0 up<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u9a8c\u8bc1\u914d\u7f6e\uff1a<\/strong><\/p>\n<p>\u53ef\u4ee5\u4f7f\u7528 ifconfig \u547d\u4ee4\u9a8c\u8bc1 IP \u5730\u5740\u3001\u7f51\u5173\u548c DNS \u670d\u52a1\u5668\u914d\u7f6e\u662f\u5426\u6b63\u786e\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u8bbe\u7f6eip\u5730\u5740\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8FDCServers\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u5728 linux \u4e2d\u8bbe\u7f6e ip \u5730\u5740\uff1f\u5728 linux \u4e2d\u8bbe\u7f6e ip \u5730\u5740\u7684\u6700\u5e38\u89c1\u65b9\u6cd5\u662f\u4f7f\u7528\u547d\u4ee4\u884c\u754c\u9762\uff0c\u5177\u4f53\u6b65\u9aa4\u5305\u62ec\uff1a1. \u786e\u5b9a\u7f51\u7edc\u63a5\u53e3\uff1b2. \u5206\u914d ip \u5730\u5740\uff1b3. \u8bbe\u7f6e\u7f51\u5173\uff08\u5982\u679c\u9700\u8981\uff09\uff1b4. \u8bbe\u7f6e dns \u670d\u52a1\u5668\uff1b5. \u6fc0\u6d3b\u914d\u7f6e\uff1b6. \u9a8c\u8bc1\u914d\u7f6e\u3002 \u5982\u4f55\u5728 Linux \u4e2d\u8bbe\u7f6e IP \u5730\u5740 \u76f4\u63a5\u56de\u7b54\uff1a \u5728 Linux \u4e2d\u8bbe\u7f6e IP \u5730\u5740\u7684\u6700\u5e38\u89c1\u65b9\u6cd5\u662f\u4f7f\u7528\u547d\u4ee4\u884c\u754c\u9762\u3002 \u8be6\u7ec6\u6b65\u9aa4\uff1a 1. \u786e\u5b9a\u7f51\u7edc\u63a5\u53e3\uff1a \u4f7f\u7528 ip addr \u547d\u4ee4\u5217\u51fa\u53ef\u7528\u7f51\u7edc\u63a5\u53e3\u3002\u786e\u5b9a\u8981\u914d\u7f6e\u7684\u63a5\u53e3\u540d\u79f0\uff0c\u4f8b\u5982 eth0\u3002 2. \u5206\u914d IP \u5730\u5740\uff1a \u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5206\u914d IP \u5730\u5740\uff1a ifconfig &lt;interface&gt; &lt;IP address&gt;\/&lt;netmask&gt; \u767b\u5f55\u540e\u590d\u5236 \u4f8b\u5982\uff0c\u4e3a eth0 \u63a5\u53e3\u5206\u914d IP \u5730\u5740 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-63634","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63634","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=63634"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/63634\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=63634"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=63634"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=63634"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}