How to find all IPs bound to a machine that are not hosting sites
This command can be used to find free IPs on a non-panel Linux server.
echo System has $(ifconfig | grep “inet addr:” | grep -v 127.0.0.1 | awk ‘{print $2}’ | sed s/”addr:”// | sort -n > /tmp/boundips && cat /usr/local/apache/conf/httpd.conf | grep “”$// | sed s/”>”$// | sort -n | uniq > /tmp/usedips && diff /tmp/boundips /tmp/usedips | sed -n /^”< “/p | sed s/^”< “// | wc -l) free IPs: && diff /tmp/boundips /tmp/usedips | sed -n /^”< “/p | sed s/^”< “// && rm -f /tmp/boundips /tmp/usedips
Note: On a cPanel server, there is a tool called “Rebuild the IP address pool”, which performs the same function.