본문 바로가기

Computer (컴퓨터)/Window

CMD 명령어 ip주소변경 (bat 배치파일)

728x90
반응형

[STACTIC]
netsh interface ipv4 set address name="이더넷" source=dhcp
netsh interface ipv4 reset
pause


[DHCP]
netsh interface ipv4 set address name="이더넷" static 192.168.114.63 255.255.255.0 192.168.114.254
netsh interface ipv4 add address name="이더넷" 10.0.0.239 255.0.0.0 10.0.0.1
ipconfig /all
pause



IP 주소 변경
netsh -c int ip set address name="로컬 영역 연결" source=static addr=000.000.000.000 mask=000.000.000.000 gateway=000.000.000.000 gwmetric=000.000.000

name: 네트워크 연결에서 확인되는 LAN의 종류 명, 만약 무선 LAN의 경우 위에 보이는 그림과 같이 '무선 네트워크 연결'를 입력하면 된다.
DNS 변경
netsh -c int ip set dns name="로컬 영역 연결" source=static addr=000.000.000.000


자동 IP를 사용하는 경우
netsh -c int ip set address name="로컬 영역 연결" source=dhcp

netsh -c int ip set dns name="로컬 영역 연결" source=dhcp


배치파일 생성

두명령을 매번 명령 프롬프트를 통하여 입력하는 것은 불편한 작업이니 배치파일을 생성하여 내 컴퓨터 상에서 해주면 된다.

netsh -c int ip set address name="로컬 영역 연결" source=static addr=000.000.000.000 mask=000.000.000.000 gateway=000.000.000.000 gwmetric=000.000.000

netsh -c int ip set dns name="로컬 영역 연결" source=static addr=000.000.000.000


위의 명령 두줄을 모두 기입한다.

기입한 파일을 저장할때 '이름.bat'로 파일확장자를 txt가 아닌 bat로 저장을 한다.



현재 IP설정을 모르는 경우나 일일이 적어두기 귀찮은 경우, IP외 여러가지 설정을 바꿔야 하는경우 현재 IP 설정을 파일로 저장해두고 불러쓰는 방법도 있다.

명령 프롬프트 또는 시작의 실행에서 다음과 같이 입력한다.
netsh -c interface dump > 장소_집.txt

현재 Interface 설정을 장소_집.txt에 저장 한다.
저장된 구성을 호출하여 IP를 설정할때에는 다음과 같이 입력한다.
netsh exec 장소_집.txt

netsh에 대한 추가 기능은 명령 프롬프트에서 netsh help 로 확인 가능하다.


출처: http://codepedia.tistory.com/entry/IP-주소-변경하기 [The 맛있는]

 

728x90
반응형