OS/Server > Windows

Network 관련 명령어들

#ip교체

네트워크 연결 브라우저 열기 (cmd command)

c:> ncpa.cpl

 

네트워크 연결 변경하기 배치파일

Network Card가 2개로 각각 설정이 된 상태의 사용/미사용 변경

※ 배치파일을 작성해 C:\Windows\System32  아래에 넣어 놓고 사용하면 된다.

>netcon 1  : 검색
>netcon 2  : MyProxy 네트워크 연결
>netcon 그외 : User 네크워크 연결

netcon.bat

echo off
set type=%1

if %type% == 1 (
    echo -----------------------------------
    echo    1:Search,  2:MyProxy,   etc:User 
    echo ===================================
    netsh interface ipv4 show interfaces
) else if %type% == 2 (
    netsh interface set interface name="User" admin=DISABLED
    netsh interface set interface name="MyProxy" admin=ENABLED
    echo "MyProxy Mang is Enabled..!!!!"    
)else (
    netsh interface set interface name="MyProxy" admin=DISABLED
    netsh interface set interface name="User" admin=ENABLED
    echo "User Mang is Enabled..!!!!"
)

고정IP 를 변경할때 사용

Useage

netsh interface ip set address "[Network Interface Name]" static [IP Address] [Subnet Mask] [Default Gateway] [Metric]

* Metric - 라우팅 경로가 여러개일 경우 우선순위를 나타냄.
ex) netsh interface ip set address "로컬 영역 연결" static 192.168.23.23 255.255.255.0 192.168.1.1

 

echo off
set type="%1"


if %type% == "" (
    echo .
    echo ------------------------------
    echo    Private[ p,P ],  Internal[ etc ]
    echo ------------------------------
    netsh interface ipv4 show ipaddresses
    
) else if %type% == "p" (
    
    netsh interface ip set address name=emc static 192.12.123.111 255.255.255.0 192.12.123.1
    echo ------------------------------
    echo [ Private ] is Enabled..!!!!
    echo ------------------------------


) else if %type% == "P" (

    netsh interface ip set address name=emc static 192.12.123.111 255.255.255.0 192.12.123.1
    
    echo ------------------------------
    echo [ Private ] is Enabled..!!!!
    echo ------------------------------
    
) else (

    netsh interface ip set address name=emc static 192.45.45.22 255.255.255.128 192.45.45.1
    
    echo ------------------------------
    echo [ Internal ] is Enabled..!!!!
    echo ------------------------------
)

DHCP - 자동으로 IP 주소 받기

netsh interface ip set address name=emc dhcp

DNS 설정하기

1) 자동설정 : 자동으로 DNS 서버 주속받기

netsh interface ip set dns name=emc dhcp

2) 수동설정 : 다음 DNS 서버 주소 사용

netsh interface ip set dns name=emc static 192.168.99.100 primary
netsh interface ip add dns name=emc 192.168.0.1

네트워크 관련 명령어들

   
netstat -an 네트워크 컨넥션과 포트들의 리스트
nslookup mydomain.com 도메인과 관련된 IP어드레스 검색
sfc /scannow 시스템 파일들의 문제점을 스캔한다.(시간걸림)
shutdown /s /t 0 일반적인 셧다운
shutdown /r /t 0 리스타트
shutdown /r /o Advanced options로 리스타트
ipconfig /flushdns DNS Resolver Cache를 Flush 한다.
ncpa.cpl 네트워크 연결 브라우저 열기
netsh interface set interface name="Wireless Network Connection" admin=DISABLED 네트워크 연결 닫기
netsh interface set interface name="Wireless Network Connection" admin=ENABLED 네트워크 연결 열기
netsh wlan disconnect Wifi 연결을 닫기
netsh wlan connect name="WifiNetWorkName" Wifi 연결을 열기
netsh interface ipv4 show config 인터페이스 구성을 보여준다.
netsh interface ipv4 show address 모든 LAN adapter의 IP Address 만 보여줌
netsh interface ipv4 show global 글로벌 TCP/IP Parameter을 보여줌
netsh interface ipv4 show interfaces 모든 network interface와 Link 상태 
netsh interface ipv4 show route 라우팅테이블을 보여줌
netsh interface ipv4 show tcpconnections 모든 TCP 컨넥션을 보여줌
netsh interface ipv4 show join 어떤 Multicast groups가 연결되었나 보여줌
netsh interface ipv4 show dynamicportrange protocol=tcp Show dynamic portrange for outgoing connections