我们在一台 ESX 服务器上安装了两台 CentOS VM。IP 和路由配置已完成
使用虚拟机之间的连接检查netcat
失败
在 VM1 上
[root@vm1 ~]# nc -4lv 7001
Ncat: Version 7.70 ( https://nmap.org/ncat )
Ncat: Listening on 0.0.0.0:7001
在 VM2 上
[root@vm2 ~]# nc -4v 10.85.41.126 7001
Ncat: Version 7.70 ( https://nmap.org/ncat )
Ncat: No route to host.
但 ping 可以
[root@vm2 ~]# ping 10.85.41.126
PING 10.85.41.126 (10.85.41.126) 56(84) bytes of data.
64 bytes from 10.85.41.126: icmp_seq=1 ttl=64 time=0.216 ms
VM1 的信息
[root@vm1 ~]# ip addr
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: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:50:56:b5:8a:ea brd ff:ff:ff:ff:ff:ff
inet 10.85.41.126/21 brd 10.85.47.255 scope global noprefixroute ens192
valid_lft forever preferred_lft forever
inet6 2001:db8:1:0:250:56ff:feb5:8aea/64 scope global dynamic noprefixroute
valid_lft 86386sec preferred_lft 14386sec
inet6 fe80::250:56ff:feb5:8aea/64 scope link noprefixroute
valid_lft forever preferred_lft forever
[root@vm1 ~]# iptables -L -v -n
Chain INPUT (policy ACCEPT 3218K packets, 2240M bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 719K packets, 48M bytes)
pkts bytes target prot opt in out source destination
VM2 的信息
[root@vm2 ~]# ip addr
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: ens192: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:50:56:b5:1d:0e brd ff:ff:ff:ff:ff:ff
inet 10.85.41.127/21 brd 10.85.47.255 scope global noprefixroute ens192
valid_lft forever preferred_lft forever
inet6 2001:db8:1:0:250:56ff:feb5:1d0e/64 scope global dynamic noprefixroute
valid_lft 86386sec preferred_lft 14386sec
inet6 fe80::250:56ff:feb5:1d0e/64 scope link noprefixroute
valid_lft forever preferred_lft forever
[root@vm2 ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.85.40.1 0.0.0.0 UG 100 0 0 ens192
10.85.40.0 0.0.0.0 255.255.248.0 U 100 0 0 ens192
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
[root@vm2 ~]# iptables -L -v -n
Chain INPUT (policy ACCEPT 1119K packets, 1144M bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 96234 packets, 6592K bytes)
pkts bytes target prot opt in out source destination
[root@vm2 ~]# ip ne
10.85.40.2 dev ens192 lladdr 50:eb:1a:a7:39:2a STALE
10.85.41.126 dev ens192 lladdr 00:50:56:b5:8a:ea STALE
<SNIP>
可能缺少什么?