develog

[windows] netsh 방화벽 포트 오픈/삭제/확인하기 본문

카테고리 없음

[windows] netsh 방화벽 포트 오픈/삭제/확인하기

냐옴 2022. 7. 7. 16:10

cmd(명령 프롬프트) 를 관리자 권한으로 실행한다

 

netsh 명령으로 포트를 오픈/삭제/확인한다

# 포트 확인하기
netsh firewall show port
netsh advfirewall firewall show rule name=all
netsh advfirewall firewall show rule name="포트오픈 22"
netsh advfirewall firewall show rule name="포트오픈 80"
netsh advfirewall firewall show rule name="포트오픈 443"
netsh advfirewall firewall show rule name="포트오픈 8080"
netsh advfirewall firewall show rule name="포트오픈 3000"
netsh advfirewall firewall show rule name="포트오픈 3306"
netsh advfirewall firewall show rule name="포트오픈 13306"
netsh advfirewall firewall show rule name="포트오픈 1521"
netsh advfirewall firewall show rule name="포트오픈 5432"
netsh advfirewall firewall show rule name="포트오픈 1433"

# 포트 오픈하기
netsh advfirewall firewall add rule name="포트오픈 22" dir=in action=allow protocol=TCP localport=22
netsh advfirewall firewall add rule name="포트오픈 80" dir=in action=allow protocol=TCP localport=80
netsh advfirewall firewall add rule name="포트오픈 443" dir=in action=allow protocol=TCP localport=443
netsh advfirewall firewall add rule name="포트오픈 8080" dir=in action=allow protocol=TCP localport=8080
netsh advfirewall firewall add rule name="포트오픈 3000" dir=in action=allow protocol=TCP localport=3000
netsh advfirewall firewall add rule name="포트오픈 3306" dir=in action=allow protocol=TCP localport=3306
netsh advfirewall firewall add rule name="포트오픈 13306" dir=in action=allow protocol=TCP localport=13306
netsh advfirewall firewall add rule name="포트오픈 1521" dir=in action=allow protocol=TCP localport=1521
netsh advfirewall firewall add rule name="포트오픈 5432" dir=in action=allow protocol=TCP localport=5432
netsh advfirewall firewall add rule name="포트오픈 1433" dir=in action=allow protocol=TCP localport=1433
netsh advfirewall firewall add rule name="포트오픈 445 SMB" dir=in action=allow protocol=TCP localport=445
netsh advfirewall firewall add rule name="포트오픈 ICMPv4 Ping" dir=in action=allow protocol=icmpv4:8,any

# 포트 삭제하기
netsh advfirewall firewall delete rule name="포트오픈 22" protocol=tcp dir=in
netsh advfirewall firewall delete rule name="포트오픈 80" protocol=tcp dir=in
netsh advfirewall firewall delete rule name="포트오픈 443" protocol=tcp dir=in
netsh advfirewall firewall delete rule name="포트오픈 8080" protocol=tcp dir=in
netsh advfirewall firewall delete rule name="포트오픈 3000" protocol=tcp dir=in
netsh advfirewall firewall delete rule name="포트오픈 3306" protocol=tcp dir=in
netsh advfirewall firewall delete rule name="포트오픈 13306" protocol=tcp dir=in
netsh advfirewall firewall delete rule name="포트오픈 1521" protocol=tcp dir=in
netsh advfirewall firewall delete rule name="포트오픈 5432" protocol=tcp dir=in
netsh advfirewall firewall delete rule name="포트오픈 1433" protocol=tcp dir=in
netsh advfirewall firewall delete rule name="포트오픈 445 SMB" protocol=tcp dir=in
netsh advfirewall firewall delete rule name="포트오픈 ICMPv4 Ping"
Comments