CentOS7下的网络设定方法
Posted firsttry
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS7下的网络设定方法相关的知识,希望对你有一定的参考价值。
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
[[email protected] 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.
[[email protected] 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下的网络设定方法的主要内容,如果未能解决你的问题,请参考以下文章
VirtualBox虚拟机下的CentOS7网络配置,内外网互通
Linux网络基础设定selinux/iptable/firewall
在Tomcat的安装目录下conf目录下的server.xml文件中增加一个xml代码片段,该代码片段中每个属性的含义与用途