Here is the network configuration for my local centos7 virtual machine.

First go to /etc/sysconfig/network-scripts.

Then edit vi ifcfg-enp0s8 as follows:

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
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=enp0s8
UUID=3f2364ef-80ee-466e-ac3c-b98a6cb9364a
DEVICE=enp0s8
ONBOOT=yes
Copy the code

ONBOOT=no ONBOOT=yes

In addition, you need to modify ifcfg-ENp0S3. The revised content is as follows:

TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static IPADDR=192.168.56.20 METMASK=255.255.255.0 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=enp0s3 UUID=6f40447c-c3b2-4214-b0b1-c235923df496 DEVICE=enp0s3 ONBOOT=yesCopy the code

The main changes are as follows:

BOOTPROTO = static IPADDR = 192.168.56.20 METMASK = 255.255.255.0 ONBOOT = yesCopy the code

IPADDR is a static IP address. It needs to be within its own LAN.