我的电脑运行 3 台虚拟机:虚拟机(10.0.99.99),虚拟主机(10.0.99.11)和虚空(10.0.99.12)。设置如下:
当我从任何虚拟机 ping 我的物理主机 (10.0.99.1) 时,它可以找到它,但是当我从主机 ping 任何虚拟机时,主机会尝试 ping 互联网上的某台计算机(可能),因为虚拟机共享一个私有 IP 范围。我该如何解决这个问题?
我的主机有以下 IP 设置:
$ ip route show
default via 192.168.1.1 dev wlo1 proto static metric 600
10.0.99.0/24 dev vmnet99 proto kernel scope link src 10.0.99.1
172.16.8.0/24 dev vmnet1 proto kernel scope link src 172.16.8.1
172.16.33.0/24 dev vmnet8 proto kernel scope link src 172.16.33.1
192.168.1.0/24 dev wlo1 proto kernel scope link src 192.168.1.73 metric 600
$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp1s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
link/ether 3c:52:82:b9:05:5f brd ff:ff:ff:ff:ff:ff
3: wlo1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 3c:95:09:de:4e:8d brd ff:ff:ff:ff:ff:ff
inet 192.168.1.73/24 brd 192.168.1.255 scope global dynamic wlo1
valid_lft 82559sec preferred_lft 82559sec
inet6 fe80::6528:e383:1754:9aef/64 scope link
valid_lft forever preferred_lft forever
15: vmnet1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 1000
link/ether 00:50:56:c0:00:01 brd ff:ff:ff:ff:ff:ff
inet 172.16.8.1/24 brd 172.16.8.255 scope global vmnet1
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:fec0:1/64 scope link
valid_lft forever preferred_lft forever
16: vmnet8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 1000
link/ether 00:50:56:c0:00:08 brd ff:ff:ff:ff:ff:ff
inet 172.16.33.1/24 brd 172.16.33.255 scope global vmnet8
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:fec0:8/64 scope link
valid_lft forever preferred_lft forever
17: vmnet99: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 1000
link/ether 00:50:56:c0:00:63 brd ff:ff:ff:ff:ff:ff
inet 10.0.99.1/24 brd 10.0.99.255 scope global vmnet99
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:fec0:63/64 scope link
valid_lft forever preferred_lft forever
VMware虚拟网络管理器生成一个/etc/vmware/vmnet99/dhcpd/dhcpd.conf
包含以下内容的文件:
allow unknown-clients;
default-lease-time 1800; # default is 30 minutes
max-lease-time 7200; # default is 2 hours
subnet 10.0.99.0 netmask 255.255.255.0 {
range 10.0.99.128 10.0.99.254;
option broadcast-address 10.0.99.255;
option domain-name-servers 10.0.99.2;
option domain-name localdomain;
default-lease-time 1800; # default is 30 minutes
max-lease-time 7200; # default is 2 hours
option netbios-name-servers 10.0.99.2;
option routers 10.0.99.2;
}
host vmnet99 {
hardware ethernet 00:50:56:C0:00:63;
fixed-address 10.0.99.1;
option domain-name-servers 0.0.0.0;
option domain-name "";
option routers 0.0.0.0;
}