Network/Tools

From LunaSys
Revision as of 12:49, 21 March 2012 by Eadam (talk | contribs) (Created page with "== Nice commands == taken from: - [http://www.cyberciti.biz/tips/linux-investigate-sockets-network-connections.html] - [http://www.cyberciti.biz/tips/netstat-command-tutori...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Nice commands

taken from:

- [1]
- [2]

useful to find out if your server is under attack or not. You can also list abusive IP address using this method.

# netstat -nat | awk '{print $6}' | sort | uniq -c | sort -n

Dig out more information about a specific ip address:

# netstat -nat |grep {IP-address} | awk '{print $6}' | sort | uniq -c | sort -n

To print list of all unique IP address connected to server, enter:

# netstat -nat | awk '{ print $5}' | cut -d: -f1 | sed -e '/^$/d' | uniq

If you think your Linux box is under attack, print out a list of open connections on your box and sorts them by according to IP address, enter:

# netstat -atun | awk '{print $5}' | cut -d: -f1 | sed -e '/^$/d' |sort | uniq -c | sort -n