码迷,mamicode.com
首页 > 其他好文 > 详细

CentOS7下的网络设定方法

时间:2018-12-10 14:21:48      阅读:296      评论:0      收藏:0      [点我收藏+]

标签:bootproto   system   generator   pre   cap   零基础   windows   ipa   not   

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-eno16777736
TYPE="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

再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!希望你也加入到我们人工智能的队伍中来!http://www.captainbed.net

CentOS7下的网络设定方法

标签:bootproto   system   generator   pre   cap   零基础   windows   ipa   not   

原文地址:https://www.cnblogs.com/firsttry/p/10095659.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!