centos7配置固定ip
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE="Ethernet" PROXY_METHOD="none" BROWSER_ONLY="no" BOOTPROTO="static" DEFROUTE="yes" IPV4_FAILURE_FATAL="no" IPV6INIT="yes" IPV6_AUTOCONF="yes" IPV6_DEFROUTE="yes" IPV6_FAILURE_FATAL="no" IPV6_ADDR_GEN_MODE="stable-privacy" NAME="ens33" UUID="521d3c49-0c97-4d50-90d1-d6bbeec0dc10" DEVICE="ens33" ONBOOT="yes" IPADDR=192.168.1.250 NETMASK=255.255.255.0 GATEWAY=192.168.1.1 DNS1=114.114.114.114
注意下面几个配置项:
BOOTPROTO="static"
ONBOOT="yes"
#ip
IPADDR=192.168.1.250
NETMASK=255.255.255.0
#网关
GATEWAY=192.168.1.1
DNS1=114.114.114.114