{"id":18581,"date":"2014-11-05T06:17:30","date_gmt":"2014-11-04T22:17:30","guid":{"rendered":"https:\/\/2blog.ilc.edu.tw\/25793\/2014\/11\/05\/archlinux-%e7%b6%b2%e8%b7%af%e8%a8%ad%e5%ae%9a\/"},"modified":"2014-11-05T06:17:30","modified_gmt":"2014-11-04T22:17:30","slug":"archlinux-%e7%b6%b2%e8%b7%af%e8%a8%ad%e5%ae%9a","status":"publish","type":"post","link":"https:\/\/2blog.ilc.edu.tw\/25793\/2014\/11\/05\/archlinux-%e7%b6%b2%e8%b7%af%e8%a8%ad%e5%ae%9a\/","title":{"rendered":"ArchLinux &#8211; \u7db2\u8def\u8a2d\u5b9a"},"content":{"rendered":"<p>\u539f\u672c\u7684 ArchLinux \u662f\u4f7f\u7528 DHCP \u81ea\u52d5\u53d6\u5f97 IP \u9023\u7dda\uff0c\u4f46\u8981\u7576\u6210\u53ef\u4ee5\u6b63\u5f0f\u9023\u7dda\u7684 Server\uff0c\u5c31\u8981\u6539\u6210\u4f7f\u7528\u56fa\u5b9a IP\u3002<br \/>\u539f\u672c\u7684\u8a2d\u5b9a(dhcp)<br \/># <span style=\"color: #ff0000;\">vim \/etc\/netctl\/eth0<\/span><br \/><span style=\"color: #0000ff;\">Description=&#8217;A basic dhcp ethernet connection&#8217;<\/span><br \/><span style=\"color: #0000ff;\">Interface=eth0<\/span><br \/><span style=\"color: #0000ff;\">Connection=ethernet<\/span><br \/><span style=\"color: #0000ff;\">IP=dhcp<\/span><br \/><span style=\"color: #0000ff;\">ExecUpPost=&#8217;\/usr\/bin\/ntpd -gq || true&#8217;<\/span><\/p>\n<p><span style=\"color: #0000ff;\">## for DHCPv6<\/span><br \/><span style=\"color: #0000ff;\">#IP6=dhcp<\/span><br \/><span style=\"color: #0000ff;\">## for IPv6 autoconfiguration<\/span><br \/><span style=\"color: #0000ff;\">#IP6=stateless<\/span>[@more@]\u6539\u6210\u56fa\u5b9a IP<br \/># <span style=\"color: #ff0000;\">vim \/etc\/netctl\/eth0<\/span><br \/><span style=\"color: #0000ff;\">Description=&#8217;A basic static ethernet connection&#8217;<\/span><br \/><span style=\"color: #0000ff;\">Interface=eth0<\/span><br \/><span style=\"color: #0000ff;\">Connection=ethernet<\/span><br \/><span style=\"color: #0000ff;\">AutoWired=yes<\/span><br \/><span style=\"color: #0000ff;\">IP=static<\/span><br \/><span style=\"color: #0000ff;\">Address=(&#8216;192.168.1.23\/24&#8217;)<\/span><br \/><span style=\"color: #0000ff;\">Gateway=&#8217;192.168.1.254&#8242;<\/span><br \/><span style=\"color: #0000ff;\">DNS=(&#8216;168.95.1.1&#8217; &#8216;140.111.66.1&#8217; &#8216;8.8.8.8&#8217;)<\/span><\/p>\n<p><span style=\"color: #0000ff;\">## For IPv6 autoconfiguration<\/span><br \/><span style=\"color: #0000ff;\">#IP6=stateles<\/span><br \/><span style=\"color: #0000ff;\">## For IPv6 static address configuration<\/span><br \/><span style=\"color: #0000ff;\">#IP6=static<\/span><br \/><span style=\"color: #0000ff;\">#Address6=(&#8216;1234:5678:9abc:def::1\/64&#8217; &#8216;1234:3456::123\/96&#8217;)<\/span><br \/><span style=\"color: #0000ff;\">#Routes6=(&#8216;abcd::1234&#8217;)<\/span><br \/><span style=\"color: #0000ff;\">#Gateway6=&#8217;1234:0:123::abcd&#8217;<\/span><\/p>\n<p>\u8b93\u8a2d\u5b9a\u751f\u6548<br \/># <span style=\"color: #ff0000;\">systemctl reboot<\/span><\/p>\n<p>\u7528\u6307\u4ee4\u8a2d\u5b9a<br \/>DHCP <br \/># <span style=\"color: #ff0000;\">ip link set eth0 up<\/span><br \/># <span style=\"color: #ff0000;\">dhcpcd eth0<\/span><\/p>\n<p>Static<br \/># <span style=\"color: #ff0000;\">link link set eth0 up<\/span><br \/># <span style=\"color: #ff0000;\">ip addr add 192.168.1.105\/24 dev eth0<\/span><br \/># <span style=\"color: #ff0000;\">ip route add default via 192.168.1.254<\/span><\/p>\n<p># <span style=\"color: #ff0000;\">systemctl enable dhcpcd@interface_name.service<\/span><br \/># <span style=\"color: #ff0000;\">systemctl enable dhcpcd@eth0.service<\/span><\/p>\n<p># <span style=\"color: #ff0000;\">cd \/etc\/netctl<\/span><br \/># <span style=\"color: #ff0000;\">netctl enable eth0<\/span><\/p>\n<p>\u53e6\u5916\u4e00\u7a2e\u65b9\u5f0f<br \/>\u8a2d\u5b9a Static IP<br \/># <span style=\"color: #ff0000;\">systemctl disable dhcpcd<\/span><br \/># <span style=\"color: #ff0000;\">vim \/etc\/systemd\/network\/eth0.network<\/span><br \/><span style=\"color: #0000ff;\">[Match]<\/span><br \/><span style=\"color: #0000ff;\">Name=eth0<\/span><\/p>\n<p><span style=\"color: #0000ff;\">[Network]<\/span><br \/><span style=\"color: #0000ff;\">DNS=168.95.1.1 140.111.66.1<\/span><br \/><span style=\"color: #0000ff;\">Address=192.168.1.94\/24<\/span><br \/><span style=\"color: #0000ff;\">Gateway=192.168.1.254<\/span><\/p>\n<p>\u8a2d\u5b9a DHCP<br \/># <span style=\"color: #ff0000;\">systemctl enable dhcpcd<\/span><br \/># <span style=\"color: #ff0000;\">vim \/etc\/systemd\/network\/eth0.network<\/span><br \/><span style=\"color: #0000ff;\">[Match]<\/span><br \/><span style=\"color: #0000ff;\">Name=eth0<\/span><\/p>\n<p><span style=\"color: #0000ff;\">[Network]<\/span><br \/><span style=\"color: #0000ff;\">DHCP=yes<\/span><\/p>\n<p><span style=\"color: #ff0000;\"><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u539f\u672c\u7684 ArchLinux \u662f\u4f7f\u7528 DHCP \u81ea\u52d5\u53d6\u5f97 IP \u9023\u7dda\uff0c\u4f46\u8981\u7576\u6210\u53ef\u4ee5\u6b63\u5f0f\u9023\u7dda\u7684 Server\uff0c\u5c31\u8981 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/2blog.ilc.edu.tw\/25793\/2014\/11\/05\/archlinux-%e7%b6%b2%e8%b7%af%e8%a8%ad%e5%ae%9a\/\" class=\"more-link\">\u95b1\u8b80\u5168\u6587<span class=\"screen-reader-text\">\u3008ArchLinux &#8211; \u7db2\u8def\u8a2d\u5b9a\u3009<\/span><\/a><\/p>\n","protected":false},"author":55,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[167],"tags":[],"class_list":["post-18581","post","type-post","status-publish","format-standard","hentry","category-c-84386"],"meta_key":{"_pingme":["1"],"_encloseme":["1"],"lt_post_id":["520441"]},"_links":{"self":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts\/18581"}],"collection":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/users\/55"}],"replies":[{"embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/comments?post=18581"}],"version-history":[{"count":0,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/posts\/18581\/revisions"}],"wp:attachment":[{"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/media?parent=18581"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/categories?post=18581"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2blog.ilc.edu.tw\/25793\/wp-json\/wp\/v2\/tags?post=18581"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}