添加一块虚拟网卡
ifconfig
查看网卡device name,新建一个对应的配置文件vim /etc/sysconfig/network-script/ifcfg-name
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=ens34
DEVICE=ens34
ONBOOT=yes
IPADDR=192.168.10.100
NETMASK=255.255.255.0
这里使用vmnet01 host-only,所以不需要设置网关
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.80.200
netmask 255.255.255.0
broadcast 192.168.80.255
network 192.168.80.0
gateway 192.168.80.2
auto eth1
iface eth1 inet static
address 192.168.10.200
netmask 255.255.255
broadcast 192.168.10.255
原文:https://www.cnblogs.com/kikochz/p/13693852.html