OS/Windows

[Windows] Command Prompt 아이피 변경

devsalix 2022. 12. 21. 17:45
728x90

윈도우의 Command 에서 아이피를 변경하고자 한다면

 

아래와 같이 두가지 방법으로 변경이 가능합니다

 

1. NETSH

 

  • dhcp
netsh interface ip set address "이더넷 1" dhcp
netsh interface ip set dns "이더넷 1" dhcp

 

  • static
netsh interface ip set address "이더넷 1" static 192.168.0.1 255.255.255.0 192.168.0.254 1
netsh interface ip set dns "이더넷 1" static 1.1.1.1
netsh interface ip add dns "이더넷 1" static 1.0.0.1

 

위와 같이 아이피와 dns를 변경하면 된다

 

위의 "이더넷 1"의 경우 어댑터의 이름으로 지정하면 된다

 

 


 

2. wmic

 

  • dhcp
wmic nicconfig where index=1 call enabledhcp
wmic nicconfig where index=1 call setdnsserversearchorder ()

 

  • static
wmic nicconfig where index=1 call enablestatic (192.168.0.1), (255.255.255.0)
wmic nicconfig where index=1 call setgateways (192.168.0.254)

wmic nicconfig where index=1 call setdnsserversearchorder (1.1.1.1, 1.0.0.1)
or
wmic nicconfig where index=1 call setdnsserversearchorder (1.1.1.1)

 

위와 같이 아이피와 dns를 변경하면 된다

 

위의 "index=1"의 경우 어댑터의 index를 찾아 지정하면 된다

728x90