{"id":7498,"date":"2015-08-03T21:25:59","date_gmt":"2015-08-03T13:25:59","guid":{"rendered":"http:\/\/jpuyy.com\/?p=7498"},"modified":"2015-08-03T21:26:16","modified_gmt":"2015-08-03T13:26:16","slug":"centos-7-change-interface-name","status":"publish","type":"post","link":"https:\/\/jpuyy.com\/?p=7498","title":{"rendered":"CentOS 7 \u66f4\u6539 interface name"},"content":{"rendered":"<p>\u4e60\u60ef\u4e8e\u7528 eth0 eth1 \uff0c\u4e0d\u4e60\u60ef em1, enp0s3\uff0c\u5728 kickstart \u6587\u4ef6\u4e2d\u5199\u5982\u4e0b\u811a\u672c\uff0c\u4f7f\u7528 eth0, eth1<\/p>\n<pre>\r\n# grub \u7684\u914d\u7f6e\u0002\u0002\uff0c\u5173\u952e\u662f\u5185\u6838\u542f\u52a8\u53c2\u6570 net.ifnames=0 biosdevname=0\r\n\r\ncat << __EOT__ > \/etc\/default\/grub\r\nGRUB_TIMEOUT=5\r\nGRUB_DEFAULT=saved\r\nGRUB_DISABLE_SUBMENU=true\r\nGRUB_TERMINAL_OUTPUT=\"console\"\r\nGRUB_CMDLINE_LINUX=\"crashkernel=auto rhgb quiet net.ifnames=0 biosdevname=0\"\r\nGRUB_DISABLE_RECOVERY=\"true\"\r\n__EOT__\r\n\r\n# \u751f\u6210\u5b9e\u9645\u4f7f\u7528\u7684 grub2.cfg\r\ngrub2-mkconfig -o \/boot\/grub2\/grub.cfg\r\n\r\n# \u5220\u6389\u4e0d\u559c\u6b22\u7684 interface name\r\nrm -f \/etc\/sysconfig\/network-scripts\/ifcfg-em*\r\nrm -f \/etc\/sysconfig\/network-scripts\/ifcfg-en*\r\n\r\n# \u521b\u5efa eth0, eth1 \u6a21\u677f\r\ncat << __EOT__ > \/etc\/sysconfig\/network-scripts\/ifcfg-eth0\r\nDEVICE=eth0\r\nBOOTPROTO=\"static\"\r\nIPV6INIT=\"no\"\r\nNM_CONTROLLED=\"yes\"\r\nONBOOT=\"yes\"\r\nTYPE=\"Ethernet\"\r\nIPADDR=192.168.x.x\r\nNETMASK=255.255.255.0\r\nGATEWAY=192.168.x.1\r\n__EOT__\r\n\r\ncat << __EOT__ > \/etc\/sysconfig\/network-scripts\/ifcfg-eth1\r\nDEVICE=eth1\r\nBOOTPROTO=\"static\"\r\nIPV6INIT=\"no\"\r\nNM_CONTROLLED=\"yes\"\r\nONBOOT=\"no\"\r\nTYPE=\"Ethernet\"\r\n__EOT__\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u4e60\u60ef\u4e8e\u7528 eth0 eth1 \uff0c\u4e0d\u4e60\u60ef em1, enp0s3\uff0c\u5728 kickstart \u6587\u4ef6\u4e2d\u5199\u5982\u4e0b\u811a\u672c\uff0c\u4f7f\u7528 eth0, eth1 # grub \u7684\u914d\u7f6e\u0002\u0002\uff0c\u5173\u952e\u662f\u5185\u6838\u542f\u52a8\u53c2\u6570 net.ifnames=0 biosdevname=0 cat \/etc\/default\/grub GRUB_TIMEOUT=5 GRUB_DEFAULT=saved GRUB_DISABLE_SUBMENU=true GRUB_TERMINAL_OUTPUT=&#8221;console&#8221; GRUB_CMDLINE_LINUX=&#8221;crashkernel=auto rhgb quiet net.ifnames=0 biosdevname=0&#8243; GRUB_DISABLE_RECOVERY=&#8221;true&#8221; __EOT__ # \u751f\u6210\u5b9e\u9645\u4f7f\u7528\u7684 grub2.cfg grub2-mkconfig -o \/boot\/grub2\/grub.cfg # \u5220\u6389\u4e0d\u559c\u6b22\u7684 interface name rm -f \/etc\/sysconfig\/network-scripts\/ifcfg-em* rm -f \/etc\/sysconfig\/network-scripts\/ifcfg-en* # \u521b\u5efa eth0, eth1 \u6a21\u677f cat \/etc\/sysconfig\/network-scripts\/ifcfg-eth0 DEVICE=eth0 BOOTPROTO=&#8221;static&#8221; IPV6INIT=&#8221;no&#8221; NM_CONTROLLED=&#8221;yes&#8221; [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-7498","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/7498","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7498"}],"version-history":[{"count":1,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/7498\/revisions"}],"predecessor-version":[{"id":7499,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/7498\/revisions\/7499"}],"wp:attachment":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7498"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7498"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7498"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}