{"id":79,"date":"2017-03-29T21:28:57","date_gmt":"2017-03-29T13:28:57","guid":{"rendered":"http:\/\/www.jsjs.org\/?p=79"},"modified":"2017-03-29T21:28:57","modified_gmt":"2017-03-29T13:28:57","slug":"linux%e6%9c%89%e9%97%ae%e5%bf%85%e7%ad%94%ef%bc%9a%e5%a6%82%e4%bd%95%e4%b8%bacentos-7%e9%85%8d%e7%bd%ae%e9%9d%99%e6%80%81ip%e5%9c%b0%e5%9d%80","status":"publish","type":"post","link":"https:\/\/blog.jsjs.org\/?p=79","title":{"rendered":"Linux\u6709\u95ee\u5fc5\u7b54\uff1a\u5982\u4f55\u4e3aCentOS 7\u914d\u7f6e\u9759\u6001IP\u5730\u5740"},"content":{"rendered":"<blockquote><p><strong>\u95ee\u9898<\/strong>\uff1a\u5728CentOS 7\u4e0a\uff0c\u6211\u60f3\u8981\u5c06\u6211\u5176\u4e2d\u4e00\u4e2a\u7f51\u7edc\u63a5\u53e3\u4eceDHCP\u6539\u4e3a\u9759\u6001IP\u5730\u5740\u914d\u7f6e\uff0c\u5982\u4f55\u624d\u80fd\u6c38\u4e45\u4e3aCentOS\u6216RHEL 7\u4e0a\u7684\u7f51\u7edc\u63a5\u53e3\u5206\u914d\u9759\u6001IP\u5730\u5740\uff1f<\/p><\/blockquote>\n<p>\u5982\u679c\u4f60\u60f3\u8981\u4e3aCentOS 7\u4e2d\u7684\u67d0\u4e2a\u7f51\u7edc\u63a5\u53e3\u8bbe\u7f6e\u9759\u6001IP\u5730\u5740\uff0c\u6709\u51e0\u79cd\u4e0d\u540c\u7684\u65b9\u6cd5\uff0c\u8fd9\u53d6\u51b3\u4e8e\u4f60\u662f\u5426\u60f3\u8981\u4f7f\u7528\u7f51\u7edc\u7ba1\u7406\u5668\u3002<\/p>\n<p class=\"article_img\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dn-linuxcn.qbox.me\/data\/attachment\/album\/201410\/08\/221259airrli6rlijv5ot4.jpg\" alt=\"\" width=\"432\" height=\"324\" \/><\/p>\n<p>\u7f51\u7edc\u7ba1\u7406\u5668\uff08Network Manager\uff09\u662f\u4e00\u4e2a\u52a8\u6001\u7f51\u7edc\u7684\u63a7\u5236\u5668\u4e0e\u914d\u7f6e\u7cfb\u7edf\uff0c\u5b83\u7528\u4e8e\u5f53\u7f51\u7edc\u8bbe\u5907\u53ef\u7528\u65f6\u4fdd\u6301\u8bbe\u5907\u548c\u8fde\u63a5\u5f00\u542f\u5e76\u6fc0\u6d3b\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cCentOS\/RHEL 7\u5b89\u88c5\u6709\u7f51\u7edc\u7ba1\u7406\u5668\uff0c\u5e76\u5904\u4e8e\u542f\u7528\u72b6\u6001\u3002<\/p>\n<p>\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u6765\u9a8c\u8bc1\u7f51\u7edc\u7ba1\u7406\u5668\u670d\u52a1\u7684\u72b6\u6001\uff1a<\/p>\n<ol class=\"linenums\">\n<li class=\"L0\"><span class=\"pln\">$ <\/span><span class=\"kwd\">systemctl<\/span><span class=\"pln\"> status <\/span><span class=\"typ\">NetworkManager<\/span><span class=\"pun\">.<\/span><span class=\"pln\">service<\/span><\/li>\n<\/ol>\n<p>\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u68c0\u67e5\u53d7\u7f51\u7edc\u7ba1\u7406\u5668\u7ba1\u7406\u7684\u7f51\u7edc\u63a5\u53e3\uff1a<\/p>\n<ol class=\"linenums\">\n<li class=\"L0\"><span class=\"pln\">$ nmcli dev status <\/span><\/li>\n<\/ol>\n<p class=\"article_img\"><img decoding=\"async\" src=\"https:\/\/dn-linuxcn.qbox.me\/data\/attachment\/album\/201410\/08\/221302p9lwjl996jgz55bg.jpg\" alt=\"\" \/><\/p>\n<p>\u5982\u679c\u67d0\u4e2a\u63a5\u53e3\u7684nmcli\u7684\u8f93\u51fa\u7ed3\u679c\u662f\u201c\u5df2\u8fde\u63a5\u201d\uff08\u5982\u672c\u4f8b\u4e2d\u7684enp0s3\uff09\uff0c\u8fd9\u5c31\u662f\u8bf4\u8be5\u63a5\u53e3\u53d7\u7f51\u7edc\u7ba1\u7406\u5668\u7ba1\u7406\u3002\u4f60\u53ef\u4ee5\u8f7b\u6613\u5730\u4e3a\u67d0\u4e2a\u7279\u5b9a\u63a5\u53e3\u7981\u7528\u7f51\u7edc\u7ba1\u7406\u5668\uff0c\u4ee5\u4fbf\u4f60\u53ef\u4ee5\u81ea\u5df1\u4e3a\u5b83\u914d\u7f6e\u4e00\u4e2a\u9759\u6001IP\u5730\u5740\u3002<\/p>\n<p>\u4e0b\u9762\u5c06\u4ecb\u7ecd<strong>\u5728CentOS 7\u4e0a\u4e3a\u7f51\u7edc\u63a5\u53e3\u914d\u7f6e\u9759\u6001IP\u5730\u5740\u7684\u4e24\u79cd\u65b9\u5f0f<\/strong>\uff0c\u5728\u4f8b\u5b50\u4e2d\u6211\u4eec\u5c06\u5bf9\u540d\u4e3aenp0s3\u7684\u7f51\u7edc\u63a5\u53e3\u8fdb\u884c\u914d\u7f6e\u3002<\/p>\n<h3 id=\"toc_1\">\u4e0d\u4f7f\u7528\u7f51\u7edc\u7ba1\u7406\u914d\u7f6e\u9759\u6001IP\u5730\u5740<\/h3>\n<p>\u8fdb\u5165\/etc\/sysconfig\/network-scripts\u76ee\u5f55\uff0c\u627e\u5230\u8be5\u63a5\u53e3\u7684\u914d\u7f6e\u6587\u4ef6\uff08ifcfg-enp0s3\uff09\u3002\u5982\u679c\u6ca1\u6709\uff0c\u8bf7\u521b\u5efa\u4e00\u4e2a\u3002<\/p>\n<p class=\"article_img\"><img decoding=\"async\" src=\"https:\/\/dn-linuxcn.qbox.me\/data\/attachment\/album\/201410\/08\/221305nsr4i3n02bx4ri32.jpg\" alt=\"\" \/><\/p>\n<p>\u6253\u5f00\u914d\u7f6e\u6587\u4ef6\u5e76\u7f16\u8f91\u4ee5\u4e0b\u53d8\u91cf\uff1a<\/p>\n<p class=\"article_img\"><img decoding=\"async\" src=\"https:\/\/dn-linuxcn.qbox.me\/data\/attachment\/album\/201410\/08\/221307yl6oq3fs5tp5o532.jpg\" alt=\"\" \/><\/p>\n<p>\u5728\u4e0a\u56fe\u4e2d\uff0c\u201cNM_CONTROLLED=no\u201d\u8868\u793a\u8be5\u63a5\u53e3\u5c06\u901a\u8fc7\u8be5\u914d\u7f6e\u6587\u4ef6\u8fdb\u884c\u8bbe\u7f6e\uff0c\u800c\u4e0d\u662f\u901a\u8fc7\u7f51\u7edc\u7ba1\u7406\u5668\u8fdb\u884c\u7ba1\u7406\u3002\u201cONBOOT=yes\u201d\u544a\u8bc9\u6211\u4eec\uff0c\u7cfb\u7edf\u5c06\u5728\u542f\u52a8\u65f6\u5f00\u542f\u8be5\u63a5\u53e3\u3002<\/p>\n<p>\u4fdd\u5b58\u4fee\u6539\u5e76\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6765\u91cd\u542f\u7f51\u7edc\u670d\u52a1\uff1a<\/p>\n<ol class=\"linenums\">\n<li class=\"L0\"><span class=\"com\">#<\/span> <span class=\"kwd\">systemctl<\/span><span class=\"pln\"> restart network<\/span><span class=\"pun\">.<\/span><span class=\"pln\">service<\/span><\/li>\n<\/ol>\n<p>\u73b0\u5728\u9a8c\u8bc1\u63a5\u53e3\u662f\u5426\u914d\u7f6e\u6b63\u786e\uff1a<\/p>\n<ol class=\"linenums\">\n<li class=\"L0\"><span class=\"com\">#<\/span> <span class=\"kwd\">ip<\/span><span class=\"pln\"> add <\/span><\/li>\n<\/ol>\n<p class=\"article_img\"><img decoding=\"async\" src=\"https:\/\/dn-linuxcn.qbox.me\/data\/attachment\/album\/201410\/08\/220914co9y3z00ymqgttbb.jpg\" alt=\"\" \/><\/p>\n<h3 id=\"toc_2\">\u4f7f\u7528\u7f51\u7edc\u7ba1\u7406\u5668\u914d\u7f6e\u9759\u6001IP\u5730\u5740<\/h3>\n<p>\u5982\u679c\u4f60\u60f3\u8981\u4f7f\u7528\u7f51\u7edc\u7ba1\u7406\u5668\u6765\u7ba1\u7406\u8be5\u63a5\u53e3\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528nmtui\uff08\u7f51\u7edc\u7ba1\u7406\u5668\u6587\u672c\u7528\u6237\u754c\u9762\uff09\uff0c\u5b83\u63d0\u4f9b\u4e86\u5728\u7ec8\u7aef\u73af\u5883\u4e2d\u914d\u7f6e\u914d\u7f6e\u7f51\u7edc\u7ba1\u7406\u5668\u7684\u65b9\u5f0f\u3002<\/p>\n<p>\u5728\u4f7f\u7528nmtui\u4e4b\u524d\uff0c\u9996\u5148\u8981\u5728\/etc\/sysconfig\/network-scripts\/ifcfg-enp0s3\u4e2d\u8bbe\u7f6e\u201cNM_CONTROLLED=yes\u201d\u3002<\/p>\n<p>\u73b0\u5728\uff0c\u8bf7\u6309\u4ee5\u4e0b\u65b9\u5f0f\u5b89\u88c5nmtui\u3002<\/p>\n<ol class=\"linenums\">\n<li class=\"L0\"><span class=\"com\">#<\/span> <span class=\"kwd\">yum<\/span><span class=\"pln\"> install <\/span><span class=\"typ\">NetworkManager<\/span><span class=\"pun\">&#8211;<\/span><span class=\"pln\">tui<\/span><\/li>\n<\/ol>\n<p>\u7136\u540e\u7ee7\u7eed\u53bb\u7f16\u8f91enp0s3\u63a5\u53e3\u7684\u7f51\u7edc\u7ba1\u7406\u5668\u914d\u7f6e\uff1a<\/p>\n<ol class=\"linenums\">\n<li class=\"L0\"><span class=\"com\">#<\/span><span class=\"pln\"> nmtui edit enp0s3 <\/span><\/li>\n<\/ol>\n<p>\u5728\u4e0b\u9762\u7684\u5c4f\u5e55\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u624b\u52a8\u8f93\u5165\u4e0e\/etc\/sysconfig\/network-scripts\/ifcfg-enp0s3\u4e2d\u6240\u5305\u542b\u7684\u5185\u5bb9\u76f8\u540c\u7684\u4fe1\u606f\u3002<\/p>\n<p>\u4f7f\u7528\u7bad\u5934\u952e\u5728\u5c4f\u5e55\u4e2d\u5bfc\u822a\uff0c\u6309\u56de\u8f66\u9009\u62e9\u503c\u5217\u8868\u4e2d\u7684\u5185\u5bb9\uff08\u6216\u586b\u5165\u60f3\u8981\u7684\u5185\u5bb9\uff09\uff0c\u6700\u540e\u70b9\u51fb\u5c4f\u5e55\u5e95\u90e8\u53f3\u4fa7\u7684\u786e\u5b9a\u6309\u94ae\u3002<\/p>\n<p class=\"article_img\"><img decoding=\"async\" src=\"https:\/\/dn-linuxcn.qbox.me\/data\/attachment\/album\/201410\/08\/221310v8a38lfcuh8cbk1h.jpg\" alt=\"\" \/><\/p>\n<p>\u6700\u540e\uff0c\u91cd\u542f\u7f51\u7edc\u670d\u52a1\u3002<\/p>\n<ol class=\"linenums\">\n<li class=\"L0\"><span class=\"com\">#<\/span> <span class=\"kwd\">systemctl<\/span><span class=\"pln\"> restart network<\/span><span class=\"pun\">.<\/span><span class=\"pln\">service<\/span><\/li>\n<\/ol>\n<p>\u597d\u4e86\uff0c\u73b0\u5728\u4e00\u5207\u90fd\u641e\u5b9a\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u95ee\u9898\uff1a\u5728CentOS 7\u4e0a\uff0c\u6211\u60f3\u8981\u5c06\u6211\u5176\u4e2d\u4e00\u4e2a\u7f51\u7edc\u63a5\u53e3\u4eceDHCP\u6539\u4e3a\u9759\u6001IP\u5730\u5740\u914d\u7f6e\uff0c\u5982\u4f55\u624d\u80fd\u6c38\u4e45\u4e3aCentOS\u6216RHEL 7\u4e0a\u7684\u7f51\u7edc\u63a5\u53e3\u5206\u914d\u9759\u6001IP\u5730\u5740\uff1f \u5982\u679c\u4f60\u60f3\u8981\u4e3aCentOS 7\u4e2d\u7684\u67d0\u4e2a\u7f51\u7edc\u63a5\u53e3\u8bbe\u7f6e\u9759\u6001IP\u5730\u5740\uff0c\u6709\u51e0\u79cd\u4e0d\u540c\u7684\u65b9\u6cd5\uff0c\u8fd9\u53d6\u51b3\u4e8e\u4f60\u662f\u5426\u60f3\u8981\u4f7f\u7528\u7f51\u7edc\u7ba1\u7406\u5668\u3002 \u7f51\u7edc\u7ba1\u7406\u5668\uff08Network Manager\uff09\u662f\u4e00\u4e2a\u52a8\u6001\u7f51\u7edc\u7684\u63a7\u5236\u5668\u4e0e\u914d\u7f6e\u7cfb\u7edf\uff0c\u5b83\u7528\u4e8e\u5f53\u7f51\u7edc\u8bbe\u5907\u53ef\u7528\u65f6\u4fdd\u6301\u8bbe\u5907\u548c\u8fde\u63a5\u5f00\u542f\u5e76\u6fc0\u6d3b\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cCentOS\/RHEL 7\u5b89\u88c5\u6709\u7f51\u7edc\u7ba1\u7406\u5668\uff0c\u5e76\u5904\u4e8e\u542f\u7528\u72b6\u6001\u3002 \u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u6765\u9a8c\u8bc1\u7f51\u7edc\u7ba1\u7406\u5668\u670d\u52a1\u7684\u72b6\u6001\uff1a $ systemctl status NetworkManager.service \u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u68c0\u67e5\u53d7\u7f51\u7edc\u7ba1\u7406\u5668\u7ba1\u7406\u7684\u7f51\u7edc\u63a5\u53e3\uff1a $ nmcli dev status \u5982\u679c\u67d0\u4e2a\u63a5\u53e3\u7684nmcli\u7684\u8f93\u51fa\u7ed3\u679c\u662f\u201c\u5df2\u8fde\u63a5\u201d\uff08\u5982\u672c\u4f8b\u4e2d\u7684enp0s3\uff09\uff0c\u8fd9\u5c31\u662f\u8bf4\u8be5\u63a5\u53e3\u53d7\u7f51\u7edc\u7ba1\u7406\u5668\u7ba1\u7406\u3002\u4f60\u53ef\u4ee5\u8f7b\u6613\u5730\u4e3a\u67d0\u4e2a\u7279\u5b9a\u63a5\u53e3\u7981\u7528\u7f51\u7edc\u7ba1\u7406\u5668\uff0c\u4ee5\u4fbf\u4f60\u53ef\u4ee5\u81ea\u5df1\u4e3a\u5b83\u914d\u7f6e\u4e00\u4e2a\u9759\u6001IP\u5730\u5740\u3002 \u4e0b\u9762\u5c06\u4ecb\u7ecd\u5728CentOS [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-79","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/posts\/79","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=79"}],"version-history":[{"count":0,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/posts\/79\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=79"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=79"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=79"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}