Skip to content

조회 수 9207 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

Check whether it shows lot of SYN_WAIT / TIME_WAIT / FIN_WAIT. If yes its due to the high number of connections. You can reduce these by adding some rules to the Iptables.

# iptables -A INPUT -p tcp --tcp-flags SYN,FIN SYN,FIN -j DROP
# iptables -A INPUT -p tcp --tcp-flags SYN,RST SYN,RST -j DROP
# iptables -A INPUT -p tcp --tcp-flags FIN,RST FIN,RST -j DROP
# iptables -A INPUT -p tcp --tcp-flags ACK,FIN FIN -j DROP

# service iptables save
# service iptables restart

Adding rules to sysctl.conf

Also you can reduce these by adding some rules to sysctl.conf, the details given below.

# echo 1 > /proc/sys/net/ipv4/tcp_syncookies

Put following in /etc/sysctl.conf

# Enable TCP SYN cookie protection
net.ipv4.tcp_syncookies = 1

# Decrease the time default value for tcp_fin_timeout connection
net.ipv4.tcp_fin_timeout = 30

# Turn off the tcp_window_scaling
net.ipv4.tcp_window_scaling = 0

# Turn off the tcp_sack
net.ipv4.tcp_sack = 0


Then execute the command :

A quick and usefull command for checking if a server is under ddos is:

# netstat -anp |grep 'tcp\|udp' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n

Reference : http://linuxhow2.net/?p=9


# Set default policies
/sbin/iptables -P INPUT ACCEPT
/sbin/iptables -P OUTPUT ACCEPT
/sbin/iptables -P FORWARD DROP
/sbin/iptables -F
/sbin/iptables -F INPUT
/sbin/iptables -F OUTPUT
/sbin/iptables -F FORWARD
/sbin/iptables -F -t mangle
/sbin/iptables -X
/sbin/iptables -A INPUT -i lo -j ACCEPT
/sbin/iptables -A INPUT -d 127.0.0.0/8 -j REJECT
/sbin/iptables -A INPUT -i eth0 -j ACCEPT
/sbin/iptables -A INPUT -m state --state INVALID -j DROP
### chains to DROP too many SYN-s ######
/sbin/iptables -N syn-flood
/sbin/iptables -A syn-flood -m limit --limit 100/second --limit-burst 150 -j RETURN
/sbin/iptables -A syn-flood -j LOG --log-prefix "SYN flood: "
/sbin/iptables -A syn-flood -j DROP

Reference : http://www.webhostingtalk.com/archive/index.php/t-355411.html


List of Articles
번호 제목 글쓴이 날짜 조회 수
68 간단한 보안 설정 (TCP Wrapper) ADMINPLAY 2009.05.22 8944
67 홈페이지 변조 대처법 (FTP 계정을 이용한 아이프레임 코... ADMINPLAY 2009.10.15 9047
66 리눅스용 백신 AVG ADMINPLAY 2009.06.04 9092
65 rootkit 검색 프로그램 rkhunter-1.2.9.tar.gz file ADMINPLAY 2009.09.22 9196
» iptables/sysctl을 이용하여 DDOS SYN 공격 방어하기 ADMINPLAY 2009.05.28 9207
63 웹취약점 점검 ADMIN 2008.11.25 9258
62 해외에서 접근하는 IP 차단하기 ADMINPLAY 2009.11.30 9262
61 iptables 명령어로 ip 차단 법. ADMINPLAY 2009.05.28 9286
60 보안서버 SSL 구동시 비밀번호 자동 입력 및 부팅시 자동 ... ADMINPLAY 2009.03.23 9318
59 mod_security 설치 2.X ADMINPLAY 2009.06.04 9413
58 mod_evasive를 이용한 웹Dos 공격을 막자 ADMINPLAY 2009.05.07 9429
57 rootkit 검색 프로그램 rkhunter-1.3.4.tar.gz file ADMINPLAY 2009.09.22 9449
56 apache 웹방화벽 modsecurity용 웹설정 툴, Remo file ADMINPLAY 2009.09.09 9452
55 SSL 인증서문제 ADMINPLAY 2009.07.19 9480
54 DOS Attack을 막기 위한 간단한 방법 ADMINPLAY 2009.05.22 9572
53 스위칭 허브 상에서의 sniffing 툴 file ADMINPLAY 2009.09.08 9583
52 find 명령어 활용(보안관련) ADMINPLAY 2009.08.08 9602
51 리눅스 - iptables NAT rule ADMINPLAY 2010.03.24 9672
50 64bit 시스템에 ssl 설치 후 실행 시 X509_free 오류 ADMINPLAY 2009.07.19 9705
49 Linux Security ADMINPLAY 2009.07.18 9755
Board Pagination Prev 1 2 3 4 5 Next
/ 5

Copyright ADMINPLAY corp. All rights reserved.

abcXYZ, 세종대왕,1234

abcXYZ, 세종대왕,1234