1. nat(虚拟机访问互联网)
ifcfg-enp0s3
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="enp0s3"
UUID="716d334d-e815-489b-9528-da4d1531f54d"
DEVICE="enp0s3"
ONBOOT="yes"
2. host-only(虚拟机和主机互相通信)
ifcfg-enp0s8
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="enp0s8"
UUID="716d334d-e815-489b-9528-da4d1531f54d"
DEVICE="enp0s8"
ONBOOT="yes"
IPADDR="192.168.137.100"
NETMASK="255.255.255.0"
3.修改主机名
vim /etc/hostname
注意修改后重启虚拟机
网友评论