主机论坛

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 50|回复: 2

Hyper-V Linux 虚拟机 ping DUP 重复现象

[复制链接]

13

主题

1024

回帖

2685

积分

金牌会员

Rank: 6Rank: 6

积分
2685
发表于 2025-2-16 11:41:46 | 显示全部楼层 |阅读模式
为什么会出现 ping 重复现象,怎么解决。不过在 Windows 虚拟机上进行 ping 操作就没问题,来个大佬帮帮忙看看哪里配置有问题

在虚拟机 Rocky Linux (192.168.137.158) 上进行 ping

  1. Last login: Sun Feb 16 09:30:16 2025 from 192.168.137.1
  2. [microcharon@localhost ~]$ ping bing.com
  3. PING bing.com (13.107.21.200) 56(84) 比特的数据。
  4. 64 比特,来自 13.107.21.200 (13.107.21.200): icmp_seq=1 ttl=110 时间=36.6 毫秒
  5. 64 比特,来自 13.107.21.200 (13.107.21.200): icmp_seq=1 ttl=110 时间=36.6 毫秒 (DUP!)
  6. 64 比特,来自 13.107.21.200 (13.107.21.200): icmp_seq=2 ttl=110 时间=36.5 毫秒
  7. 64 比特,来自 13.107.21.200 (13.107.21.200): icmp_seq=2 ttl=110 时间=36.5 毫秒 (DUP!)
  8. 64 比特,来自 13.107.21.200 (13.107.21.200): icmp_seq=3 ttl=110 时间=36.4 毫秒
  9. 64 比特,来自 13.107.21.200 (13.107.21.200): icmp_seq=3 ttl=110 时间=36.4 毫秒 (DUP!)
  10. 64 比特,来自 13.107.21.200 (13.107.21.200): icmp_seq=4 ttl=110 时间=36.5 毫秒
  11. 64 比特,来自 13.107.21.200 (13.107.21.200): icmp_seq=4 ttl=110 时间=36.5 毫秒 (DUP!)
  12. ^C
  13. --- bing.com ping 统计 ---
  14. 已发送 4 个包, 已接收 4 个包, +4 重复, 0% packet loss, time 3004ms
  15. rtt min/avg/max/mdev = 36.445/36.516/36.645/0.076 ms
  16. [microcharon@localhost ~]$ cat /etc/resolv.conf
  17. # Generated by NetworkManager
  18. search mshome.net
  19. nameserver 192.168.137.1
  20. [microcharon@localhost ~]$ ip addr show
  21. 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
  22.     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
  23.     inet 127.0.0.1/8 scope host lo
  24.        valid_lft forever preferred_lft forever
  25.     inet6 ::1/128 scope host
  26.        valid_lft forever preferred_lft forever
  27. 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
  28.     link/ether 00:15:5d:20:83:16 brd ff:ff:ff:ff:ff:ff
  29.     inet 192.168.137.158/24 brd 192.168.137.255 scope global dynamic noprefixroute eth0
  30.        valid_lft 649695sec preferred_lft 649695sec
  31.     inet6 fe80::215:5dff:fe20:8316/64 scope link noprefixroute
  32.        valid_lft forever preferred_lft forever
  33. 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
  34.     link/ether 00:15:5d:20:83:29 brd ff:ff:ff:ff:ff:ff
  35.     inet 192.168.138.3/24 brd 192.168.138.255 scope global noprefixroute eth1
  36.        valid_lft forever preferred_lft forever
  37.     inet6 fe80::215:5dff:fe20:8329/64 scope link noprefixroute
  38.        valid_lft forever preferred_lft forever
复制代码


在 Windows Server 2025 (192.168.137.2) 上进行 ping

  1. PS C:\Users\Administrator> ping bing.com

  2. 正在 Ping bing.com [13.107.21.200] 具有 32 字节的数据:
  3. 来自 13.107.21.200 的回复: 字节=32 时间=38ms TTL=110
  4. 来自 13.107.21.200 的回复: 字节=32 时间=36ms TTL=110
  5. 来自 13.107.21.200 的回复: 字节=32 时间=37ms TTL=110
  6. 来自 13.107.21.200 的回复: 字节=32 时间=36ms TTL=110

  7. 13.107.21.200 的 Ping 统计信息:
  8.     数据包: 已发送 = 4 ,已接收 = 4 ,丢失 = 0 (0% 丢失),
  9. 往返行程的估计时间(以毫秒为单位):
  10.     最短 = 36ms ,最长 = 38ms ,平均 = 36ms
  11. PS C:\Users\Administrator> ipconfig

  12. Windows IP 配置


  13. 以太网适配器 以太网 4:

  14.    连接特定的 DNS 后缀 . . . . . . . :
  15.    本地链接 IPv6 地址. . . . . . . . : fe80::ff1f:adde:ba03:6d42%18
  16.    IPv4 地址 . . . . . . . . . . . . : 192.168.137.2
  17.    子网掩码  . . . . . . . . . . . . : 255.255.255.0
  18.    默认网关. . . . . . . . . . . . . : 192.168.137.1
复制代码

Hyper-V 创建的内部虚拟交换机“Internal Virtual Switch”,其网络适配器 IP 配置


  1. PS C:\Users\Administrator> Get-NetIPAddress -InterfaceAlias "vEthernet (Internal Virtual Switch)"


  2. IPAddress         : fe80::1d6f:a2ca:16b:bafb%4
  3. InterfaceIndex    : 4
  4. InterfaceAlias    : vEthernet (Internal Virtual Switch)
  5. AddressFamily     : IPv6
  6. Type              : Unicast
  7. PrefixLength      : 64
  8. PrefixOrigin      : WellKnown
  9. SuffixOrigin      : Link
  10. AddressState      : Preferred
  11. ValidLifetime     : Infinite ([TimeSpan]::MaxValue)
  12. PreferredLifetime : Infinite ([TimeSpan]::MaxValue)
  13. SkipAsSource      : False
  14. PolicyStore       : ActiveStore

  15. IPAddress         : 192.168.137.1
  16. InterfaceIndex    : 4
  17. InterfaceAlias    : vEthernet (Internal Virtual Switch)
  18. AddressFamily     : IPv4
  19. Type              : Unicast
  20. PrefixLength      : 24
  21. PrefixOrigin      : Manual
  22. SuffixOrigin      : Manual
  23. AddressState      : Preferred
  24. ValidLifetime     : Infinite ([TimeSpan]::MaxValue)
  25. PreferredLifetime : Infinite ([TimeSpan]::MaxValue)
  26. SkipAsSource      : False
  27. PolicyStore       : ActiveStore
复制代码
  1. PS C:\Users\Administrator> Get-VMNetworkAdapter -VMName "Rocky Linux 9" | Select VMName,Name,MacAddress,IPAddresses

  2. VMName        Name       MacAddress   IPAddresses
  3. ------        ----       ----------   -----------
  4. Rocky Linux 9 网络适配器 00155D208316 {192.168.137.158, fe80::215:5dff:fe20:8316}
  5. Rocky Linux 9 网络适配器 00155D208329 {192.168.138.3, fe80::215:5dff:fe20:8329}
复制代码


DHCP 相关配置

  1. PS C:\Users\Administrator> Get-DhcpServerv4Scope

  2. ScopeId         SubnetMask      Name           State    StartRange      EndRange        LeaseDuration
  3. -------         ----------      ----           -----    ----------      --------        -------------
  4. 192.168.137.0   255.255.255.0   Internal Vi... Active   192.168.137.2   192.168.137.254 8.00:00:00

  5. PS C:\Users\Administrator> Get-DhcpServerv4Lease -ScopeId 192.168.137.0

  6. IPAddress       ScopeId         ClientId             HostName             AddressState         LeaseExpiryTime
  7. ---------       -------         --------             --------             ------------         ---------------
  8. 192.168.137.2   192.168.137.0   00-15-5d-20-83-09    WIN-LBFVIUCFGHO      Active               2025/2/23 23:06:34
  9. 192.168.137.3   192.168.137.0   5d-20-83-1d-00-01...                      Active               2025/2/23 23:06:31
  10. 192.168.137.89  192.168.137.0   00-15-5d-20-83-0b                         Active               2025/2/23 23:06:34
  11. 192.168.137.133 192.168.137.0   00-15-5d-20-83-05    debian               Active               2025/2/23 23:06:31
  12. 192.168.137.158 192.168.137.0   00-15-5d-20-83-16                         Active               2025/2/23 23:06:29
  13. 192.168.137.167 192.168.137.0   00-15-5d-20-83-0d    localhost            Active               2025/2/23 23:06:49
  14. 192.168.137.227 192.168.137.0   00-15-5d-20-83-0c                         Active               2025/2/23 23:06:34

  15. PS C:\Users\Administrator> Get-DhcpServerv4OptionValue -ScopeId 192.168.137.0

  16. OptionId   Name            Type       Value                VendorClass     UserClass       PolicyName
  17. --------   ----            ----       -----                -----------     ---------       ----------
  18. 51         租约            DWord      {691200}
  19. 3          路由器          IPv4Add... {192.168.137.1}
  20. 6          DNS 服务器      IPv4Add... {192.168.137.1}
复制代码


DNS 转发器设置

  1. PS C:\Users\Administrator> Get-DnsServerForwarder

  2. UseRootHint        : True
  3. Timeout(s)         : 3
  4. EnableReordering   : True
  5. IPAddress          : {119.29.29.29, 223.5.5.5}
  6. ReorderedIPAddress : {119.29.29.29, 223.5.5.5}
复制代码


NAT 网络配置

  1. PS C:\Users\Administrator> Get-NetNat


  2. Name                             : Primary-NAT
  3. ExternalIPInterfaceAddressPrefix :
  4. InternalIPInterfaceAddressPrefix : 192.168.137.0/24
  5. IcmpQueryTimeout                 : 30
  6. TcpEstablishedConnectionTimeout  : 1800
  7. TcpTransientConnectionTimeout    : 120
  8. TcpFilteringBehavior             : AddressDependentFiltering
  9. UdpFilteringBehavior             : AddressDependentFiltering
  10. UdpIdleSessionTimeout            : 120
  11. UdpInboundRefresh                : False
  12. Store                            : Local
  13. Active                           : True
复制代码
回复

使用道具 举报

13

主题

1024

回帖

2685

积分

金牌会员

Rank: 6Rank: 6

积分
2685
 楼主| 发表于 2025-2-16 14:22:49 | 显示全部楼层


  1. [root@localhost ~]# tcpdump -i any icmp
  2. tcpdump: data link type LINUX_SLL2
  3. dropped privs to tcpdump
  4. tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
  5. listening on any, link-type LINUX_SLL2 (Linux cooked v2), snapshot length 262144 bytes
  6. 14:14:58.472873 eth0  Out IP localhost.localdomain > 20.205.243.166: ICMP echo request, id 5, seq 1, length 64
  7. 14:14:58.581189 eth0  In  IP 20.205.243.166 > localhost.localdomain: ICMP echo reply, id 5, seq 1, length 64
  8. 14:14:59.474350 eth0  Out IP localhost.localdomain > 20.205.243.166: ICMP echo request, id 5, seq 2, length 64
  9. 14:14:59.582625 eth0  In  IP 20.205.243.166 > localhost.localdomain: ICMP echo reply, id 5, seq 2, length 64
  10. 14:15:00.475622 eth0  Out IP localhost.localdomain > 20.205.243.166: ICMP echo request, id 5, seq 3, length 64
  11. 14:15:00.571066 eth0  In  IP 20.205.243.166 > localhost.localdomain: ICMP echo reply, id 5, seq 3, length 64
  12. 14:15:01.477195 eth0  Out IP localhost.localdomain > 20.205.243.166: ICMP echo request, id 5, seq 4, length 64
  13. 14:15:01.583919 eth0  In  IP 20.205.243.166 > localhost.localdomain: ICMP echo reply, id 5, seq 4, length 64
复制代码

  1. [microcharon@localhost ~]$ ping github.com
  2. PING github.com (20.205.243.166) 56(84) 比特的数据。
  3. 64 比特,来自 20.205.243.166 (20.205.243.166): icmp_seq=1 ttl=108 时间=108 毫秒
  4. 64 比特,来自 20.205.243.166 (20.205.243.166): icmp_seq=2 ttl=108 时间=108 毫秒
  5. 64 比特,来自 20.205.243.166 (20.205.243.166): icmp_seq=3 ttl=108 时间=95.5 毫秒
  6. 64 比特,来自 20.205.243.166 (20.205.243.166): icmp_seq=4 ttl=108 时间=107 毫秒
  7. ^C
  8. --- github.com ping 统计 ---
  9. 已发送 4 个包, 已接收 4 个包, 0% packet loss, time 3004ms
  10. rtt min/avg/max/mdev = 95.482/104.727/108.349/5.375 ms
复制代码


关闭这个 Hyper-V 可扩展的虚拟交换机就好了,这是怎么回事,有无大佬解释一下
回复

使用道具 举报

249

主题

2518

回帖

7031

积分

论坛元老

Rank: 8Rank: 8

积分
7031
发表于 2025-2-16 15:16:10 | 显示全部楼层
Hyper-V 虚拟交换机的负载均衡策略可能导致网络包重复
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|主机论坛

GMT+8, 2025-2-25 04:04 , Processed in 0.059536 second(s), 18 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表