手动设置 KDNET 网络内核调试Setting Up KDNET Network Kernel Debugging Manually

调试工具的 Windows 支持通过网络内核调试。Debugging Tools for Windows supports kernel debugging over a network. 本主题介绍如何设置网络手动调试。This topic describes how to set up network debugging manually.

重要

设置手动调试网络是一个复杂和错误容易过程。Setting up a network debugging manually is a complex and error prone process. 若要设置网络自动调试,请参阅设置向上 KDNET 网络内核调试自动To set up network debugging automatically, see Setting Up KDNET Network Kernel Debugging Automatically. 使用 KDNET 实用工具是建议所有调试器的用户。Using the KDNET utility is strongly recommended for all debugger users.

运行调试器的计算机称为主机计算机,和正在调试的计算机称为目标计算机The computer that runs the debugger is called the host computer, and the computer being debugged is called the target computer. 在主计算机必须运行 Windows 7 或更高版本,并在目标计算机必须运行 Windows 8 或更高版本。The host computer must be running Windows 7 or later, and the target computer must be running Windows 8 or later.

调试在网络上具有以下优点相比于其他类型的连接调试。Debugging over a network has the following advantages compared to debugging over other types of connectivity.

  • 在主机和目标计算机可以是本地网络上的任意位置。The host and target computers can be anywhere on the local network.
  • 很容易地调试从一台主机计算机的多个目标计算机。It is easy to debug many target computers from one host computer.
  • 给定任意两台计算机,则很可能具有,同时将以太网适配器。Given any two computers, it is likely that they will both have Ethernet adapters. 它不太可能,因为它们都将拥有串行端口或者同时使用 1394年端口。It is less likely that they will both have serial ports or both have 1394 ports.
  • 网络调试是明显快于调试串行端口。Network debugging is significantly faster than serial port debugging.

支持的网络适配器Supported Network Adapters

主机计算机可以使用任何网络适配器,但在目标计算机必须使用的 Windows 调试工具支持的网络适配器。The host computer can use any network adapter, but the target computer must use a network adapter that is supported by Debugging Tools for Windows. 有关支持的网络适配器的列表,请参阅的 Windows 10 中的网络内核调试支持以太网 Nic对于 Windows 8.1 中的网络内核调试支持以太网 NicFor a list of supported network adapters, see Supported Ethernet NICs for Network Kernel Debugging in Windows 10 and Supported Ethernet NICs for Network Kernel Debugging in Windows 8.1.

安装用于 Windows 调试工具Install the Debugging Tools for Windows

确认主机系统上安装了调试工具的 Windows。Confirm that the Debugging Tools for Windows are installed on the host system. 有关下载和安装调试器工具的信息,请参阅的 Windows 中下载调试的工具For information on downloading and installing the debugger tools, see Download Debugging Tools for Windows.

确定主机计算机的 IP 地址Determining the IP Address of the Host Computer

使用以下过程之一来确定主机计算机的 IP 地址。Use one of the following procedures to determine the IP address of the host computer.

  1. 主计算机上打开命令提示符窗口并输入以下命令:On the host computer, open a Command Prompt window and enter the following command:

    ipconfig
    

    记下你想要用于调试的网络适配器的 IPv4 地址。Make a note of the IPv4 address of the network adapter that you intend to use for debugging.

  2. 在目标计算机上,打开命令提示符窗口并输入以下命令,其中YourIPAddress是主计算机的 IP 地址:On the target computer, open a Command Prompt window and enter the following command, where YourIPAddress is the IP address of the host computer:

    ping -4 <YourIPAddress>
    

选择用于网络调试的端口Choosing a Port for Network Debugging

选择将用于在主机和目标计算机上进行调试的端口号。Choose a port number that will be used for debugging on both the host and target computers. 可以选择从 49152 到 65535 之间的任意数量,建议的范围为 50000 50039。You can choose any number from 49152 through 65535, the recommended range is 50000 - 50039. 由调试器主机计算机上运行,将进行独占访问打开您选择的端口。The port that you choose will be opened for exclusive access by the debugger running on the host computer. 请务必选择不使用主机计算机上运行的任何其他应用程序的端口号。Take care to choose a port number that is not used by any other applications that run on the host computer.

请注意  可能通过公司的网络策略限制可用于网络调试的端口号的范围。Note  The range of port numbers that can be used for network debugging might be limited by your company's network policy. 没有办法指示从主计算机的限制是什么。There is no way to tell from the host computer what the limitations are. 若要确定你公司的策略是否限制可以用于调试的网络端口的范围,请咨询网络管理员。To determine whether your company's policy limits the range of ports that can be used for network debugging, check with your network administrators.

如果多台目标计算机连接到单个主机计算机时,每个连接必须具有唯一的端口号。If you connect several target computers to a single host computer, each connection must have a unique port number. 例如,100 台目标计算机连接到单个主机计算机时,您可以将端口 50000 分配给第一个连接、 端口 50001 到第二个连接,端口 50002 到第三个连接,依次类推。For example, if you connect 100 target computers to a single host computer, you can assign port 50000 to the first connection, port 50001 to the second connection, port 50002 to the third connection, and so on.

请注意  不同的主机计算机可以使用相同范围的端口 (通过 50099 50000) 连接到另一个 100 目标计算机。Note  A different host computer could use the same range of ports (50000 through 50099) to connect to another 100 target computers.

在目标计算机上安装的设置Setting Up the Target Computer

  1. 验证目标计算机具有支持的网络适配器。Verify that the target computer has a supported network adapter. 请参阅以下主题,获取详细信息。See these topics for more information.

  2. 受支持的适配器连接到网络集线器或切换使用相应的网络电缆。Connect the supported adapter to a network hub or switch using an appropriate network cable.

重要

使用 BCDEdit 以更改启动信息之前可能需要暂时挂起如 BitLocker 和安全引导测试 PC 上的 Windows 安全功能。Before using BCDEdit to change boot information you may need to temporarily suspend Windows security features such as BitLocker and Secure Boot on the test PC. 测试完成后重新启用这些安全功能和安全功能将被禁用时适当地管理测试 PC。Re-enable these security features when testing is complete and appropriately manage the test PC, when the security features are disabled.

  1. 在提升的命令提示符窗口,输入以下命令,其中w.x.y.z是主计算机的 IP 地址和n是所选的端口号:In an elevated Command Prompt window, enter the following commands, where w.x.y.z is the IP address of the host computer, and n is a port number of your choice:

    bcdedit /debug on
    
    bcdedit /dbgsettings net hostip:w.x.y.z port:n
    
  2. bcdedit将显示自动生成的密钥。bcdedit will display an automatically generated key. 复制密钥并将其存储在可移动存储设备上类似于 USB 闪存驱动器。Copy the key and store it on a removable storage device like a USB flash drive. 在主计算机上启动调试会话时,将需要密钥。You will need the key when you start a debugging session on the host computer.

    请注意  我们强烈建议你使用自动生成的密钥。Note  We strongly recommend that you use an automatically generated key. 但是,可以创建自己的密钥,如后面的"创建你自己的密钥"部分中所述。However, you can create your own key as described later in the "Creating Your Own Key" section.

  3. 如果在目标计算机中有多个网络适配器,使用设备管理器确定 PCI 总线、 设备和函数编号,为你想要用于调试的适配器。If there is more than one network adapter in the target computer, use Device Manager to determine the PCI bus, device, and function numbers for the adapter you want to use for debugging. 然后在提升的命令提示符窗口,输入以下命令,其中bd,并f是总线数、 设备数量和适配器的函数数量:Then in an elevated Command Prompt window, enter the following command, where b, d, and f are the bus number, device number, and function number of the adapter:

    bcdedit /set "{dbgsettings}" busparams b.d.f
    
  4. 附加内核调试程序之后,将重新启动目标 PC。The target PC will be rebooted after a kernel debugger is attached. 这将在下一部分中介绍。This is described in the next section.

请注意  如果你想要在目标计算机上安装 HYPER-V 角色,请参阅设置网络调试的虚拟机主机Note  If you intend to install the Hyper-V role on the target computer, see Setting Up Network Debugging of a Virtual Machine Host.

谨慎  如果目标计算机在扩展坞,并且必须是扩展坞的一部分的网络适配器启用网络调试,请不要删除计算机从扩展坞。Caution  If your target computer is in a docking station, and you have network debugging enabled for a network adapter that is part of the docking station, do not remove the computer from the docking station. 如果你需要从扩展坞中删除目标计算机,禁用内核调试第一个。If you need to remove the target computer from the docking station, disable kernel debugging first. 若要禁用内核调试目标计算机上,打开管理员命令提示符窗口并输入命令bcdedit /debug 关闭To disable kernel debugging on the target computer, open a Command Prompt window as Administrator and enter the command bcdedit /debug off. 重新启动目标计算机。Reboot the target computer.

启动调试会话Starting the Debugging Session

确认网络集线器或交换机使用相应的网络电缆的主机计算机的网络适配器。Confirm that the network adapter of the host computer to a network hub or switch using an appropriate network cable.

在主计算机上打开 WinDbg。On the host computer, open WinDbg. 文件菜单中,选择内核调试On the File menu, choose Kernel Debug. 在内核调试对话框中,打开Net选项卡。输入端口号和密钥。In the Kernel Debugging dialog box, open the Net tab. Enter your port number and key. 单击 “确定”Click OK.

您还可以启动会话使用 WinDbg 通过打开命令提示符窗口并输入以下命令,其中n是端口号和MyKey是由自动生成的密钥bcdedit目标计算机的设置时:You can also start a session with WinDbg by opening a Command Prompt window and entering the following command, where n is your port number and MyKey is the key that was automatically generated by bcdedit when you set up the target computer:

windbg -k net:port=<n>,key=<MyKey>

如果系统提示有关允许 WinDbg 能够通过防火墙访问端口,允许访问的端口的 WinDbg所有这三个的不同网络类型。If you are prompted about allowing WinDbg to access the port through the firewall, allow WinDbg to access the port for all three of the different network types.

使用 KDUsing KD

在主计算机上打开命令提示符窗口。On the host computer, open a Command Prompt window. 输入以下命令,其中n是端口号和MyKey是自动生成的密钥bcdedit目标计算机的设置时:Enter the following command, where n is your port number and MyKey is the key that was automatically generated by bcdedit when you set up the target computer:

kd -k net:port=<n>,key=<MyKey>

如果系统提示有关允许 WinDbg 能够通过防火墙访问端口,允许访问的端口的 WinDbg所有这三个的不同网络类型。If you are prompted about allowing WinDbg to access the port through the firewall, allow WinDbg to access the port for all three of the different network types.

重新启动目标 PCRestarting the Target PC

调试器已连接,并为正在等待连接、 重新启动目标计算机后。Once the debugger is connected, and waiting to connect, reboot the target computer. 不要重新启动 PC 的一种方法是使用此命令中的,从管理员命令提示符。One way to do restart the PC is to use this command, from an administrator's command prompt.

shutdown -r -t 0

重新启动目标时,应连接的主机操作系统中的调试器。When the target is restarted, the debugger in the host OS should connect.

连接到主机上的目标后,命中时中断调试器,可以开始调试。After connecting to the target on the host, hit break on your debugger and you can start debugging.

允许通过防火墙调试器Allowing the debugger through the firewall

当首次尝试建立调试连接的网络时,你可能会提示您允许通过防火墙调试应用程序 (WinDbg 或 KD) 访问。When you first attempt to establish a network debugging connection, you might be prompted to allow the debugging application (WinDbg or KD) access through the firewall. 客户端版本的 Windows 显示提示,但服务器版本的 Windows 不显示提示。Client versions of Windows display the prompt, but Server versions of Windows do not display the prompt. 应通过检查对应的框来响应提示所有这三个网络类型: 域、 专用和公共。You should respond to the prompt by checking the boxes for all three network types: domain, private, and public. 如果您不会收到提示时,或如果未选中对应的框提示时可用,则必须使用控制面板以允许通过防火墙进行访问。If you do not get the prompt, or if you did not check the boxes when the prompt was available, you must use Control Panel to allow access through the firewall. 打开Control Panel>系统和安全然后单击允许通过 Windows 防火墙的应用程序Open Control Panel > System and Security and click Allow an app through Windows Firewall. 在应用程序列表中,找到 Windows GUI 符号调试程序和 Windows 内核调试程序。In the list of applications, locate Windows GUI Symbolic Debugger and Windows Kernel Debugger. 使用复选框以允许通过防火墙这些两个应用程序。Use the check boxes to allow those two applications through the firewall. 重新启动调试应用程序 (WinDbg 或 KD)。Restart your debugging application (WinDbg or KD).

加密密钥Encryption key

若要使目标计算机安全,必须对不同主机和目标计算机之间移动的数据包进行加密。To keep the target computer secure, packets that travel between the host and target computers must be encrypted. 我们强烈建议你使用自动生成的加密密钥 (由bcdedit配置目标计算机时)。We strongly recommend that you use an automatically generated encryption key (provided by bcdedit when you configure the target computer). 网络调试使用指定为四个 64 位值,在基本 36,用句点分隔的一个 256 位密钥。Network debugging uses a 256-bit key that is specified as four 64-bit values, in base 36, separated by periods. 使用最多 13 个字符,可指定每个 64 位值。Each 64-bit value is specified by using up to 13 characters. 有效字符是字母 a 到 z 和 0 到 9 的数字。Valid characters are the letters a through z and the digits 0 through 9. 不允许使用特殊字符。Special characters are not allowed.

若要指定自己的密钥,请打开提升的命令提示符窗口在目标计算机上。To specify your own key, open an elevated Command Prompt window on the target computer. 输入以下命令,其中w.x.y.z是主计算机的 IP 地址和n是你的端口号,并密钥是你的密钥:Enter the following command, where w.x.y.z is the IP address of the host computer, and n is your port number, and Key is your key:

bcdedit /dbgsettings net hostip:w.x.y.z port:n key:Key

需要随时更改 dbgsettings 重新启动目标计算机。The target computer needs to be rebooted anytime the dbgsettings are changed.

疑难解答提示Troubleshooting Tips

调试应用程序必须允许通过防火墙Debugging application must be allowed through firewall

当首次尝试建立调试连接的网络时,你可能会提示您允许通过防火墙调试应用程序 (WinDbg 或 KD) 访问。When you first attempt to establish a network debugging connection, you might be prompted to allow the debugging application (WinDbg or KD) access through the firewall. 客户端版本的 Windows 显示提示,但服务器版本的 Windows 不显示提示。Client versions of Windows display the prompt, but Server versions of Windows do not display the prompt. 应通过检查对应的框来响应提示所有这三个网络类型: 域、 专用和公共。You should respond to the prompt by checking the boxes for all three network types: domain, private, and public. 如果您不会收到提示时,或如果未选中对应的框提示时可用,则必须使用控制面板以允许通过防火墙进行访问。If you do not get the prompt, or if you did not check the boxes when the prompt was available, you must use Control Panel to allow access through the firewall. 打开Control Panel>系统和安全然后单击允许通过 Windows 防火墙的应用程序Open Control Panel > System and Security and click Allow an app through Windows Firewall. 在应用程序列表中,找到Windows GUI 符号调试器Windows 内核调试程序In the list of applications, locate Windows GUI Symbolic Debugger and Windows Kernel Debugger. 使用复选框以允许通过防火墙这些两个应用程序。Use the check boxes to allow those two applications through the firewall. 向下滚动并单击确定,若要保存防火墙更改。Scroll down and click OK, to save the firewall changes. 重新启动调试器。Restart the debugger.

端口号必须在范围内允许的网络策略Port number must be in range allowed by network policy

可能通过公司的网络策略限制可用于网络调试的端口号的范围。The range of port numbers that can be used for network debugging might be limited by your company's network policy. 若要确定你公司的策略是否限制可以用于调试的网络端口的范围,请咨询网络管理员联系。To determine whether your company's policy limits the range of ports that can be used for network debugging, check with your network administrator. 在目标计算机上,打开管理员命令提示符窗口并输入命令bcdedit /dbgsettingsOn the target computer, open a Command Prompt window as Administrator and enter the command bcdedit /dbgsettings. 输出将类似于此。The output will be similar to this.

C:\> bcdedit /dbgsettings
key                     XXXXXX.XXXXX.XXXXX.XXXXX
debugtype               NET
hostip                  169.168.1.1
port                    50085
dhcp                    Yes
The operation completed successfully.

在上面的输出端口的值是 50085。In the preceding output, the value of port is 50085. 如果端口的值位于由网络管理员允许的范围外,输入以下命令,其中w.x.y.z是主计算机的 IP 地址和YourDebugPort是中的端口号允许的范围。If the value of port lies outside the range allowed by your network administrator, enter the following command, where w.x.y.z is the IP address of the host computer, and YourDebugPort is a port number in the allowed range.

bcdedit /dbgsettings net hostip:w.x.y.z port:YourDebugPort

更改目标计算机调试程序设置之后, 重新运行主机上使用新的端口设置,调试器,然后重新启动目标计算机。After changing the target machine debugger settings, rerun the debugger on the host machine with the new port setting, and then reboot the target computer.

使用 Ping 测试连接性Use Ping to test connectivity

如果调试器不会连接使用在目标电脑上的 ping 命令来验证连接。If the debugger does not connect use the ping command on the target PC to verify connectivity.

C:\>Ping <HostComputerIPAddress>

请注意,这可能无法正常是否在主计算机未配置为在网络上发现的因为防火墙可能阻止 ping 请求,并正因为如此,则不会获得任何响应时成功进行 ping 操作主机。Note that this may not work if your host computer is not configured to be discoverable on the network, since the firewall may block ping requests, and because of this, you will not get any responses when you ping the host.

调试器如何获取 IP 地址为目标计算机How the Debugger Obtains an IP Address for the Target Computer

在目标计算机上的 KDNET 尝试使用动态主机配置协议 (DHCP) 来获取的可路由的 IP 地址的正用于调试的网络适配器。KDNET on the target computer attempts to use Dynamic Host Configuration Protocol (DHCP) to get a routable IP address for the network adapter that is being used for debugging. 如果 KDNET 获取 DHCP 分配地址,则可以通过主机计算机位于网络上的任意位置调试目标计算机。If KDNET obtains a DHCP-assigned address, then the target computer can be debugged by host computers located anywhere on the network. 如果 KDNET 无法获取 DHCP 分配地址,它使用自动专用 IP 寻址 (APIPA) 来获取本地链路 IP 地址。If KDNET fails to obtain a DHCP-assigned address, it uses Automatic Private IP Addressing (APIPA) to obtain a local link IP address. 链接本地 IP 地址不是可路由,因此主机和目标不能使用本地链路 IP 地址通过路由器进行通信。Local link IP addresses are not routable, so a host and target cannot use a local link IP address to communicate through a router. 在这种情况下,在网络调试将工作,如果主机和目标将计算机插头插入到同一个网络集线器或交换机。In that case, network debugging will work if you plug the host and target computers into the same network hub or switch.

PCI 的物理计算机上设置 KDNET 基于 NIC 时,始终指定 busparamsAlways specify busparams when setting up KDNET on a physical machine with a PCI based NIC

如果您设置了 KDNET PCI 的物理计算机上或 PCIe 基于 NIC,您应始终指定 busparams 想要用于 KDNET 的 nic。If you are setting up KDNET on a physical machine with a PCI or PCIe based NIC, you should always specify the busparams for the NIC you want to use for KDNET. 若要指定总线参数,打开设备管理器,并找到你想要用于调试的网络适配器。To specify the bus parameters, Open Device Manager, and locate the network adapter that you want to use for debugging. 打开的网络适配器,属性页,并记下总线编号、 设备数量和函数编号。Open the property page for the network adapter, and make a note of the bus number, device number, and function number. 在提升的命令提示符窗口,输入以下命令,其中bd,并f是十进制格式的总线、 设备和函数编号:In an elevated Command Prompt Window, enter the following command, where b, d, and f are the bus, device and function numbers in decimal format:

bcdedit /set "{dbgsettings}" busparams b.d.f

当调试器主机计算机上运行,等待连接,请重新启动目标计算机中,使用此命令。When the debugger is running on the host machine, and waiting to connect, reboot the target computer, using this command.

shutdown -r -t 0

手动删除 BCDEdit 条目Manually delete BCDEdit entries

手动删除不是通常情况下必需的但此处提供了在故障排除过程中的异常情况。Manually deleting is not normally required but is provided here as a troubleshooting procedure for unusual situations.

使用 kdnet 实用工具时,手动删除的项不需要。Manually deleting entries is not necessary when using the kdnet utility. 有关详细信息,请参阅设置向上 KDNET 网络内核调试自动For more information, see Setting Up KDNET Network Kernel Debugging Automatically.

当使用 bcdedit – deletevalue 是,必须提供一个有效的 bcd 的元素名称。When you use bcdedit –deletevalue, you must provide a valid bcd element name. 有关详细信息,请参阅BCDEdit /deletevalueFor more information, see BCDEdit /deletevalue.

若要手动删除 BCDEdit 条目,请完成以下步骤。To manually delete BCDEdit entries, complete these steps.

  1. 在目标计算机上,以管理员身份打开命令提示符窗口。On the target computer, open a Command Prompt window as Administrator.

  2. 例如,输入以下命令以删除调试主机 IP 地址条目 BCDEdit。As an example, enter this command to delete the BCDEdit debugging entry for the host IP address.

    bcdedit -deletevalue {dbgsettings} hostip
    

删除主机时,需要指定目标 = 调试器命令行上。When you delete the hostip, you need to specify target= on the debugger command line.

  1. 作为另一个示例中,删除将使用此命令的端口条目。As another example, delete the port entry using this command.

    bcdedit -deletevalue {dbgsettings} port
    

当删除端口条目时,KDNET 将使用 5364 默认 ICANN 注册调试程序端口。When you delete the port entry, KDNET will use the default ICANN registered debugger port of 5364.

Hyper-VHyper-V

设置的 HYPER-VSetting up Hyper-V

如果你想要在目标计算机上安装 HYPER-V 角色,请参阅设置网络调试的虚拟机主机If you intend to install the Hyper-V role on the target computer, see Setting Up Network Debugging of a Virtual Machine Host.

有关调试的 hyper-v 虚拟机 (VM) 的信息,请参阅设置网络调试的虚拟机-KDNETFor information on debugging a hyper-v Virtual Machine (VM), see Setting Up Network Debugging of a Virtual Machine - KDNET.

使用外部网络连接运行 Vm 的 hyper-v 主机上启用 KDNETEnabling KDNET on a hyper-v host that is running VMs with external network connectivity

没有特定的情况下,这并不少见,这将导致网络中虚拟机停止工作:There is a specific situation, which is not uncommon, which will cause networking in VMs to stop working:

  • 已在电脑上启用 HYPER-V、 外部网络交换机已创建并指向在计算机中,物理 NIC 和 Vm 已配置为其网络中使用该外部交换机。Hyper-V has been enabled on the PC, an external networking switch has been created and is pointed at a physical NIC in the machine, and VMs have been configured to use that external switch for their networking.

  • 上的 hyper-v 主机操作系统使用的相同的物理 NIC 指向的外部网络交换机,然后启用 KDNET 并重新启动主机。KDNET is then enabled on the hyper-v host OS using the same physical NIC that is pointed to by the external networking switch, and the host is rebooted.

  • 在重新启动后丢失其网络连接性的所有 Vm 在使用以前配置的外部交换机。All of the VMs that were using the previously configured external switch, lose their network connectivity after the reboot.

这是设计使然,并发生异常的原因 KDNET 采用排他控制其配置为使用的 NIC 和本机 NDIS 微型端口 NIC 未加载操作系统。This is by design, and happens because KDNET takes exclusive control over the NIC it is configured to use, and the native NDIS miniport for that NIC is not loaded by the OS. 此操作时,外部网络交换机不再能够与本机 NDIS 微型端口驱动程序,并将停止工作。When this occurs, the external networking switch can no longer communicate with the native NDIS miniport driver, and will stop working. 若要解决这种情况下,请执行以下操作:To work around this situation, do the following:

  1. 打开虚拟交换机管理器从 HYPER-V 管理器中,选择你的现有虚拟交换机和更改的外部网络 NIC Microsoft 内核调试网络适配器通过从下拉列表框中选择它,然后单击确定中虚拟交换机管理器对话框。Open the Virtual Switch Manager from Hyper-V Manager, select your existing Virtual Switch, and change the external network NIC to the Microsoft Kernel Debug Network Adapter by selecting it from the drop down box and then clicking OK in the Virtual Switch Manager dialog box.

  2. 更新虚拟交换机的 NIC、 关闭和重启后 Vm。After updating your Virtual Switch NIC, shutdown and restart your VMs.

当 KDNET 调试处于关闭状态时,将需要相同的过程后跟 nic 重新定位外部切换回本机 NDIS 微型端口When KDNET debugging is turned off, the same procedure will need to be followed to repoint the external switch back to the native NDIS miniport for the NIC. 否则禁用调试后重新启动计算机时,VM 连接性将会丢失。Otherwise VM connectivity will be lost when the machine is rebooted after debugging is disabled.

IPv6IPv6

Windows 版本 1809年添加了 IPv6 支持。IPv6 support was added in Windows version 1809.

若要使用 IPv6 使用调试器,请完成这些步骤。To use IPv6 with the debugger complete these steps.

  1. Ping 你<debughostname>和 IPv6 地址,请注意报告上输出行的回复。使用 x: y:z:p:d:q:r:n 下面代替此 IPv6 地址。Ping your <debughostname> and note the IPv6 address that is reported on the Reply from output lines.Use this IPv6 address in place of x:y:z:p:d:q:r:n below.

  2. 使用 BCDEdit 删除 dbgsettings 中任何现有的 ip 地址值。Use BCDEdit to delete any existing ip address values in dbgsettings.

    bcdedit -deletevalue {dbgsettings} hostip
    
  3. 设置主机的 IPv6 地址。Set the IPv6 address of the host. 不能在任何空格hostipv6=s:t:u:v:w:x:y:z字符串。There must not be any spaces in the hostipv6=s:t:u:v:w:x:y:z string. 是为要为此目标计算机,使用的网络端口号<YourKey>是由四部分构成的安全密钥,并<b.d.f>总线设备函数位置号是想要用于 KDNET 的 nic。 is is the network port number to use for this target machine, <YourKey> is the four part security key, and <b.d.f> are the bus device function location numbers for the NIC you want to use for KDNET.

    bcdedit /dbgsettings net hostipv6:s:t:u:v:w:x:y:z port:<YourPort> key:<YourKey> busparams:<b.d.f>
    
  4. 键入以下命令以确认正确设置 dbgsettings。Type this command to confirm that the dbgsettings are set properly.

    C:\> bcdedit /dbgsettings
    busparams               0.25.0
    key                     2steg4fzbj2sz.23418vzkd4ko3.1g34ou07z4pev.1sp3yo9yz874p
    debugtype               NET
    hostipv6                  2001:db8:0:0:ff00:0:42:8329
    port                    50010
    dhcp                    Yes
    The operation completed successfully.
    
  5. 在主机上使用此命令以启动调试器。On the host machine use this command to start the debugger.

    Windbg -k net:port=<yournetworkportnumber>,key=<key_output_from_kdnet>,target=::<YourIPv6Address> 
    
  6. 当调试器主机计算机上运行,等待连接,请重新启动目标计算机。When the debugger is running on the host machine, and waiting to connect, reboot the target computer.

  7. 尽早在启动过程中,调试程序应连接到主机调试器。The debugger should connect to the host debugger early during boot. 您将知道 KDNET 正在使用的 IPv6 连接,因为已连接的消息中报告的 IP 地址将是 IPv6 地址,而不是 IPv4 地址。You will know that KDNET is using an IPv6 connection because the IP addresses reported in the connected message will be IPv6 addresses instead of IPv4 addresses.

说明NOTES

  • Bcd 设置的允许主机以指定每个调试器具有相应的 hostipv6 元素。Every debugger bcd setting that allows the hostip to be specified has a corresponding hostipv6 element. 有三个。There are three.

    IPv4IPv4 IPv6IPv6 用法Usage
    主机hostip hostipv6hostipv6 用于启动和内核调试For boot and kernel debugging
    targethostiptargethostip targethostipv6targethostipv6 特定于内核调试Specific to kernel debugging
    hypervisorhostiphypervisorhostip hypervisorhostipv6hypervisorhostipv6 用于调试的 hyper-vFor hyper-v debugging
  • 如果任何这些类型的调试设置 hostipv6 样式地址,它表示您希望并将获得 IPv6。If you set the hostipv6 style address for any of those kinds of debugging, it means you want and will get IPv6.

  • 如果任何这些类型的调试设置主机样式地址,它表示您希望并将获取 IPv4。If you set the hostip style address for any of those kinds of debugging, it means you want and will get IPv4.

  • IPv4 或 IPv6,不能同时在相同时,将只执行此目标。The target will only do IPv4 or IPv6, not both at the same time. 由目标计算机 dbgsettings 控制使用的 IP 协议的版本。Which version of the IP protocol is used is controlled by the target machine dbgsettings. 如果设置主机,则目标将使用 IPv4。If hostip is set, the target will use IPv4. 如果设置 hostipv6,目标将使用 IPv6。If hostipv6 is set, the target will use IPv6.

  • 主机调试器通常会自动选择使用的 IPv4 或 IPv6。The host debugger will normally auto select use of IPv4 or IPv6. 默认情况下调试器侦听 IPv4 套接字和将 IPv6 套接字,并将自动连接到目标计算机的任何一个。By default the debugger listens on both an IPv4 socket and an IPv6 socket, and connects automatically on either one to the target machine.

  • 如果你想要在主机上强制使用 IPv6 在调试器中的,但希望调试器来侦听来自目标的连接,则您可以添加、target=::到调试器命令行。If you want to force use of IPv6 in the debugger on the host, but you want the debugger to listen for a connection from the target, then you can add, target=:: to the debugger command line. :: 为 0 的 IPv6 地址。:: is an IPv6 address of 0.

  • 如果你想要强制 IPv4 的主机上,在调试器中调试,但希望调试器来侦听来自目标的连接,则您可以添加、target=0.0.0.0到调试器命令行。If you want to force IPv4 debugging in the debugger on the host, but you want the debugger to listen for a connection from the target, then you can add, target=0.0.0.0 to the debugger command line. 0.0.0.0 是为 0 的 IPv4 地址。0.0.0.0 is an IPv4 address of 0.

  • 如果指定,目标 = 调试器命令行上并使用计算机名称,调试器会将该计算机名称转换为 IPv4 地址和 IPv6 地址,并将尝试同时连接。If you specify, target= on the debugger command line and use a machine name, the debugger will convert that machine name into an IPv4 address and an IPv6 address, and will attempt to connect on both.

  • 如果指定,目标 = on 调试器命令行中,并使用一个 IP 地址,如果 IP 地址包含任何包含任何: 字符,调试器将假定它是 IPv6 地址,并将强制使用 IPv6,为该连接。If you specify, target= on the debugger command line, and use an IP address, if the IP address contains any contains any : characters, the debugger will assume it is an IPv6 address, and will force use of IPv6 for that connection. 如果 IP 地址包含任何。If the IP address contains any . 字符,调试器将假定它是 IPv4 地址,并将强制使用 IPv4,为该连接。characters, the debugger will assume it is an IPv4 address, and will force use of IPv4 for that connection.

  • 如果在目标上安装 IPv6 和调试器命令行上强制使用 IPv4 时,不会获得连接。If you setup IPv6 on the target, and force use of IPv4 on the debugger command line, you will not get a connection.

  • 如果在目标上安装 IPv4 和调试器命令行上强制使用 IPv6,你也不会获得连接。If you setup IPv4 on the target, and force use of IPv6 on the debugger command line, you will also not get a connection.

KDNET 网络内核调试会自动设置Setting Up KDNET Network Kernel Debugging Automatically

支持的网络内核调试在 Windows 10 中的以太网 NicSupported Ethernet NICs for Network Kernel Debugging in Windows 10

支持的网络内核调试在 Windows 8.1 中的以太网 NicSupported Ethernet NICs for Network Kernel Debugging in Windows 8.1