{"id":332,"date":"2021-08-21T12:05:06","date_gmt":"2021-08-21T04:05:06","guid":{"rendered":"http:\/\/blog.xtaa.cn\/?p=332"},"modified":"2021-08-21T12:05:06","modified_gmt":"2021-08-21T04:05:06","slug":"332","status":"publish","type":"post","link":"http:\/\/blog.xtaa.cn\/index.php\/2021\/08\/21\/332\/","title":{"rendered":"centos\u7f51\u7edc\u547d\u4ee4"},"content":{"rendered":"\n<p>\u5728CentOS\u7cfb\u7edf\u4e0a\uff0c\u76ee\u524d\u6709NetworkManager\u548cnetwork\u4e24\u79cd\u7f51\u7edc\u7ba1\u7406\u5de5\u5177\u3002\u5982\u679c\u4e24\u79cd\u90fd\u914d\u7f6e\u4f1a\u5f15\u8d77\u51b2\u7a81\uff0c\u800c\u4e14NetworkManager\u5728\u7f51\u7edc\u65ad\u5f00\u7684\u65f6\u5019\uff0c\u4f1a\u6e05\u7406\u8def\u7531\uff0c\u5982\u679c\u4e00\u4e9b\u81ea\u5b9a\u4e49\u7684\u8def\u7531\uff0c\u6ca1\u6709\u52a0\u5165\u5230NetworkManager\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\uff0c\u8def\u7531\u5c31\u88ab\u6e05\u7406\u6389\uff0c\u7f51\u7edc\u8fde\u63a5\u540e\u9700\u8981\u81ea\u5b9a\u4e49\u6dfb\u52a0\u4e0a\u53bb\u3002<\/p>\n\n\n\n<p>\u76ee\u524d\u5728CentOS\u4e0a\u7684NetworkManager\u7248\u672c\u6bd4\u8f83\u4f4e\uff0c\u800c\u4e14\u6bd4\u8f83\u9002\u5408\u6709\u684c\u9762\u73af\u5883\u7684\u7cfb\u7edf\uff0c\u6240\u4ee5\u670d\u52a1\u5668\u4e0a\u4fdd\u7559network\u670d\u52a1\u5373\u53ef\uff0c\u5c06NetworkManager\u5173\u95ed\uff0c\u5e76\u4e14\u7981\u6b62\u5f00\u673a\u542f\u52a8\u3002<br><\/p>\n\n\n\n<p>systemd\u7ba1\u7406\u4e0a\uff1a<\/p>\n\n\n\n<p>systemctl status NetworkManager #\u67e5\u770b\u72b6\u6001<\/p>\n\n\n\n<p>systemctl stop NetworkManager<\/p>\n\n\n\n<p>systemctl disable NetworkManager #enable \u8868\u793a\u5f00\u673a\u81ea\u542f disable \u8868\u793a\u5f00\u542f\u4e0d\u542f\u52a8<br><\/p>\n\n\n\n<p>\u5982\u679cNetworkManager\u6ca1\u6709\u8fd0\u884c\uff0c\u5219\u53ef\u4ee5\u901a\u8fc7\u7b80\u5355\u8fd0\u884c\u6765\u542f\u52a8\u5b83\u3002<\/p>\n\n\n\n<p># systemctl start NetworkManager<\/p>\n\n\n\n<p><strong>\u505c\u6b62NetworkManager<\/strong><\/p>\n\n\n\n<p>\u8981\u51fa\u4e8e\u67d0\u79cd\u539f\u56e0\u505c\u6b62\u6216\u505c\u7528NetworkManager\uff0c\u8bf7\u53d1\u51fa\u4ee5\u4e0b\u547d\u4ee4\u3002<\/p>\n\n\n\n<p># systemctl stop NetworkManager<\/p>\n\n\n\n<p>\u542f\u7528NetworkManager\u540e\u6211\u4eec\u53ef\u4ee5\u7528\u4ee5\u4e0b\u56fe\u5f62\u547d\u4ee4\u6765\u914d\u7f6e\u7f51\u7edc<\/p>\n\n\n\n<p>nmtui<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>ifconfig  -a   \u67e5\u5904\u7f51\u7edc\u60c5\u51b5<\/p>\n\n\n\n<p>\u67e5\u770b\u7f51\u5173\u548c\u8def\u7531\u8868(\u8def\u7531\u5c31\u662f\u9009\u8def)<br>\u547d\u4ee4:route<\/p>\n\n\n\n<p>\u8ddf\u8e2a\u6570\u636e\u5305\u7684\u8f6c\u53d1\u8def\u5f84<br>\u547d\u4ee4\uff1atraceroute<\/p>\n\n\n\n<p>\u67e5\u770b\u7f51\u7edc\u8fde\u63a5\u72b6\u6001<br>\u547d\u4ee4\uff1anetstat<br>\u9009\u9879: -t tcp<br>-u udp<br>-p \u8fdb\u7a0b<br>-a \u6240\u6709<br>-n \u6570\u5b57\u5f62\u5f0f\u663e\u793a<\/p>\n\n\n\n<p>\u91cd\u542f\u7f51\u7edc\u670d\u52a1\u7684\u65b9\u6cd5<br>service network restart<\/p>\n\n\n\n<p>ifconfig eth0 up \uff08\u542f\u7528\u7f51\u5361\uff09    \u6216\u8005ifup  eth0<\/p>\n\n\n\n<p>ifconfig eth0 down \uff08\u7981\u7528\u7f51\u5361\uff09    \u6216\u8005 ifdown  eth0<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\t\u540c\u4e00\u4e2a\u7f51\u7edc\u63a5\u53e3\u53ef\u4ee5\u4f7f\u7528\u5b50\u63a5\u53e3\u7684\u65b9\u5f0f\u8bbe\u7f6e\u591a\u4e2aIP\u5730\u5740\n\t[root@centos ~]#\u00a0 ifconfig eno33554984:2 192.168.146.152 netmask 255.255.255.0 up\n\n\t\u5f53\u670d\u52a1\u5668\u91cd\u542f\u6216\u7f51\u7edc\u670d\u52a1\u91cd\u542f\u540e\uff0c\u5b50\u63a5\u53e3\u914d\u7f6e\u5c06\u6d88\u5931\uff0c\u5982\u9700\u91cd\u542f\u540e\u4f9d\u7136\u751f\u6548\uff0c\u53ef\u4ee5\u5c06\u914d\u7f6e\u5b50\u63a5\u53e3\u547d\u4ee4\u52a0\u5165\u5f00\u673a\u81ea\u52a8\u6267\u884c\u6587\u4ef6\/etc\/rc.local\u6587\u4ef6\u4e2d\u3002\n\n\uff08<strong>\u5982\u679c\u8bbe\u7f6e\u540e\u8fd8\u6ca1\u6709\u5f00\u673a\u81ea\u52a8\u6267\u884c\uff0c\u662f\u56e0\u4e3a\u6709\u7684centos\u7248\u672c\/etc\/rc.d\/rc.local\u6ca1\u6709\u6267\u884c\u6743\u9650\uff0c\u4e8e\u662f\u6267\u884c    chmod +x \/etc\/rc.d\/rc.local\u5c31\u53ef\u4ee5\u4e86<\/strong>)<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u4ee5\u4e0b\u770b\u4e0b\u5982\u4f55\u914d\u7f6e\u7f51\u5361\u56fa\u5b9aIP\u7b49<\/p>\n\n\n\n<p>\u4f8b\u5982\u7f51\u5361\u8bbe\u5907\u540d\u79f0\u4e3aeth0, \u7528vi\u547d\u4ee4\u7f16\u8f91\u7f51\u5361\u914d\u7f6e\u6587\u4ef6, \u8bbe\u7f6eIP\uff0c\u63a9\u7801\uff0c\u7f51\u5173\uff0cDNS\u3002\u5176\u4e2dNAME\u548cDEVICE \u540e\u9762\u7684\u540d\u5b57\u6309\u5b9e\u9645\u7684\u7f51\u5361\u540d\u5b57\u586b\u5199\u3002<\/p>\n\n\n\n<p># cd \/etc\/sysconfig\/network-scripts       <\/p>\n\n\n\n<p>\u7136\u540els     \u770b\u5230\u91cc\u9762\u6709\u7f51\u5361\u914d\u7f6e\u6587\u4ef6    ifcfg-eth0<\/p>\n\n\n\n<p># vi ifcfg-eth0<\/p>\n\n\n\n<p>\u6253\u5f00\u6587\u4ef6\u540e\u6309\u201ci\u201d\u952e\u5207\u6362\u81f3\u7f16\u8f91\u6a21\u5f0f\uff0c\u4fee\u6539\u4ee5\u4e0b\u76f8\u5173\u5185\u5bb9\uff0c\u6807\u989c\u8272\u7684\u90e8\u5206\u6309\u5b9e\u9645\u60c5\u51b5\u4fee\u6539\u3002\u7f16\u8f91\u5b8c\u6210\u540e\uff0c\u6309\u201dEsc\u201d\u9000\u51fa\u7f16\u8f91\u6a21\u5f0f\uff0c\u8f93\u5165\u201c: wq\u201d \u4fdd\u5b58\u9000\u51fa\u3002<\/p>\n\n\n\n<p>TYPE=Ethernet<\/p>\n\n\n\n<p>DEVICE=<strong>eth0<\/strong><\/p>\n\n\n\n<p>NAME=<strong>eth0<\/strong><\/p>\n\n\n\n<p><strong>BOOTPROTO=static<\/strong><\/p>\n\n\n\n<p><strong>ONBOOT=yes<\/strong><\/p>\n\n\n\n<p><strong>IPADDR=192.168.1.200<\/strong><\/p>\n\n\n\n<p><strong>NETMASK=255.255.255.0<\/strong><\/p>\n\n\n\n<p><strong>GATEWAY=192.168.1.1<\/strong><\/p>\n\n\n\n<p><strong>DNS1=114.114.114.114<\/strong><\/p>\n\n\n\n<p>\u4fee\u6539\u5b8c\u6210\u540e\u91cd\u542f\u7f51\u7edc\u670d\u52a1<\/p>\n\n\n\n<p># systemctl restart network<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728CentOS\u7cfb\u7edf\u4e0a\uff0c\u76ee\u524d\u6709NetworkManager\u548cnetwork\u4e24\u79cd\u7f51\u7edc\u7ba1\u7406\u5de5\u5177\u3002\u5982\u679c\u4e24\u79cd\u90fd\u914d\u7f6e\u4f1a\u5f15\u8d77 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22],"tags":[],"class_list":["post-332","post","type-post","status-publish","format-standard","hentry","category-22"],"_links":{"self":[{"href":"http:\/\/blog.xtaa.cn\/index.php\/wp-json\/wp\/v2\/posts\/332","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.xtaa.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.xtaa.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.xtaa.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.xtaa.cn\/index.php\/wp-json\/wp\/v2\/comments?post=332"}],"version-history":[{"count":0,"href":"http:\/\/blog.xtaa.cn\/index.php\/wp-json\/wp\/v2\/posts\/332\/revisions"}],"wp:attachment":[{"href":"http:\/\/blog.xtaa.cn\/index.php\/wp-json\/wp\/v2\/media?parent=332"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.xtaa.cn\/index.php\/wp-json\/wp\/v2\/categories?post=332"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.xtaa.cn\/index.php\/wp-json\/wp\/v2\/tags?post=332"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}