为什么会出现 ping 重复现象,怎么解决。不过在 Windows 虚拟机上进行 ping 操作就没问题,来个大佬帮帮忙看看哪里配置有问题
在虚拟机 Rocky Linux (192.168.137.158) 上进行 ping
Last login: Sun Feb 16 09:30:16 2025 from 192.168.137.1
[microcharon@localhost ~]$ ping bing.com
PING bing.com (13.107.21.200) 56(84) 比特的数据。
64 比特,来自 13.107.21.200 (13.107.21.200): icmp_seq=1 ttl=110 时间=36.6 毫秒
64 比特,来自 13.107.21.200 (13.107.21.200): icmp_seq=1 ttl=110 时间=36.6 毫秒 (DUP!)
64 比特,来自 13.107.21.200 (13.107.21.200): icmp_seq=2 ttl=110 时间=36.5 毫秒
64 比特,来自 13.107.21.200 (13.107.21.200): icmp_seq=2 ttl=110 时间=36.5 毫秒 (DUP!)
64 比特,来自 13.107.21.200 (13.107.21.200): icmp_seq=3 ttl=110 时间=36.4 毫秒
64 比特,来自 13.107.21.200 (13.107.21.200): icmp_seq=3 ttl=110 时间=36.4 毫秒 (DUP!)
64 比特,来自 13.107.21.200 (13.107.21.200): icmp_seq=4 ttl=110 时间=36.5 毫秒
64 比特,来自 13.107.21.200 (13.107.21.200): icmp_seq=4 ttl=110 时间=36.5 毫秒 (DUP!)
^C
--- bing.com ping 统计 ---
已发送 4 个包, 已接收 4 个包, +4 重复, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 36.445/36.516/36.645/0.076 ms
[microcharon@localhost ~]$ cat /etc/resolv.conf
# Generated by NetworkManager
search mshome.net
nameserver 192.168.137.1
[microcharon@localhost ~]$ 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: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:15:5d:20:83:16 brd ff:ff:ff:ff:ff:ff
inet 192.168.137.158/24 brd 192.168.137.255 scope global dynamic noprefixroute eth0
valid_lft 649695sec preferred_lft 649695sec
inet6 fe80::215:5dff:fe20:8316/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:15:5d:20:83:29 brd ff:ff:ff:ff:ff:ff
inet 192.168.138.3/24 brd 192.168.138.255 scope global noprefixroute eth1
valid_lft forever preferred_lft forever
inet6 fe80::215:5dff:fe20:8329/64 scope link noprefixroute
valid_lft forever preferred_lft forever
在 Windows Server 2025 (192.168.137.2) 上进行 ping
PS C:\Users\Administrator> ping bing.com
正在 Ping bing.com [13.107.21.200] 具有 32 字节的数据:
来自 13.107.21.200 的回复: 字节=32 时间=38ms TTL=110
来自 13.107.21.200 的回复: 字节=32 时间=36ms TTL=110
来自 13.107.21.200 的回复: 字节=32 时间=37ms TTL=110
来自 13.107.21.200 的回复: 字节=32 时间=36ms TTL=110
13.107.21.200 的 Ping 统计信息:
数据包: 已发送 = 4 ,已接收 = 4 ,丢失 = 0 (0% 丢失),
往返行程的估计时间(以毫秒为单位):
最短 = 36ms ,最长 = 38ms ,平均 = 36ms
PS C:\Users\Administrator> ipconfig
Windows IP 配置
以太网适配器 以太网 4:
连接特定的 DNS 后缀 . . . . . . . :
本地链接 IPv6 地址. . . . . . . . : fe80::ff1f:adde:ba03:6d42%18
IPv4 地址 . . . . . . . . . . . . : 192.168.137.2
子网掩码 . . . . . . . . . . . . : 255.255.255.0
默认网关. . . . . . . . . . . . . : 192.168.137.1
Hyper-V 创建的内部虚拟交换机“Internal Virtual Switch”,其网络适配器 IP 配置
PS C:\Users\Administrator> Get-NetIPAddress -InterfaceAlias "vEthernet (Internal Virtual Switch)"
IPAddress : fe80::1d6f:a2ca:16b:bafb%4
InterfaceIndex : 4
InterfaceAlias : vEthernet (Internal Virtual Switch)
AddressFamily : IPv6
Type : Unicast
PrefixLength : 64
PrefixOrigin : WellKnown
SuffixOrigin : Link
AddressState : Preferred
ValidLifetime : Infinite ([TimeSpan]::MaxValue)
PreferredLifetime : Infinite ([TimeSpan]::MaxValue)
SkipAsSource : False
PolicyStore : ActiveStore
IPAddress : 192.168.137.1
InterfaceIndex : 4
InterfaceAlias : vEthernet (Internal Virtual Switch)
AddressFamily : IPv4
Type : Unicast
PrefixLength : 24
PrefixOrigin : Manual
SuffixOrigin : Manual
AddressState : Preferred
ValidLifetime : Infinite ([TimeSpan]::MaxValue)
PreferredLifetime : Infinite ([TimeSpan]::MaxValue)
SkipAsSource : False
PolicyStore : ActiveStore
PS C:\Users\Administrator> Get-VMNetworkAdapter -VMName "Rocky Linux 9" | Select VMName,Name,MacAddress,IPAddresses
VMName Name MacAddress IPAddresses
------ ---- ---------- -----------
Rocky Linux 9 网络适配器 00155D208316 {192.168.137.158, fe80::215:5dff:fe20:8316}
Rocky Linux 9 网络适配器 00155D208329 {192.168.138.3, fe80::215:5dff:fe20:8329}
DHCP 相关配置
PS C:\Users\Administrator> Get-DhcpServerv4Scope
ScopeId SubnetMask Name State StartRange EndRange LeaseDuration
------- ---------- ---- ----- ---------- -------- -------------
192.168.137.0 255.255.255.0 Internal Vi... Active 192.168.137.2 192.168.137.254 8.00:00:00
PS C:\Users\Administrator> Get-DhcpServerv4Lease -ScopeId 192.168.137.0
IPAddress ScopeId ClientId HostName AddressState LeaseExpiryTime
--------- ------- -------- -------- ------------ ---------------
192.168.137.2 192.168.137.0 00-15-5d-20-83-09 WIN-LBFVIUCFGHO Active 2025/2/23 23:06:34
192.168.137.3 192.168.137.0 5d-20-83-1d-00-01... Active 2025/2/23 23:06:31
192.168.137.89 192.168.137.0 00-15-5d-20-83-0b Active 2025/2/23 23:06:34
192.168.137.133 192.168.137.0 00-15-5d-20-83-05 debian Active 2025/2/23 23:06:31
192.168.137.158 192.168.137.0 00-15-5d-20-83-16 Active 2025/2/23 23:06:29
192.168.137.167 192.168.137.0 00-15-5d-20-83-0d localhost Active 2025/2/23 23:06:49
192.168.137.227 192.168.137.0 00-15-5d-20-83-0c Active 2025/2/23 23:06:34
PS C:\Users\Administrator> Get-DhcpServerv4OptionValue -ScopeId 192.168.137.0
OptionId Name Type Value VendorClass UserClass PolicyName
-------- ---- ---- ----- ----------- --------- ----------
51 租约 DWord {691200}
3 路由器 IPv4Add... {192.168.137.1}
6 DNS 服务器 IPv4Add... {192.168.137.1}
DNS 转发器设置
PS C:\Users\Administrator> Get-DnsServerForwarder
UseRootHint : True
Timeout(s) : 3
EnableReordering : True
IPAddress : {119.29.29.29, 223.5.5.5}
ReorderedIPAddress : {119.29.29.29, 223.5.5.5}
NAT 网络配置
PS C:\Users\Administrator> Get-NetNat
Name : Primary-NAT
ExternalIPInterfaceAddressPrefix :
InternalIPInterfaceAddressPrefix : 192.168.137.0/24
IcmpQueryTimeout : 30
TcpEstablishedConnectionTimeout : 1800
TcpTransientConnectionTimeout : 120
TcpFilteringBehavior : AddressDependentFiltering
UdpFilteringBehavior : AddressDependentFiltering
UdpIdleSessionTimeout : 120
UdpInboundRefresh : False
Store : Local
Active : True
![]() |
1
dbg 3 天前
Linux 的 ping 命令输出中的 (DUP!) ,意思是 duplicate,表示收到了重复的 ICMP 回显应答( Echo Reply )包。估计你 Hyper-V 错误地桥接了多个虚拟网卡到同一物理网络。
|
2
ranaanna 3 天前
如果只是这一个 linux 虚拟机存在重复数据包,那么很大的概率是因为该虚拟机的网卡启用了混杂模式。是不是在这个虚拟机上用了某些抓包工具?
|
4
Cola98 3 天前
会不会是因为 mac 地址冲突了?
|
![]() |
5
Microcharon OP @dbg 
```bash [root@localhost ~]# tcpdump -i any icmp tcpdump: data link type LINUX_SLL2 dropped privs to tcpdump tcpdump: verbose output suppressed, use -v[v]... for full protocol decode listening on any, link-type LINUX_SLL2 (Linux cooked v2), snapshot length 262144 bytes 14:14:58.472873 eth0 Out IP localhost.localdomain > 20.205.243.166: ICMP echo request, id 5, seq 1, length 64 14:14:58.581189 eth0 In IP 20.205.243.166 > localhost.localdomain: ICMP echo reply, id 5, seq 1, length 64 14:14:59.474350 eth0 Out IP localhost.localdomain > 20.205.243.166: ICMP echo request, id 5, seq 2, length 64 14:14:59.582625 eth0 In IP 20.205.243.166 > localhost.localdomain: ICMP echo reply, id 5, seq 2, length 64 14:15:00.475622 eth0 Out IP localhost.localdomain > 20.205.243.166: ICMP echo request, id 5, seq 3, length 64 14:15:00.571066 eth0 In IP 20.205.243.166 > localhost.localdomain: ICMP echo reply, id 5, seq 3, length 64 14:15:01.477195 eth0 Out IP localhost.localdomain > 20.205.243.166: ICMP echo request, id 5, seq 4, length 64 14:15:01.583919 eth0 In IP 20.205.243.166 > localhost.localdomain: ICMP echo reply, id 5, seq 4, length 64 ``` ```bash [microcharon@localhost ~]$ ping github.com PING github.com (20.205.243.166) 56(84) 比特的数据。 64 比特,来自 20.205.243.166 (20.205.243.166): icmp_seq=1 ttl=108 时间=108 毫秒 64 比特,来自 20.205.243.166 (20.205.243.166): icmp_seq=2 ttl=108 时间=108 毫秒 64 比特,来自 20.205.243.166 (20.205.243.166): icmp_seq=3 ttl=108 时间=95.5 毫秒 64 比特,来自 20.205.243.166 (20.205.243.166): icmp_seq=4 ttl=108 时间=107 毫秒 ^C --- github.com ping 统计 --- 已发送 4 个包, 已接收 4 个包, 0% packet loss, time 3004ms rtt min/avg/max/mdev = 95.482/104.727/108.349/5.375 ms ``` 关闭这个 Hyper-V 可扩展的虚拟交换机就好了,这是怎么回事 |
6
bjfane 3 天前
不知道你的 hyper-v 的网络结构, 我的从宿主看只有一个 vEthernet (NAT) ,虚拟机 windows linux 都有,应该是多个网络?!
|