通过 LAN 将虚拟机连接到具有 WAN 的虚拟机

通过 LAN 将虚拟机连接到具有 WAN 的虚拟机

使用 Esxi 6.7,我有两个客户机(每个客户机上都有 Debian 10)。Guest-1(VM-1)配置了这样的公共 IP,并连接到 WAN(互联网):

sudo nano /etc/network/interfaces

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo iface lo inet loopback


# The primary network interface
allow-hotplug ens192
iface ens192 inet static
    address xx.211.44.103/32
    netmask 255.255.255.0
    gateway yy.27.36.113
    dns-nameservers 8.8.8.8

Vm-1 已连接到互联网,没有问题。我需要在机器 Vm-1 和 Vm-2 之间配置本地网络,请告诉我如何为 Vm-1 添加辅助内部 IP并为 Vm-2 添加yy.27.36.151主内部 IP 。yy.27.36.152

我尝试过这个:在 Vm-1 中:

# The secondary network interface
allow-hotplug ens193
iface ens193 inet static
     address yy.27.36.151
     netmask 255.255.255.0
     gateway yy.27.36.113
     dns-nameservers 8.8.8.8

和 Vm-2:

# The primary network interface
allow-hotplug ens193
iface ens193 inet static
     address yy.27.36.152
     netmask 255.255.255.0
     gateway yy.27.36.113
     dns-nameservers 8.8.8.8

问题是辅助接口名称应该是什么?ens193以及如何配置每台机器?

sudo ifconfig -a
ens192: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet xx.211.44.103  netmask 255.255.255.0  broadcast xx.211.44.255
        inet6 fe80::20c:29ff:feca:ac60  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:ca:ac:60  txqueuelen 1000  (Ethernet)
        RX packets 11155  bytes 765883 (747.9 KiB)
        RX errors 0  dropped 12  overruns 0  frame 0
        TX packets 18254  bytes 2084561 (1.9 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

相关内容