Knowledgebase

Portal Home > Knowledgebase > Articles Database > Quick IPTables Commands


Quick IPTables Commands




Posted by rankris, 08-01-2009, 07:53 PM
Quick IPTables Commands List: iptables -L -n | grep Remove: iptables -D INPUT -s -d -j DROP Insert: iptables -I INPUT -s -j DROP Flush: iptables -F Remove: iptables -D OUTPUT -s 0.0.0.0/0 -d 66.93.33.185 -j DROP netstat -nap | grep :80 | wc –l (shows # of connections to HTTP) netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort –n (shows total connections per IP, if more than 100 block)

Posted by Beast5, 08-01-2009, 08:10 PM
Hey, you forgot the most important part. # iptables-save !!!!!!!!!!!!!!! these commands are ok , but they load the chains/rules into the ram memory only and wont hold after a server reboot, you must run the save commend in order to keep your settings. thank for the nice tips , im sure its golden for some people here!

Posted by rankris, 08-01-2009, 08:24 PM
Ahh, forgot that stuff, thanks for reminding

Posted by mugo, 08-01-2009, 10:55 PM
what I do... I keep a text file with my "config". At the top, it flushes, then reads in all rules, then saves, and prints out to stdout (for my viewing pleasure). I simply add offending IP's / Networks, re-run the script. Bam. Done deal. I also have a custom country-ban with particular hack-ish countries blocked as an include file. Has cut down brute forces and dictionaries by about 80%. APNIC is the *worst*. Ugg.



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
apache update error (Views: 616)
Block based on domain (Views: 619)
Am I already hacked? (Views: 634)
Network Security (Views: 556)


Language:

Contact us