Introduction: How to Setup a Windows Kernel Debugger Over Your Network
A couple things to take note of:
- This instruction set is designed for advanced computer users and the author has assumed that with these instructions.
- For privacy sake some information has been obscured.
First thing we will go over are the items you'll need to setup your debugger.
Step 1: What You'll Need
- 2 Windows Computers
- The Host computer which you’ll use for debugging. This computer must have Windows XP or newer installed
- The Target computer which you’ll be debugging. This computer must have Windows 8 or newer installed. It must also have one of the network adapters found in the list here. http://msdn.microsoft.com/en-us/library/windows/h...
- 1 Network Switch/Router (something that will assign IP addresses to the computers on the network)
- 2 Cat5 cables
- Debugging Tools for Windows which you need to install on the Host computer (http://msdn.microsoft.com/en-US/windows/desktop/bg162891)
Next we will go over what you'll need to do to set your computers up.
Step 2: Preparing Your Computers
- For the computer you'll be debugging on you'll need to install Debugging Tools for Windows which can be found here...
- http://msdn.microsoft.com/en-US/windows/desktop/bg...
- Connect the computer to your Switch/Router
- Make sure you are using Windows 8 or newer
- Make sure you are using a network adapter from this list http://msdn.microsoft.com/en-us/library/windows/hardware/dn337009(v=vs.85).aspx
- Connect the computer to your Switch/Router
Now that we have the computers setup we'll need to connect them, starting with the target computer.
Step 3: Setting Up the Target Computer
You need a couple things to get your target computer ready. You need the IP address of your Host computer. You can obtain this by using the ping tool. Here is how to do this...
- Open a command prompt
- Type "ping -4 HostComputerName." You'll get something like the following...
ping HostComputerName
Pinging HostComputerName [192.166.0.123] with 32 bytes of data:
Reply from 192.166.0.123: bytes=32 time=2268ms TTL=128
Reply from 192.166.0.123: bytes=32 time=10ms TTL=128
Reply from 192.166.0.123: bytes=32 time=19ms TTL=128
Reply from 192.166.0.123: bytes=32 time=1ms TTL=128
Ping statistics for 192.166.0.123:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 2268ms, Average = 574ms
*Keep this windows open. You'll need it later.
Next you need to make some changes to the boot configuration. The changes to your boot configuration file will tell your target computer how to connect to the host computer. In order to do this you'll need to open a command prompt with administrator (elevated) permissions. Here is how you do that.
- Right click on the command prompt on the taskbar
- Right click on command prompt again
- Click "Run As Administrator" (User Account Control will ask if you would like to allow this program to make changes on your computer, click Yes)
Now you need to set the boot configuration settings for network debugging. You will do this by using the bcdedit tool. This tool is built into the OS and can be run from any elevated command prompt. The following steps show how you make these setting changes
- In this new command window run the following...
- bcdedit /dbgsettings net hostip=192.166.0.123 port=XXXXX key=z.z.z.z
- where the hostip equals the IP address you obtained when you ran the ping command, XXXXX equals any number between 50000 and 50099, and z is any alphanumeric combination. Here is an example ...
bcdedit /dbgsettings net hostip=192.166.0.123 port:50002 key=a1b.2c3.d4e.5f6
Remember the key that you created. You'll need this when you set up your host computer.
Now you need to turn the debugger on. You can use the same elevated command prompt that you were using before or open a new one. To turn debugging on run the following bcdedit command
- bcdedit /debug on
- restart the computer
Please reference the picture above which shows examples of all of the commands in this step.
Now that we have the target computer set up we can prepare the host computer to look for our target computer on the network.
Step 4: Setting Up the Host Computer
To use the debugger from the command prompt.
- Open an elevated command prompt window
- Browse to the Debuggers directory where you installed the debugger. The default location looks like this. C:\Program Files (x86)\Windows Kits\8.0\Debuggers\
- If your host computer is running a 64 bit operating system, change directory to the x64 directory. If you are running a 32bit operating system on your host computer, change directory to the x86 directory.
- Type in the following command. kd - k net:port=XXXXX,key=z.z.z.z (Where XXXXX is the port you set on the target computer and z.z.z.z is the key you set on the target computer)
- Hit Enter
To run the debugger using windbg.
- run windbg from the directory you installed the debugger from. The default location looks like this. C:\Program Files (x86)\Windows Kits\8.0\Debuggers\.
- If your host computer is running a 64 bit operating system, change directory to the x64 directory. If you are running a 32bit operating system on your host computer, change directory to the x86 directory.
- Double click on windbg.exe
- Click on File
- Click Kernel Debug
- Select the Net tab
- Enter the port number you set on the target computer
- Enter the key you set on the target computer.
- Hit Okay
Please reference the pictures above which shows examples of all of the commands in this step.
Now that we have the host and target computers set up we can connect the two.