다음을 통해 공유


자동으로 KDNET 네트워크 커널 디버깅 설정

Windows용 디버깅 도구 는 네트워크를 통해 커널 디버깅을 지원합니다. This article describes how to set up network debugging automatically by using the KDNET (kdnet.exe) setup tool.

The computer that runs the debugger is the host computer, and the computer being debugged is the target computer. The host computer must run Windows 7 or later, and the target computer must run Windows 8 or later.

호스트 컴퓨터의 IP 주소 확인

다음 단계를 사용하여 호스트 컴퓨터의 IP 주소를 찾습니다.

  1. 대상 및 호스트 PC가 네트워크 허브에 연결되어 있는지 확인하거나 적절한 네트워크 케이블을 사용하여 전환합니다.

  2. On the host computer, open a command prompt and enter IPConfig to display the IP configuration.

  3. 명령 출력에서 컴퓨터에 <Host-IP-Address>대한 이더넷 어댑터의 IPv4 주소를 찾습니다.

    ...
    Ethernet adapter Ethernet:
    ...
    IPv4 Address. . . . . . . . . . . : <Host-IP-Address>
    ...
    

    Alternatively, use Settings>Network & internet>Ethernet to gather the IPv4 address information.

  4. 디버깅에 사용하려는 네트워크 어댑터의 IPv4 주소를 기록해 둡니다.

호스트 및 대상 컴퓨터 설정

KDNET 유틸리티를 사용하여 이러한 단계를 통해 대상 PC에서 디버거 설정을 자동으로 구성합니다.

Note

이 절차에서는 호스트 및 대상 컴퓨팅이 모두 64비트 버전의 Windows를 실행하고 있다고 가정합니다. 구성이 다른 경우 가장 좋은 방법은 대상에서 실행되는 호스트에서 동일한 "비트"의 도구를 실행하는 것입니다. 예를 들어 대상이 32비트 Windows를 실행하는 경우 호스트에서 32비트 버전의 디버거를 실행합니다. 자세한 내용은 32비트 또는 64비트 디버깅 도구 선택을 참조 하세요.

  1. Windows 디버깅 도구가 호스트 컴퓨터에 설치되어 있는지 확인합니다. 도구 다운로드 및 설치에 대한 자세한 내용은 Windows용 디버깅 도구를 참조하세요.

  2. Locate the kdnet.exe and VerifiedNICList.xml files on the host computer. 기본적으로 파일은 C:\Program Files (x86)\Windows Kits\10\Debuggers\x64 폴더에 있습니다.

  3. 대상 컴퓨터에서 사용할 수 있도록 호스트 컴퓨터의 두 파일을 네트워크 공유 또는 썸 드라이브에 복사합니다.

  4. On the target computer, create a C:\KDNET folder, and copy the kdnet.exe and VerifiedNICList.xml files to the folder.

    Important

    Before you use kdnet.exe to change boot information, you might need to temporarily suspend Windows security features on the test PC, such as BitLocker and Secure Boot. 테스트를 완료한 후 보안 기능을 다시 활성화합니다. 보안 기능이 비활성화된 경우 테스트 PC를 적절하게 관리해야 합니다.

  5. 대상 컴퓨터에서 관리자 권한으로 명령 프롬프트를 엽니다. 다음 명령을 입력하여 대상 컴퓨터에 지원되는 네트워크 어댑터가 있는지 확인합니다.

    C:\KDNET>kdnet.exe
    Network debugging is supported on the following NICs:
    busparams=1.0.0, Broadcom NetXtreme Gigabit Ethernet, Plugged in.  
    This Microsoft hypervisor supports using KDNET in guest VMs.
    

    After the output from the KDNET (kdnet.exe) command shows the network adapter supported on the target, you can proceed.

  6. 다음 명령을 입력하여 호스트 시스템의 IP 주소를 설정하고 고유한 연결 키를 생성합니다.

    • 값의 <Host-Computer-IP-Address> 경우 호스트 시스템의 IP 주소 또는 이름을 사용합니다.
    • 값에 <Debug-Port> 대해 권장되는 범위인 50000-50039 내에서 작업하는 각 대상/호스트 쌍에 대한 고유한 포트 주소를 입력합니다.
    C:\KDNET>kdnet.exe <Host-Computer-IP-Address> 
    
    Enabling network debugging on Intel(R) 82577LM Gigabit Network Connection.
    Key=2steg4fzbj2sz.23418vzkd4ko3.1g34ou07z4pev.1sp3yo9yz874p
    
  7. Save the key value returned by the KDNET command in a notepad .txt file.

커널 디버깅을 위해 WinDbg를 대상에 연결

다음 단계를 수행하여 커널 디버깅을 위해 WinDbg를 대상 컴퓨터에 연결합니다.

  1. On the host computer, open WinDbg, and select File>Kernel Debug.

  2. In the Kernel Debugging dialog, select the Net tab.

  3. Paste the port number and key from the notepad.txt file into the tab fields, and select OK.

You can also start the WinDbg session from the command line by using the windbg.exe command and the values you saved in the notepad.txt file.

windbg.exe -k -d net:port=<Debug-Port>,key=<KDNET-Key> 

값은 <Debug-Port> 이전에 선택한 포트입니다. 이 값은 <KDNET-Key> KDNET에서 반환하는 키입니다. 선택적 -d 매개 변수를 사용하면 초기 침입이 가능합니다. 자세한 내용은 WinDbg 명령줄 옵션을 참조 하세요.

연결을 시작하면 WinDbg에서 방화벽을 통해 포트에 대한 액세스를 허용하라는 메시지가 표시될 수 있습니다.

세 가지 네트워크 유형 모두에 대한 액세스를 허용하는 선택 항목이 있는 Windows 보안 경고의 스크린샷

In the message dialog, select each checkbox to enable access for all three network types, and select Allow access.

이때 디버거는 대상이 다시 연결될 때까지 대기하고 디버거 명령 창에 진행률을 표시합니다.

Microsoft (R) Windows Debugger Version 1.0.1908.30002 AMD64
Copyright (c) Microsoft Corporation. All rights reserved.

Using NET for debugging
Opened WinSock 2.0
Waiting to reconnect...

대상 PC 다시 시작

디버거에 "다시 연결 대기 중..."이 표시되면 메시지, 대상 컴퓨터를 다시 부팅합니다.

PC를 다시 시작하는 한 가지 방법은 관리자 권한으로 명령 프롬프트에서 다음 명령을 실행하는 것입니다.

shutdown -r -t 0 

대상 PC가 다시 시작되면 디버거가 자동으로 연결됩니다.

Troubleshoot issues

포트 연결을 설정하거나 디버그 세션을 시작하는 데 문제가 있는 경우 다음 문제 해결 팁을 검토하세요.

방화벽을 통해 앱 디버깅 허용

디버거가 실행되는 호스트 쪽에서는 디버거가 방화벽을 통해 대상과 통신할 수 있도록 모든 유형의 네트워킹을 사용하도록 설정해야 합니다.

Use the Windows Control Panel to allow access through the firewall.

  1. Open Control Panel>System and Security and select the appropriate Allow an app through Windows Firewall options:

    • WinDbg: In the list of applications, locate the WinDbg engine process (TCP) (all) option.

    • WinDbg (Classic): In the list of applications, locate the Windows GUI Symbolic Debugger and Windows Kernel Debugger options.

  2. Select the checkboxes to allow all debugging applications through all three network types.

  3. Select OK to save the firewall changes, and then restart the debugger.

    세 가지 네트워크 유형이 모두 사용하도록 설정된 Windows GUI 기호 디버거 및 Windows 커널 디버거 애플리케이션을 표시하는 제어판 방화벽 구성의 스크린샷

ping을 사용하여 연결 테스트

디버거가 시간이 초과되고 연결되지 않는 경우 대상 PC의 ping 명령을 사용하여 연결을 확인합니다.

C:\>Ping <HostComputerIPAddress>

네트워크 디버깅을 위한 포트 선택

디버거가 시간 초과되고 연결되지 않는 경우 기본 포트 번호 50000이 이미 사용 중이거나 차단되었기 때문일 수 있습니다.

49152에서 65535 사이의 포트 번호를 선택할 수 있습니다( 포함). 권장 범위는 50000~50039입니다. 선택한 포트는 호스트 컴퓨터에서 실행되는 디버거에서 단독 액세스를 위해 열립니다.

회사 네트워크 정책은 네트워크 디버깅에 사용할 수 있는 포트 번호의 범위를 제한할 수 있습니다. 회사의 정책이 네트워크 디버깅을 위한 포트 범위를 제한하는지 확인하려면 네트워크 관리자에게 문의하세요.

지원되는 네트워크 어댑터 찾기

KDNET을 실행할 때 이 컴퓨터 메시지의 NIC에서 네트워크 디버깅이 지원되지 않는 경우 네트워크 어댑터는 지원되지 않습니다.

호스트 컴퓨터는 모든 네트워크 어댑터를 사용할 수 있지만 대상 컴퓨터는 Windows용 디버깅 도구에서 지원하는 네트워크 어댑터를 사용해야 합니다. 지원되는 네트워크 어댑터 목록은 다음 문서를 참조하세요.

다른 디버깅 형식 사용

Windows 10 2020년 10월 업데이트(20H2) 이상에서는 4가지 유형의 디버깅을 지원합니다.

KDNET option Debugging type 해당 집합 명령 More information
b Bootmgr debugging bcdedit /bootdebug {bootmgr} on BCDEdit /bootdebug
w Winload debugging bcdedit /bootdebug on BCDEdit /bootdebug
k Kernel debugging bcdedit /debug on WinDbg 시작(커널 모드)
h Hypervisor debugging bcdedit /set hypervisordebug on BCDEdit /hypervisorsettings

다음은 디버깅 형식 작업에 대한 세부 정보입니다.

  • 디버그 형식의 조합을 지정할 수 있습니다.
  • 디버그 형식을 지정하지 않으면 시스템에서 커널 디버깅을 사용하도록 설정합니다.
  • 하이퍼바이저 및 커널 디버깅을 모두 사용하도록 설정하면 하이퍼바이저 포트가 + 1로 <Debug-Port> 설정됩니다.

예: bootmgr, 커널 및 윈로드 디버깅 사용

다음 예제에서는 bootmgr, 커널 및 윈로드 디버깅을 사용하도록 설정하는 옵션을 사용합니다 - bkw .

C:\>kdnet.exe <HostComputerIPAddress> <YourDebugPort> -bkw

Enabling network debugging on Intel(R) 82577LM Gigabit Network Connection.
Key=2steg4fzbj2sz.23418vzkd4ko3.1g34ou07z4pev.1sp3yo9yz874p

버스 매개 변수 지정

KDNET이 전송에 대한 버스 매개 변수를 자동으로 확인할 수 없는 경우 다음 옵션을 사용하여 명령줄에 매개 변수를 /busparams 지정할 수 있습니다.

kdnet.exe /busparams [b.d.f] [host] [port] [-[b][h][k][w]]

b.d.f 부분은 구성할 디바이스에 대한 버스 매개 변수를 지정합니다.

Use Device Manager on the target computer to determine the PCI bus number (b), the device number (d), and the function number (f) of the adapter you want to use for debugging. These values are available in the General tab under the Location setting.

For example:

C:\>kdnet.exe /busparams 0.29.7 <Host-Computer-IP-Address> <Debug-Port> -bkw