You cannot see this page without javascript.

firewalld DDOS 차단

Linux 조회 수 953 추천 수 0 2016.08.22 15:25:05

이전 iptables 에서 80 포트 디도스를 막는 방법이다.

 

# iptables -I INPUT -p tcp --syn --dport 80 -m connlimit --connlimit-above 24 -j DROP

 

초당 24번 이상 접속은 drop 하라는 의미이다.

 

 

firewall-cmd 에서도 iptables 를 확장하여 사용할 수가 있다.

 

# firewall-cmd --permanent --direct --add-passthrough ipv4 -I INPUT -p tcp --syn --dport 80 -m connlimit --connlimit-above 24 -j DROP

success

# firewall-cmd --reload

success

# iptables -L | grep DROP

DROP       tcp  --  anywhere             anywhere             tcp dpt:http flags:FIN,SYN,RST,ACK/SYN #conn src/32 > 24

 

방화벽 룰이 추가된 것을 확인할 수 있다.

 

이번엔 룰을 지워보자.

 

# firewall-cmd --permanent --direct --remove-passthrough ipv4 -I INPUT -p tcp --syn --dport 80 -m connlimit --connlimit-above 24 -j DROP

success

# firewall-cmd --reload

success

# iptables -L | grep DROP

 

 

룰이 지워진 것을 확인하였다.

 

추가로 centos7 기준으로 위의 룰은 /etc/firewalld/direct.xml 파일에 저장이 되며, 파일을 직접 수정하여 적용할 수도 있다.

 

 

# vi /etc/firewalld/direct.xml

 

<?xml version="1.0" encoding="utf-8"?>
<direct>
  <passthrough ipv="ipv4">-I INPUT -p tcp --syn --dport 80 -m connlimit --connlimit-above 24 -j DROP</passthrough>
  <passthrough ipv="ipv4">-I INPUT -p tcp --syn --dport 443 -m connlimit --connlimit-above 24 -j DROP</passthrough>
</direct>

엮인글 :
List of Articles
번호 제목 글쓴이 날짜 조회 수sort

XE Login