centos 7设置IP
centos 7设置IP
setp1 进入配置文件
vi /etc/sysconfig/network-scripts/ifcfg-ens33
setp2 编辑
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=7e7bc1e8-a875-489a-9a24-89f9c0a5fa36
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.164.200
NETMASK=255.255.255.0
GATEWAY=192.168.164.123
DNS1=8.8.8.8
setp3 重启服务
systemctl restart network
setp4 查看IP
[root@localhost ~]# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:ab:1f:88 brd ff:ff:ff:ff:ff:ff
inet 192.168.164.200/24 brd 192.168.164.255 scope global noprefixroute ens33
valid_lft forever preferred_lft forever
inet6 fe80::cfac:d774:ef70:3e2f/64 scope link noprefixroute
valid_lft forever preferred_lft forever
[root@localhost ~]#