Web_developer

CentOS 7 에서 iptables 방화벽 데몬 사용하기 본문

Linux

CentOS 7 에서 iptables 방화벽 데몬 사용하기

에잎이 2019. 7. 31. 01:42
반응형

이번에 개인 서버를 CentOS 6.5에서 7로 이전하기 위해서 열심히 구축 중이다.

웹 서버 데몬을 올리고 iptables 에서 80 포트 해제 해 준 뒤 localhost로 접속하는데 접속이 안된다.

구글링을 좀 했더니 CentOS 7 부터는 firewalld 라는 방화벽 데몬이 따로 돌아간단다. 예전처럼 iptables를 사용하기 위해서는 systemctl 설정을 좀 건드려 줘야한다.

 

우선 작동 중인 firewalld 데몬을 중지 시킨 후 재부팅 시에도 올라오지 않도록 설정한다.

systemctl stop firewalld
systemctl mask firewalld

 

다음으로 iptables 명령어와 연관된 패키지를 설치한다. 

CentOS 설치할 때의 옵션에 따라 설치 되었을 수도 있다. 나는 웹 서버 구성으로 설치 했더니 이미 설치 되어 있었다.

yum install iptables-services

 

iptables 서비스 데몬이 재부팅시에 자동으로 올라오도록 만들자

systemctl enable iptables

 

iptables 서비스를 중지 | 시작 | 재시작

systemctl [stop | start | restart ] iptables

 

 

iptables 규칙 저장

service iptables save

혹은

/usr/libexec/iptables/iptables.init save

 

 

출처 : https://luckyyowu.tistory.com/286

Comments