CentOS7下的网络设定方法

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

                       
 

CentOS7下,设定网络非常简单,如果你是ServerGUI的安装,基本上和windows一样简单的设定既可。如果是最小化安装也可以通过编辑一和设定/etc/sysconfig/network-scripts下面的文件,然后systemctl restart network既可起效。

设定文件

       
设定项目 设定详细
设定文件 /etc/sysconfig/network-scripts/ifcfg-eth0
 

ifcfg-eth0有的时候实际的名字可能类似于:ifcfg-eno16777736

设定内容实例

[root@host31 network-scripts]# cat ifcfg-eno16777736TYPE="Ethernet"BOOTPROTO="none"DEFROUTE="yes"IPV4_FAILURE_FATAL="no"IPV6INIT="yes"IPV6_AUTOCONF="yes"IPV6_DEFROUTE="yes"IPV6_FAILURE_FATAL="no"NAME="eth0"UUID="9b7e0728-7c25-46e7-b4e1-387ffeb5a66c"DEVICE="eno16777736"ONBOOT="yes"IPADDR="192.168.32.31"PREFIX="24"GATEWAY="192.169.32.2"DNS1="8.8.4.4"IPV6_PEERDNS="yes"IPV6_PEERROUTES="yes"IPV6_PRIVACY="no"[root@host31 network-scripts]#
   
   
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21

确定network状态

 

systemctl status network

[root@host31 network-scripts]# systemctl status network● network.service - LSB: Bring up/down networking   Loaded: loaded (/etc/rc.d/init.d/network)   Active: active (exited) since Sun 2016-08-07 11:46:54 EDT; 7h ago     Docs: man:systemd-sysv-generator(8)  Process: 8862 ExecStop=/etc/rc.d/init.d/network stop (code=exited, status=0/SUCCESS)  Process: 9025 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=0/SUCCESS)Aug 07 11:46:54 host31 systemd[1]: Starting LSB: Bring up/down networking...Aug 07 11:46:54 host31 network[9025]: Bringing up loopback interface:  Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'Aug 07 11:46:54 host31 network[9025]: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'Aug 07 11:46:54 host31 network[9025]: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'Aug 07 11:46:54 host31 network[9025]: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'Aug 07 11:46:54 host31 network[9025]: [  OK  ]Aug 07 11:46:54 host31 network[9025]: Bringing up interface eno16777736:  Connection successfully activated (D-Bus active path: /org/fre...ction/1)Aug 07 11:46:54 host31 network[9025]: [  OK  ]Aug 07 11:46:54 host31 systemd[1]: Started LSB: Bring up/down networking.Hint: Some lines were ellipsized, use -l to show in full.[root@host31 network-scripts]#
   
   
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19

重新启动network服务

 

systemctl restart network

           

给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow

这里写图片描述

猜你喜欢

转载自blog.csdn.net/sdfsdfytre/article/details/83535302
今日推荐