Kernel Debugging Over Network in Windows Server 2012

Betriebssysteme und Anwendungen

Betriebssysteme und Anwendungen
Betriebssysteme und Anwendungen

Betriebssysteme und Anwendungen - Wiki

Kernel Debugging Over Network in Windows Server 2012

Betriebssysteme und Anwendungen - Wiki

This article was originally written by Abhijit Khande & Gobind Vijayakumar from DELL Windows Engineering Team.

Comments are welcome! To suggest a topic or make other comments, contact WinServerBlogs@dell.com.

 

With the Microsoft® Windows Server® 2012 Operating system Microsoft has introduced a new method of debugging known as KDNET which is used for debugging over network.  In this article we will discuss KDNET and how it can be configured and used on Dell Servers.

In the Previous editions of Microsoft® Windows Operating Systems Kernel Debugging was performed through Serial Cable, USB and 1394(Firewire). In these methods we had several challenges like serial connectivity being slow; USB requiring special hardware which may not be cost effective and 1394 port being rarely available on all the servers. These challenges can be overcome by Kernel Debugging over network.

Kernel Debugging over network has many advantages over the debugging done via other methods,

  • Multiple times faster than Serial Cable
  • Less Hassle in Setup
  • More Flexible

Over this article we will be using two terms Host and Target.

  • Target: Machine that you want to debug.
  • Host   : Machine on which debugger runs.

 

Let us try to give a high level technicality of how KDNET works. KDNET uses a protocol known as “KDNET debugging protocol” for connection between host and the target. KDNET debugging protocol wraps the KD kernel debug transport (Kdnet.dll) in IP/UDP packets and sends it over network. Whenever a host tries to connect to a target machine for debugging, it attempts to query DHCP to get routable IP address for the Network port used in the Target. And when a routable address is successfully obtained, the host establishes the connection with the target for debugging. The Host uses Winsock while debugging and hence no debugging driver is needed. Also there is no specific requirement for the network controller in the host machine.

Below are the requirements for implementing KDNET,

  • The host debugger machine must be running Windows XP or later.
  • The host machine should have working network card installed and has been assigned a valid IP address which can communicate over the Network with the Target server.
  • Currently KDNET is supported only on 1GBe network adapters. For more details of Network Adapters supported by Dell for KDNET, you can refer to the below link.

 

Want to use KDNET?

Check out the list of Supported Network cards with Dell PowerEdge™ Servers

 

KDNET Setup


Figure 1

Note: In our setup we had firewall disabled in Host and Target.

The setup we used in the lab is displayed in Figure 1.  We had three servers connected to Dell PowerConnect™ 8024 Switch. One of the servers acted as a DHCP server; other two servers served as Host and Target.

Host

Dell PowerEdge T410

Broadcom 5709C

192.168.75.9

Target

Dell PowerEdge R720

Broadcom 5720 (KDNET feature supported card)

192.168.75.10

 

Once the lab setup was complete we configured both the servers to enable KDNET debugging. You can use the same commands stated below to configure your server if you wish to enable KDNET in your server.

Configuring Target machine

  1. Open an elevated (Administrator) command prompt
  2. Run the command “bcdedit -debug on” to enable Debugging on the Server. The command should complete successfully as shown in Figure 2.

Figure 2

  1. Then run the following command to enable Kernel Debugging by specifying the Host ip along with the Port which will be used to access the Target.

“bcdedit /dbgsettings NET HOSTIP:<ip of the host machine> PORT:50002”

The command should complete successfully and provide you a key as shown in Figure 3. Please Save that string in a text file to a USB flash drive or network share, you will need this string on the host. Also note that you can use ports from 50000 to 50099 in above command.

 

 

Figure 3

Another Flexibility that KDNET provides is that we can specify our own key using the below command,

bcdedit /dbgsettings NET HOSTIP:<ip of the host machine> PORT:50002 key:power.edge.dell.servers

Configuring Host machine

1. Install Debugging Tools for Windows (WinDBG) which is available as part of the WDK.

2. Then open an elevated command prompt and run the following command

“Windbg -k net:port=50002, key=<Key noted on the Target server>

Or

Open the program WinDbg.exe and navigate to File-> Kernel Debug and enter the Port number (50002) which we have used while configuring debug settings on the target. Then enter the Key we got after successful completion of command in “Step 3 - Configuring Target machine” and Press “OK” as shown in Figure 4.

 

Figure 4

3. Reboot the target machine. Now after rebooting the debugger in the Host connects to the Target as shown in Figure 5.

 

Note: You can also use Visual Studio to debug Target system using KDNET.

 

Additional Sources:

Supported Ethernet NICs for Network Kernel Debugging in Windows 8 –

http://msdn.microsoft.com/en-us/library/windows/hardware/hh830880

 

More information on KDNET –

http://msdn.microsoft.com/en-us/library/windows/hardware/hh439346(v=vs.85).aspx

 

WDK for Windows Server 2012 Release Preview –

http://msdn.microsoft.com/en-us/library/windows/hardware/hh439346(v=vs.85).aspx