netsh 방화벽 대신 netsh advfirewall 방화벽을 사용하여 Windows 방화벽 동작 제어

김경민·2022년 7월 7일
1

Cloud Native, DevOps

목록 보기
4/10
post-thumbnail
post-custom-banner

netsh 방화벽 대신 netsh advfirewall 방화벽을 사용하여 Windows 방화벽 동작 제어

방화벽 규칙을 추가

명령 예제 1: 프로그램 사용

netsh advfirewall firewall add rule ?
netsh advfirewall firewall add rule name="My Application" dir=in action=allow program="C:\MyApp\MyApp.exe" enable=yes
netsh advfirewall firewall add rule name="My Application" dir=in action=allow program= "C:\MyApp\MyApp.exe" enable=yes remoteip=157.60.0.1,172.16.0.0/16,LocalSubnet profile=domain
netsh advfirewall firewall add rule name="My Application" dir=in action=allow program= "C:\MyApp\MyApp.exe" enable=yes remoteip=157.60.0.1,172.16.0.0/16,LocalSubnet profile=domain
netsh advfirewall firewall add rule name="My Application" dir=in action=allow program="C:\MyApp\MyApp.exe" enable=yes remoteip=157.60.0.1,172.16.0.0/16,LocalSubnet profile=private

명령 예제 2: 포트 사용

netsh advfirewall firewall add rule ?
netsh advfirewall firewall add rule name= "Open Port 80" dir=in action=allow protocol=TCP localport=80

명령 예제 3: 사용하도록 설정된 프로그램 또는 포트 삭제

netsh advfirewall firewall delete rule ?
netsh advfirewall firewall delete rule name= rule name program="C:\MyApp\MyApp.exe"
netsh advfirewall firewall delete rule name= rule name protocol=udp localport=500

명령 예제 4: ICMP 설정 구성

netsh advfirewall firewall add rule ?
netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=allow
netsh advfirewall firewall add rule name= "All ICMP V4" protocol=icmpv4:any,any dir=in action=allow
netsh advfirewall firewall add rule name="Block Type 13 ICMP V4" protocol=icmpv4:13,any dir=in action=block

명령 예제 5: 로깅 설정

netsh advfirewall set currentprofile ?
netsh advfirewall set currentprofile logging filename %systemroot%\system32\LogFiles\Firewall\pfirewall.log
netsh advfirewall set currentprofile logging maxfilesize 4096
netsh advfirewall set currentprofile logging droppedconnections enable
netsh advfirewall set currentprofile logging allowedconnections enable

명령 예제 6: Windows 방화벽 사용

netsh advfirewall set currentprofile ?
netsh advfirewall set currentprofile state on
Netsh advfirewall set currentprofile state on
netsh advfirewall set currentprofile firewallpolicy blockinboundalways,allowoutbound
Netsh advfirewall set domainprofile state on
netsh advfirewall set domainprofile firewallpolicy blockinbound,allowoutbound
netsh advfirewall set domainprofile state on
netsh advfirewall set privateprofile state on

명령 예제 7: 정책 기본값 복원

netsh advfirewall reset ?
netsh advfirewall reset

명령 예제 8: 특정 서비스 사용

netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes
netsh advfirewall firewall set rule group="remote desktop" new enable=Yes
netsh advfirewall firewall set rule group="remote desktop" new enable=Yes profile=domain

netsh advfirewall firewall set rule group="remote desktop" new enable=Yes profile=private

netsh 방화벽 대신 netsh advfirewall 방화벽을 사용하여 Windows 방화벽 동작 제어

post-custom-banner

0개의 댓글