Banning / Unbanning / Listing ips.

Banning an IP
iptables -I INPUT -s [ipaddress] -j DROP

Unbanning and IP
iptables -I INPUT -s [ipaddress] -j ACCEPT

Listing the last five ip’s with the most connections
netstat -atnp -A inet | grep “:80″ | awk -F ” ” ‘{print $5} ‘ | awk -F “:” ‘{print $1}’ | sort | uniq -c | sort -nr | head -5

Listing total connections
netstat -nap | grep ESTABLISHED | wc -l
netstat -nap | grep SYN | wc -l
netstat -nap | grep TIME_WAIT | wc -l

———-

If Apf firewall is installed on server then –

Accept IP –
apf -a [ip address]

Decline IP –

apf -d [ip address]

———–
IF shorewall is installed

Decline Ip –

shorewall drop [ip address]

Leave a Reply

You must be logged in to post a comment.