Microcharon 发表于 2025-2-16 11:41:46

Hyper

为什么会出现 ping 重复现象,怎么解决。不过在 Windows 虚拟机上进行 ping 操作就没问题,来个大佬帮帮忙看看哪里配置有问题

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

[*]Last login: Sun Feb 16 09:30:16 2025 from 192.168.137.1
[*]@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
[*]$ cat /etc/resolv.conf
[*]# Generated by NetworkManager
[*]search mshome.net
[*]nameserver 192.168.137.1
[*]$ ip addr show
[*]1: lo: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:
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:
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 具有 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 (::MaxValue)
[*]PreferredLifetime : Infinite (::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 (::MaxValue)
[*]PreferredLifetime : Infinite (::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.89192.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复制代码

Microcharon 发表于 2025-2-16 14:22:49


https://i.111666.best/image/hzKLeLA9PxPoCiSZpkhN55.png

[*]# tcpdump -i any icmp
[*]tcpdump: data link type LINUX_SLL2
[*]dropped privs to tcpdump
[*]tcpdump: verbose output suppressed, use -v... for full protocol decode
[*]listening on any, link-type LINUX_SLL2 (Linux cooked v2), snapshot length 262144 bytes
[*]14:14:58.472873 eth0Out IP localhost.localdomain > 20.205.243.166: ICMP echo request, id 5, seq 1, length 64
[*]14:14:58.581189 eth0InIP 20.205.243.166 > localhost.localdomain: ICMP echo reply, id 5, seq 1, length 64
[*]14:14:59.474350 eth0Out IP localhost.localdomain > 20.205.243.166: ICMP echo request, id 5, seq 2, length 64
[*]14:14:59.582625 eth0InIP 20.205.243.166 > localhost.localdomain: ICMP echo reply, id 5, seq 2, length 64
[*]14:15:00.475622 eth0Out IP localhost.localdomain > 20.205.243.166: ICMP echo request, id 5, seq 3, length 64
[*]14:15:00.571066 eth0InIP 20.205.243.166 > localhost.localdomain: ICMP echo reply, id 5, seq 3, length 64
[*]14:15:01.477195 eth0Out IP localhost.localdomain > 20.205.243.166: ICMP echo request, id 5, seq 4, length 64
[*]14:15:01.583919 eth0InIP 20.205.243.166 > localhost.localdomain: ICMP echo reply, id 5, seq 4, length 64复制代码
[*]$ 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 可扩展的虚拟交换机就好了,这是怎么回事,有无大佬解释一下

yanzhiling2002 发表于 2025-2-16 15:16:10

Hyper-V 虚拟交换机的负载均衡策略可能导致网络包重复
页: [1]
查看完整版本: Hyper