본문 바로가기

Computer/MSWin

netsh

Netsh 명령줄 유틸리티


Netsh 명령줄 유틸리티

Netsh는 로컬 또는 원격 컴퓨터용 네트워킹 구성 요소를 위한 명령줄 및 스크립팅 유틸리티입니다. Netsh 유틸리티는 보관 목적으로 또는 다른 서버를 구성하기 위해 구성 스크립트를 텍스트 파일에 저장할 수도 있습니다.

Netsh 유틸리티는 Netsh 도우미 DLL을 추가하여 여러 개의 구성 요소를 지원할 수 있는 셸입니다. Netsh 도우미 DLL은 특정 네트워킹 구성 요소를 모니터링하거나 구성하기 위한 추가 명령을 제공함으로써 Netsh 기능을 확장합니다. 각 Netsh 도우미 DLL은 특정 네트워킹 구성 요소에 대한 명령 그룹인 컨텍스트를 제공합니다. 각 콘텍스트에는 하위 컨텍스트가 있을 수 있습니다. 예를 들어 라우팅 컨텍스트에는 IP 라우팅 명령을 하나로 묶기 위한 하위 컨텍스트 ip가 있습니다.

Netsh 명령줄 옵션에는 다음과 같은 것이 있습니다.

-a AliasFile

별칭 파일이 사용된다는 것을 지정합니다. 별칭 파일에는 netsh 명령 목록과 별칭 버전이 들어 있으므로 netsh 명령 대신 별칭 명령줄을 사용할 수 있습니다. 별칭 파일을 사용하면 다른 플랫폼의 더 익숙한 명령을 해당 netsh 명령에 매핑할 수 있습니다.

-c Context

설치된 도우미 DLL에 해당하는 명령의 컨텍스트를 지정합니다.

명령

실행할 netsh 명령을 지정합니다.

-f ScriptFile

ScriptFile 파일의 모든 netsh 명령이 실행되도록 지정합니다.

-r RemoteMachine

이름이나 IP 주소로 지정된 원격 컴퓨터에서 netsh 명령이 실행된다는 것을 지정합니다.

명령을 모호하지 않은 문자열로 가장 짧게 약어화할 수 있습니다. 예를 들어 sh ip int 명령을 사용하는 것은 show ip interface 명령을 사용하는 것과 같습니다. Netsh 명령에는 글로벌 명령과 컨텍스트 전용 명령이 있습니다. 글로벌 명령은 모든 컨텍스트에서 사용할 수 있으며 일반적인 Netsh 유틸리티 기능에 사용됩니다. 컨텍스트 전용 명령은 컨텍스트에 따라 달라집니다. 사용 명령을 로그 파일에 기록하여 netsh 명령 세션의 감사 추적을 만들 수 있습니다.

다음 표는 netsh 글로벌 명령 목록입니다.

명령 설명

..

한 컨텍스트 수준 위로 이동합니다.

? 또는 help

명령줄 도움말을 표시합니다.

show version

Windows와 Netsh 유틸리티의 현재 버전을 표시합니다.

show netdlls

설치된 Netsh 도우미 DLL의 현재 버전을 표시합니다.

add helper

Netsh 도우미 DLL을 추가합니다.

delete helper

Netsh 도우미 DLL을 제거합니다.

show helper

설치된 Netsh 도우미 DLL을 표시합니다.

cmd

명령 창을 만듭니다.

online

현재 모드를 온라인으로 설정합니다.

offline

현재 모드를 오프라인으로 설정합니다.

set mode

현재 모드를 온라인이나 오프라인으로 설정합니다.

show mode

현재 모드를 표시합니다.

flush

오프라인 모드의 모든 변경 사항을 취소합니다.

commit

오프라인 모드에서 이루어진 변경 사항을 적용합니다.

set audit-logging

로깅 기능을 켜거나 끕니다.

show audit-logging

현재 감사 로깅 설정을 표시합니다.

set loglevel

로깅 정보의 수준을 설정합니다.

show loglevel

로깅 정보의 수준을 표시합니다.

set machine

netsh 명령이 실행되는 컴퓨터를 구성합니다.

show machine

netsh 명령이 실행되는 컴퓨터를 표시합니다.

exec

netsh 명령이 들어 있는 스크립트 파일을 실행합니다.

quit, bye 또는 exit

Netsh 유틸리티를 끝냅니다.

add alias

기존의 명령에 별칭을 추가합니다.

delete alias

기존 명령에 대한 별칭을 삭제합니다.

show alias

정의된 모든 별칭을 표시합니다.

dump

구성을 텍스트 파일에 기록합니다.

popd

스택에서 컨텍스트를 팝하는 스크립팅 명령입니다.

pushd

현재 컨텍스트를 스택에 푸시하는 스크립팅 명령입니다.

Netsh 유틸리티에는 다음과 같은 명령 모드가 있습니다.

온라인

온라인 모드에서는 Netsh 명령 프롬프트에서 사용하는 명령이 바로 실행됩니다.

오프라인

오프라인 모드에서는 Netsh 명령 프롬프트에서 사용하는 명령이 누적되었다가 commit 글로벌 명령이 사용되면 일괄적으로 실행됩니다. flush 글로벌 명령을 사용하면 누적된 명령을 삭제할 수 있습니다.

스크립트

-f 명령줄 옵션을 사용하거나 Netsh 명령 프롬프트에서 exec 글로벌 명령을 사용하면 지정한 파일의 모든 netsh 명령이 실행됩니다.

현재 구성에 대한 스크립트를 만들려면 dump 글로벌 명령을 사용합니다. dump 명령을 실행하면 netsh 명령으로 현재 실행 중인 구성이 출력됩니다. 이 명령으로 만들어진 스크립트를 사용하여 새 서버를 구성하거나 기존의 서버를 재구성할 수 있습니다. 구성 요소의 구성을 대폭 변경하려고 할 경우에는 변경을 하기에 앞서 구성을 복원할 경우를 대비하여 dump 명령으로 구성 세션을 시작할 것을 권장합니다.

라우팅 및 원격 액세스 서비스에 사용할 netsh 명령에 대한 자세한 내용은 다음을 참조하십시오.

인터페이스 명령

IP 라우팅 명령

자동 고정 업데이트 일정 지정

원격 액세스용 Netsh 명령

출처: http://technet2.microsoft.com/WindowsServer/ko/Library/fd1e2fbe-15a6-413b-b712-28afb312c92f1042.mspx?mfr=true


Syntax

netsh [-a AliasFile] [-c Context] [-r RemoteMachine] [Command | -f ScriptFile]

? Displays a list of commands.
add Adds a configuration entry to a list of entries.

add helper Installs a helper DLL.
delete Deletes a configuration entry from a list of entries.

delete helper Deletes a helper DLL.
dump Displays a configuration script.
exec Runs a script file.
help Displays a list of commands.
interface Changes to the `interface' context.

ip Changes the 'interface ip' context.
ras Changes to the `ras' context.

aaaa Changes to the `ras aaaa' context.
appletalk Changes to the `ras appletalk' context.
ip Changes the 'ras ip' context.
ipx Changes to the `ras ipx' context.
netbeui Changes to the `ras netbeui' context.
routing Changes to the `routing' context.

ip Change to the 'routing ip' context.
ipx Changes to the `routing ipx' context.
set Updates configuration settings.

machine Sets the current machine on which to operate.
show Displays information.

show alias Lists all defined aliases.
show helper Lists all the top-level helpers.

Available commands after you have entered the netsh command (typing netsh at the prompt and pressing enter).

.. Goes up one context level.
? Displays a list of commands.
abort Discards changes made while in offline mode.
add Adds a configuration entry to a list of entries.
alias Adds an alias.
bye Exits the program.
commit Commits changes made while in offline mode.
delete Deletes a configuration entry from a list of entries.
dump Displays a configuration script.
exec Runs a script file.
exit Exits the program.
help Displays a list of commands.
interface Changes to the `interface' context.
offline Sets the current mode to offline.
online Sets the current mode to online.
popd Pops a context from the stack.
pushd Pushes current context on stack.
quit Exits the program.
ras Changes to the `ras' context.
routing Changes to the `routing' context.
set Updates configuration settings.
show Displays information.
unalias Deletes an alias.

Examples

netsh

Enter the netsh command.

netsh dump

Dump all the network information as a script to the screen. Can also be sent to a file by doing netsh dump > file.txt . This script can then be executed using the exec command.

set address name="Local Area Connection" source=dhcp

Set the "Local Area Connection" to DHCP.

set address local static 10.0.0.9 255.0.0.0 10.0.0.1 1

Set the local address to Static.

netsh interface ip show config

View network ip configuration. Below is an example of what may be seen.

Configuration for interface "Local Area Connection"
DHCP enabled: Yes
InterfaceMetric: 1
DNS servers configured through DHCP
WINS servers configured through DHCP

출처: http://www.computerhope.com/netsh.htm