
- (꿀팁) 리눅스 방화벽 설정 - ufw firewall-cmd
- How to add Firewall rules on Redhat 9 - Allow MySQL Service Through the Firewall
Linux - firewall-cmd 서비스 명칭 기반 관리
firewalld에서는 포트 번호 대신 서비스 명칭으로 방화벽을 관리하는 것이 가능합니다
1. 기본 내장 서비스 사용 방법
- 지원되는 서비스 목록 조회:
firewall-cmd --get-services- zone에 서비스 오픈(예: HTTP, HTTPS):
sudo firewall-cmd --permanent --zone=public --add-service=http sudo firewall-cmd --permanent --zone=public --add-service=https sudo firewall-cmd --reload- 현재 적용된 서비스 확인:
firewall-cmd --list-services --zone=public
firewall-cmd --get-services
#zone에 서비스 오픈(예: HTTP, HTTPS):
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload
# 현재 적용된 서비스 확인:
firewall-cmd --list-services --zone=public
2. 커스텀 서비스 정의 방법
/etc/firewalld/services/에 XML 파일 생성(예: myapp.xml):<service> <short>myapp</short> <description>Custom App on 7000, 15433</description> <port protocol="tcp" port="7000"/> <port protocol="tcp" port="15433"/> </service>- 파일 등록 후 서비스 등록:
sudo firewall-cmd --permanent --add-service=myapp sudo firewall-cmd --reload
[/etc/firewalld/services/service-myapp.xml]
<service>
<short>myapp</short>
<description>Custom App on 7000, 15433</description>
<port protocol="tcp" port="7000"/>
<port protocol="tcp" port="15433"/>
</service>
firewall-cmd --new-service-from-file=service-myapp.xml
# or
sudo firewall-cmd --permanent --add-service=service-myapp
sudo firewall-cmd --reload
# 파일을 복사하여 적용가능
cp /usr/lib/firewalld/services/service-name.xml /etc/firewalld/services/service-name.xml
이런 방식은 포트 기반이 아니라, 서비스 명칭 기반으로 여러 포트와 규칙을 한 번에 관리할 수 있어 시스템 운영이 효율적입니다.
[1] [redhat.com, (https://docs.redhat.com/ko/documentation/red_hat_enterprise_linux/8/html/configuring_and_managing_networking/predefined-firewalld-services_using-and-configuring-firewalld)
[2]rockylinux.org (https://docs.rockylinux.org/10/ko/guides/security/firewalld-beginners/)
[3]리눅스 방화벽 설정, (https://couplewith.tistory.com/683)
[4]redhat.com,(https://docs.redhat.com/ko/documentation/red_hat_enterprise_linux/7/html/security_guide/sec-adding_new_services)
[5]Server-firewall-cmd-service (https://velog.io/@inyong_pang/Server-firewall-cmd-service)
'InfraPlatform' 카테고리의 다른 글
| 리눅스에서 숫자 계정 생성 정책 허용 (useradd --badname 활용) (11) | 2025.11.29 |
|---|---|
| 디자인 과학 연구 방법론(Design Science Research Methodology, DSRM) (0) | 2025.10.29 |
| VMware 가용성 HA와 FT (0) | 2025.10.15 |
| VMware vSphere Foundation 8 VCF VSP FND 라이선스 (1) | 2025.09.12 |
| HP 노트북 cmos 설정. 전력 효율기능 SA GV (System Agent Geyserville) 실시간 오버클럭 (1) | 2025.08.15 |
| 파일시스템-RAID-ZFS - Zettabyte File System (1) | 2025.08.12 |
| 금융산업에서 ITIL과 ISMS 관련 전략과 관리 방안 (0) | 2025.08.11 |