centos7 固定ip配置
打开文件 cd /etc/sysconfig/network-scripts/
找到并编辑 vi ifcfg-enp0s3
TYPE="Ethernet"
BOOTPROTO="none"DEFROUTE="yes"
PEERDNS="yes"
PEERROUTES="yes"
IPV4_FAILURE_FATAL="yes"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="enp0s3"
UUID="28a31b91-b4ab-44d7-85b8-f7cadcb55"
DEVICE="enp0s3"
ONBOOT="yes"
DNS1="202.96.128.167"
DNS2="202.96.134.136"
IPADDR="192.168.1.116"
PREFIX="24"
GATEWAY="192.168.1.1"
保存退出 :wq
重启 service network restart