Virtual machine CentOS7 fixed IP address

BACKGROUND: Use centos7 vmware installation system, network connection using a bridge mode . Boot, to networking, but ip is not fixed.

1. Check the card information ifconfig

2. Modify the NIC configuration file

vim vi /etc/sysconfig/network-scripts/ifcfg-ens33

修改或添加了 标*
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO=static  *
IPADDR=192.168.0.193  *
NETMASK=255.255.255.0  *
GATEWAY=192.168.0.1   *
DNS1=221.5.88.88     *
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="0a4d802b-b009-41a9-bc4c-bab733114730"
DEVICE="ens33"
ONBOOT="yes"
IPV6_PRIVACY="no"

You can see, BOOTPROTO as a dhcp , dynamic allocation of IP addresses, now take it into static
at the same time, you need to set the IP address, gateway, subnet mask, DNS

The final card configuration information is as follows

Check ifconfig again

3. Network Service Restart

systemctl restart network

 

Published 264 original articles · won praise 46 · views 370 000 +

Guess you like

Origin blog.csdn.net/qq_27229113/article/details/103197409