• Linux

    List all IP addresses connected to Server

    Below is an example of Unix command to list all the IP addresses connected to your server on port 80. You can customize for another port. netstat -tn 2>/dev/null | grep :80 | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr | head Output – Total connections by IP, from highest to lowest. 97 114.198.236.10056 67.166.157.19444 170.248.43.7638 141.0.9.2037 49.248.0.237 153.100.131.1231 223.62.169.7330 65.248.100.25329 203.112.82.12829 182.19.66.187 Note This command is useful to detect if your server is under attack, and null route those IPs. Read this null route attacker IP story. Let break above lengthy command into pieces : 1. netstat -tn 2>/dev/null Uses netstat…