Finding number of tracked connections by host
We had a problem with our network a few months ago, in which the router seemed to be running out of capacity to track connections. In order to try and identify the cause, I came up with this snippet that will display the number of currently tracked connections per-host on the Linux router. The first grep limits it to hosts that start ‘192.168.’, which is specific to the part of my network I was interested in:
conntrack -L | grep -o '=192\.168\.[0-9\.]\+ ' | sed 's/^src=//' | sort | uniq -c | sort -n -k1