查看网络接口,默认都没有启动

# ls /etc/sysconfig/network-scripts/ifcfg-*
/etc/sysconfig/network-scripts/ifcfg-eno16780032  /etc/sysconfig/network-scripts/ifcfg-lo

修改网络接口配置文件

# vi /etc/sysconfig/network-scripts/ifcfg-eno16780032
TYPE=Ethernet
# 修改下面一行
BOOTPROTO=static

DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=eno16780032
UUID=5f4d2c36-d0ca-480c-951a-f402b0ce636b
DEVICE=eno16780032

# 修改下面一行
ONBOOT=yes

# 添加
IPADDR0=192.168.106.55
PREFIX0=24
GATEWAY0=192.168.106.1
DNS1=192.168.106.1

使更改生效

# service network restart

查看IP信息,ifconfig在CentOS 7中没有安装,可以使用ip命令

# ip addr

[ 编辑 | 历史 ]
最近由“jilili”在“2016-11-21 07:49:07”修改