嵌套虚拟化虚拟集群的网络配置

嵌套虚拟化虚拟集群的网络配置

我正在尝试使用 VirtualBox 实例配置一个虚拟集群,然后运行另一个虚拟机(该虚拟机使用 QEMU 创建)。

下图描述了当前设置,其中我的本地网络是 192.168.3.0/24,运行 VirtualBox 的计算机是 192.168.3.30:

在此处输入图片描述

在 VirtualBox 中,我启动了 2 台主机,它们在 VirtualBox 中配置了自己的内部网,并配有专用 NIC 连接到 NAT 网络 192.168.1.0/24。

虽然所有节点都在同一个网络 192.168.1.0/24 中,但是嵌套的客户机 (Vec) 无法与远程主机或 vecs(红色交叉线)通信,但同一主机内的 host-host 和 host-vec 可以通信。

我应该如何配置集群以使它们全部进行通信?

/etc/hosts

192.168.1.1   host1
192.168.1.101    vec1
192.168.1.2  host2
192.168.1.102    vec2
192.168.1.3   host3
192.168.1.103    vec3

主机1$ ifconfig

enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::a00:27ff:fe3e:1348  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:3e:13:48  txqueuelen 1000  (Ethernet)
        RX packets 58  bytes 4608 (4.5 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 156  bytes 10438 (10.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.3.2  netmask 255.255.255.0  broadcast 192.168.3.255
        inet6 fe80::e22:2cf6:8579:39a3  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:fa:c6:ca  txqueuelen 1000  (Ethernet)
        RX packets 1169  bytes 94446 (92.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1778  bytes 207624 (202.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.1  netmask 255.255.255.0  broadcast 0.0.0.0
        inet6 fe80::a00:27ff:fe3e:1348  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:3e:13:48  txqueuelen 1000  (Ethernet)
        RX packets 11  bytes 632 (632.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 29  bytes 1990 (1.9 KiB)
        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 155  bytes 13078 (12.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 155  bytes 13078 (12.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

tap0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::f81f:daff:fe5c:f05a  prefixlen 64  scopeid 0x20<link>
        ether fa:1f:da:5c:f0:5a  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2  bytes 144 (144.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

host1$ 路线

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         host1           0.0.0.0         UG    0      0        0 eth0
default         _gateway        0.0.0.0         UG    101    0        0 enp0s8
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
192.168.3.0     0.0.0.0         255.255.255.0   U     101    0        0 enp0s8

vec1$ ifconfig

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.2.15  netmask 255.255.255.0  broadcast 10.0.2.255
        inet6 fe80::99a6:f5d6:71e4:a028  prefixlen 64  scopeid 0x20<link>
        inet6 fec0::678f:ac2f:8ada:2d1b  prefixlen 64  scopeid 0x40<site>
        ether 52:54:00:12:34:56  txqueuelen 1000  (Ethernet)
        RX packets 65  bytes 9318 (9.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 109  bytes 12408 (12.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.101  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::3aca:9bbc:c0c2:b316  prefixlen 64  scopeid 0x20<link>
        ether 52:54:00:12:34:57  txqueuelen 1000  (Ethernet)
        RX packets 177  bytes 17301 (16.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 99  bytes 13429 (13.1 KiB)
        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 56  bytes 4308 (4.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 56  bytes 4308 (4.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vec1$ 路线

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         _gateway        0.0.0.0         UG    100    0        0 eth0
default         host1           0.0.0.0         UG    101    0        0 eth1
10.0.2.0        0.0.0.0         255.255.255.0   U     100    0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     101    0        0 eth1

host2$ ifconfig

enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::a00:27ff:fee0:d7cc  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:e0:d7:cc  txqueuelen 1000  (Ethernet)
        RX packets 1911  bytes 145413 (142.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1909  bytes 284175 (277.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.2  netmask 255.255.255.0  broadcast 0.0.0.0
        inet6 fe80::a00:27ff:fee0:d7cc  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:e0:d7:cc  txqueuelen 1000  (Ethernet)
        RX packets 1646  bytes 105269 (102.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1722  bytes 265083 (258.8 KiB)
        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 76  bytes 5018 (4.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 76  bytes 5018 (4.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

tap0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::f81f:daff:fe5c:f05a  prefixlen 64  scopeid 0x20<link>
        ether fa:1f:da:5c:f0:5a  txqueuelen 1000  (Ethernet)
        RX packets 75  bytes 8965 (8.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 105  bytes 12449 (12.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

host2$ 路线

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         host1           0.0.0.0         UG    0      0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0

vec2$ ifconfig

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.2.15  netmask 255.255.255.0  broadcast 10.0.2.255
        inet6 fe80::99a6:f5d6:71e4:a028  prefixlen 64  scopeid 0x20<link>
        inet6 fec0::678f:ac2f:8ada:2d1b  prefixlen 64  scopeid 0x40<site>
        ether 52:54:00:12:34:56  txqueuelen 1000  (Ethernet)
        RX packets 16  bytes 1888 (1.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 64  bytes 8654 (8.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.102  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::4e5e:dfc8:2e9f:6072  prefixlen 64  scopeid 0x20<link>
        ether 52:54:00:12:34:57  txqueuelen 1000  (Ethernet)
        RX packets 154  bytes 16347 (15.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 131  bytes 15713 (15.3 KiB)
        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 76  bytes 7162 (6.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 76  bytes 7162 (6.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vec2$ 路线

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         _gateway        0.0.0.0         UG    100    0        0 eth0
default         host1           0.0.0.0         UG    101    0        0 eth1
10.0.2.0        0.0.0.0         255.255.255.0   U     100    0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     101    0        0 eth1

相关内容