Forum Moderators: phranque
The firewall works, but I don't know how to find out which IPs to block.
Here's a small example, in which the IPs have been changed:
[root ~]# netstat ¦ grep tcp
tcp 0 0 mydomain.com:http pool-1.1.1.1.ph:55479 TIME_WAIT
tcp 0 0 mydomain.com:http pool-1.1.1.1.ph:55478 TIME_WAIT
tcp 0 0 mydomain.com:http pool-1.1.1.1.ph:55477 TIME_WAIT
tcp 0 0 mydomain.com:http pool-1.1.1.1.ph:55487 TIME_WAIT
tcp 0 0 mydomain.com:http pool-1.1.1.1.ph:55486 TIME_WAIT
tcp 0 0 mydomain.com:http pool-1.1.1.1.ph:55485 TIME_WAIT
tcp 0 0 mydomain.com:http pool-1.1.1.1.ph:55485 TIME_WAIT
tcp 0 0 mydomain.com:http pool-1.1.1.1.ph:55484 TIME_WAIT
tcp 0 0 mydomain.com:http pool-1.1.1.1.ph:55483 TIME_WAIT
tcp 0 0 mydomain.com:http pool-1.1.1.1.ph:55482 TIME_WAIT
tcp 0 0 mydomain.com:http pool-1.1.1.1.ph:55481 TIME_WAIT
tcp 0 0 mydomain.com:http pool-1.1.1.1.ph:55480 TIME_WAIT
tcp 0 0 mydomain.com:http 1.1.1.2:4276 TIME_WAIT
tcp 0 0 mydomain.com:http 1.1.in-addr.arpa:1493 TIME_WAIT
tcp 0 0 mydomain.com:http 1.1.in-addr.arpa:1495 TIME_WAIT
Should I block requests from 1.1.1.1? Is that the bad guy? Should I look for patterns like that?
You should repeatedly call netstat -n and look for patterns. Often DOS attacks don't complete the synchronization phase and let the connection stay in a state called SYNC_WAIT. The goal is to fill your TCP connections buffer which will make new connections impossible. If you see more than one connection from a specific IP which stay in this state, it is probably an attacker.
You should still be careful, because SYNC_WAIT is a legitimate state for all TCP connections which lasts for a period of about 100 msec before the real connection is established, so you may see once in a while normal connections in this state.