﻿{"id":73,"date":"2018-03-30T13:43:56","date_gmt":"2018-03-30T05:43:56","guid":{"rendered":"http:\/\/www.cloudy.pub\/?p=73"},"modified":"2018-03-30T13:43:56","modified_gmt":"2018-03-30T05:43:56","slug":"centos-7%e4%bf%ae%e6%94%b9%e7%bd%91%e5%8d%a1%e5%90%8d%e7%a7%b0","status":"publish","type":"post","link":"https:\/\/www.0moon.com\/?p=73","title":{"rendered":"Centos 7\u4fee\u6539\u7f51\u5361\u540d\u79f0"},"content":{"rendered":"<p>\u8d77\u56e0\uff0c\u5f88\u591a\u4f7f\u7528CentOS7\u4ee5\u524d\u7cfb\u7edf\u7684\u5c0f\u4f19\u4f34\u88c5\u5b8cCentOS7\u4ee5\u540e\u53d1\u73b0\u4e86\u4e00\u4e2a\u95ee\u9898\uff0c\u90a3\u5c31\u662f\u7f51\u5361\u540d\u6539\u53d8\u4e3a\u4e86\u201cen016777736\u201d\uff0c\u800c\u4e0d\u662f\u4ee5\u524d\u7684eth0\u7684\u7b80\u6613\u6a21\u5f0f\u4e86\uff0c\u5982\u56fe\uff1a<\/p>\n<p><a href=\"https:\/\/s5.51cto.com\/wyfs02\/M02\/9B\/8E\/wKioL1lkeU6B5lHzAABMryQXEEE979.png\" target=\"_blank\" rel=\"noopener\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/s5.51cto.com\/wyfs02\/M02\/9B\/8E\/wKioL1lkeU6B5lHzAABMryQXEEE979.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" title=\"124.png\" data-original=\"https:\/\/s5.51cto.com\/wyfs02\/M02\/9B\/8E\/wKioL1lkeU6B5lHzAABMryQXEEE979.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"wKioL1lkeU6B5lHzAABMryQXEEE979.png\" \/><\/div><\/a><\/p>\n<p>\u8fd9\u662f\u4e3a\u4ec0\u4e48\u5462\uff1f\u5f00\u53d1\u8005\u5403\u9971\u6491\u7684\u4e48\uff1f\u5f53\u7136\u4e0d\u662f\u3002<\/p>\n<p>\u4ee5\u5f80\u7684CentOS7\u4ee5\u524d\u7684\u7cfb\u7edf\u7f51\u5361\u547d\u540d\u867d\u7136\u7b80\u5355\u65b9\u4fbf\uff0c\u4f46\u4e5f\u4f1a\u5e26\u6765\u4e00\u4e9b\u95ee\u9898\uff0c\u4f8b\u5982\uff0c\u5f53eth0\u63a5\u53e3\u5bf9\u5e94\u7684\u7f51\u5361\u51fa\u95ee\u9898\u4ee5\u540e\uff0c\u66f4\u6362\u6389\u65b0\u7f51\u5361\u540e\u65b0\u7f51\u5361\u7684\u540d\u5b57\u5c31\u53ef\u80fd\u4e0d\u662feth0\u4e86\u3002\u800cCentOS7\u4f7f\u7528\u4e86\u65b0\u7684\u7f51\u5361\u547d\u540d\u6a21\u5f0f\u63a5\u53e3\u540d\u79f0\u88ab\u81ea\u52a8\u57fa\u4e8e\u56fa\u4ef6\uff0c\u62d3\u6251\u7ed3\u6784\u548c\u4f4d\u7f6e\u4fe1\u606f\u6765\u786e\u5b9a\u3002\u5373\u4f7f\u6dfb\u52a0\u6216\u79fb\u9664\u7f51\u7edc\u8bbe\u5907\uff0c\u63a5\u53e3\u540d\u79f0\u4ecd\u7136\u4fdd\u6301\u56fa\u5b9a\uff0c\u800c\u65e0\u9700\u91cd\u65b0\u679a\u4e3e\uff0c\u548c\u574f\u6389\u7684\u786c\u4ef6\u53ef\u4ee5\u65e0\u7f1d\u66ff\u6362\u3002<\/p>\n<p>\u867d\u7136\u65b0\u7684\u547d\u540d\u6709\u597d\u5904\uff0c\u4f46\u662f\u65b0\u7684\u63a5\u53e3\u540d\u79f0\u547d\u540d\u65b9\u6848\u6bd4\u4f20\u7edf\u7684eth0\u76f8\u6bd4\u770b\u8d77\u6765\u66f4\u96be\u4f7f\u7528\uff0c\u51fa\u4e8e\u4e60\u60ef\uff0c\u5f88\u591a\u7f51\u53cb\u60f3\u4fee\u6539\u7f51\u5361\u540d\u79f0\uff0c\u4e0b\u9762\u4e3a\u5927\u5bb6\u4ecb\u7ecd\u5982\u4f55\u5728CentOS7\u6216RHEL7\u547d\u540d\u7f51\u7edc\u63a5\u53e3\u3002<\/p>\n<p>&nbsp;<\/p>\n<h3>1.\u8c03\u6574\u7f51\u5361\u540d\u79f0<\/h3>\n<p>[root@oldboy tools]# cd\/etc\/sysconfig\/network-scripts\/\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0#&lt;==\u8fdb\u5165\u7f51\u5361\u6587\u4ef6\u76ee\u5f55\u3002<\/p>\n<p>[root@oldboy network-scripts]# mv mv ifcfg-eno16777736ifcfg-eth0 #&lt;==\u8fdb\u91cd\u547d\u540d\u7f51\u5361\u540d\u79f0\u3002<\/p>\n<h3>2.\u8c03\u6574\u7f51\u5361\u7684\u914d\u7f6e\u4fe1\u606f<\/h3>\n<p>[root@oldboy network-scripts]# cat ifcfg-eth0 #&lt;==\u4fee\u6539\u540e\u7684\u7ed3\u679c\u5982\u4e0b\u3002<\/p>\n<p>TYPE=Ethernet<\/p>\n<p>BOOTPROTO=none<\/p>\n<p>DEFROUTE=yes<\/p>\n<p>IPV4_FAILURE_FATAL=no<\/p>\n<p>IPV6INIT=yes<\/p>\n<p>IPV6_AUTOCONF=yes<\/p>\n<p>IPV6_DEFROUTE=yes<\/p>\n<p>IPV6_FAILURE_FATAL=no<\/p>\n<p>NAME=eth0\u00a0\u00a0 #&lt;==\u4fee\u6539\u4e3aeth0\u3002<\/p>\n<p>UUID=3e8d1581-84bd-44e8-ae70-467fa29e2585<\/p>\n<p>DEVICE=eth0 #&lt;==\u4fee\u6539\u4e3aeth0\u3002<\/p>\n<p>ONBOOT=yes<\/p>\n<p>DNS1=10.0.0.2<\/p>\n<p>IPADDR=10.0.0.201<\/p>\n<p>PREFIX=24<\/p>\n<p>GATEWAY=10.0.0.2<\/p>\n<p>IPV6_PEERDNS=yes<\/p>\n<p>IPV6_PEERROUTES=yes<\/p>\n<p>IPV6_PRIVACY=no<\/p>\n<h3>3.\u4fee\u6539\u5e76\u751f\u6210grub\u914d\u7f6e<\/h3>\n<p>\u4fee\u6539\u540e\u7684\u7ed3\u679c\u5982\u4e0b\uff0c\u4e5f\u53ef\u4ee5\u5728\u5b89\u88c5\u7cfb\u7edf\u6216\u5f00\u673a\u542f\u52a8\u65f6\u8fdb\u884c\u8c03\u6574\u3002<\/p>\n<p>[root@oldboy network-scripts]# cat \/etc\/sysconfig\/grub<\/p>\n<p>GRUB_TIMEOUT=5<\/p>\n<p>GRUB_DISTRIBUTOR=&#8221;$(sed &#8216;s, release .*$,,g&#8217;\/etc\/system-release)&#8221;<\/p>\n<p>GRUB_DEFAULT=saved<\/p>\n<p>GRUB_DISABLE_SUBMENU=true<\/p>\n<p>GRUB_TERMINAL_OUTPUT=&#8221;console&#8221;<\/p>\n<p>GRUB_CMDLINE_LINUX=&#8221;crashkernel=128M rhgb <span style=\"background-color: #ffff00;\"><strong>net.ifnames=0 biosdevname=0<\/strong><\/span> quiet&#8221;\u00a0 #&lt;==\u9ec4\u8272\u5e95\u7eb9\u5185\u5bb9\u662f\u6dfb\u52a0\u7684\u3002<\/p>\n<p>GRUB_DISABLE_RECOVERY=&#8221;true&#8221;<\/p>\n<p>&nbsp;<\/p>\n<p>[root@linux-node2 ~]# grub2-mkconfig -o\/boot\/grub2\/grub.cfg \u00a0\u00a0\u00a0#&lt;==\u751f\u6210grub\u542f\u52a8\u83dc\u5355\u3002<\/p>\n<p>Generating grub configuration file &#8230;<\/p>\n<p>Found linux image: \/boot\/vmlinuz-3.10.0-229.el7.x86_64<\/p>\n<p>Found initrd image:\/boot\/initramfs-3.10.0-229.el7.x86_64.img<\/p>\n<p>Found linux image:\/boot\/vmlinuz-0-rescue-1100f7e6c97d4afaad2e396403ba7f61<\/p>\n<p>Found initrd image:\/boot\/initramfs-0-rescue-1100f7e6c97d4afaad2e396403ba7f61.img<\/p>\n<p>Done<\/p>\n<h3>4.\u9a8c\u8bc1\u662f\u5426\u4fee\u6539\u7ed3\u679c<\/h3>\n<p>[root@oldboy network-scripts]# reboot #&lt;==\u5fc5\u987b\u91cd\u542f\u7cfb\u7edf\u3002<\/p>\n<p>[root@linux-node2 ~]# yum install net-tools -y \u00a0 \u00a0 \u00a0 #&lt;== centos7\u9ed8\u8ba4\u6ca1\u6709ifconfig \u9700\u8981\u5b89\u88c5net-tools\u5305<\/p>\n<p>[root@oldboy network-scripts]# ifconfig \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0#&lt;==\u518d\u6b21\u67e5\u770b\u7f51\u5361\u4fe1\u606f<\/p>\n<p><strong>eth0<\/strong>: flags=4163&lt;UP,BROADCAST,RUNNING,MULTICAST&gt;\u00a0 mtu 1500<\/p>\n<p>inet10.0.0.201\u00a0 netmask 255.255.255.0\u00a0 broadcast 10.0.0.255<\/p>\n<p>inet6fe80::20c:29ff:feae:ef19\u00a0 prefixlen64\u00a0 scopeid 0x20&lt;link&gt;<\/p>\n<p>ether00:0c:29:ae:ef:19\u00a0 txqueuelen 1000\u00a0 (Ethernet)<\/p>\n<p>RX packets36248\u00a0 bytes 2319009 (2.2 MiB)<\/p>\n<p>RXerrors 0\u00a0 dropped 0\u00a0 overruns 0\u00a0frame 0<\/p>\n<p>TXpackets 43090\u00a0 bytes 67555745 (64.4 MiB)<\/p>\n<p>TXerrors 0\u00a0 dropped 0 overruns 0\u00a0 carrier 0\u00a0collisions 0<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8d77\u56e0\uff0c\u5f88\u591a\u4f7f\u7528CentOS7\u4ee5\u524d\u7cfb\u7edf\u7684\u5c0f\u4f19\u4f34\u88c5\u5b8cCentOS7\u4ee5\u540e\u53d1\u73b0\u4e86\u4e00\u4e2a\u95ee\u9898\uff0c\u90a3\u5c31\u662f\u7f51\u5361\u540d\u6539\u53d8\u4e3a\u4e86\u201cen0 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-73","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.0moon.com\/index.php?rest_route=\/wp\/v2\/posts\/73","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.0moon.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.0moon.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.0moon.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.0moon.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=73"}],"version-history":[{"count":1,"href":"https:\/\/www.0moon.com\/index.php?rest_route=\/wp\/v2\/posts\/73\/revisions"}],"predecessor-version":[{"id":74,"href":"https:\/\/www.0moon.com\/index.php?rest_route=\/wp\/v2\/posts\/73\/revisions\/74"}],"wp:attachment":[{"href":"https:\/\/www.0moon.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=73"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.0moon.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=73"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.0moon.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=73"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}