[Centos] 자주 사용하는 firewall-cmd 명령어 정리

JOOONU·2024년 3월 11일
0

CentOS7

목록 보기
1/1

실무에서 자주 사용했던 방화벽 관련 firewall-cmd 명령어를 간단하게 정리해보았다.

기본 명령어

방화벽 상태 확인

firewall-cmd --state 

설정된 목록 확인

firewall-cmd --list-all 

방화벽 리로드 

firewall-cmd --reload
  • 설정 변경 후엔 꼭 리로드하기

--permanent 설정 유지 속성

서비스 추가/제거 

서비스 추가

firewall-cmd --permanent --add-service=ftp

서비스 삭제

firewall-cmd --permanent --remove-service=ftp

포트 추가/제거 

포트 추가

firewall-cmd --permanent --add-port=21/tcp 

포트 삭제

firewall-cmd --permanent --remove-port=21/tcp 

포트 범위로 열기

firewall-cmd --permanent --add-port=8000-8100/tcp

아이피 허용/삭제

아이피 허용

firewall-cmd --add-source=192.168.1.1

아이피 삭제

firewall-cmd --remove-source=192.168.1.1 

아이피 / 포트 허용

firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address=192.168.1.1 port port="80" protocol="tcp" accept' 

아이피 / 포트 허용

firewall-cmd --permanent --remove-rich-rule='rule family="ipv4" source address=192.168.1.1 port port="80" protocol="tcp" accept' 

출처 : https://rootjs.tistory.com/101
profile
Cloud, Infra, DevOps에 관심많은 학부생

0개의 댓글

관련 채용 정보