본문 바로가기
서버/리눅스

CentOS7 Firewalld 방화벽 명령어

by 배네 2020. 8. 26.

구성파일 위치

/etc/firewalld/zones/public.xml

 

설치확인

systemctl status firewalld
rpm -qa | grep firewalld

 

설정변경

- 모든 IP주소 열기

firewall-cmd --permanent --add-source=IP주소

- 특정 IP주소 열기

firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="IP주소" port protocol="tcp" port="포트번호" accept"

특정 IP주소 차단(포트제외)

firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="IP주소" drop"

- 특정 IP주소 차단(포트포함)

firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="IP주소"port protocol="tcp" port="포트번호" drop"

- 포트허용

firewall-cmd --permanent --remove-port=포트번호/tcp

- 포트삭제

firewall-cmd --permanent --remove-port=포트번호/tcp

 

변경사항 적용

firewall-cmd --reload

 

포트확인

firewall-cmd --zone=public --list-all

 

댓글