Our company have a IDC (Internet Data Center), and in our IDC, there are many host machines, every host has 1-3 IPs.
There is a situation, such as one host machine has 3 IPs(eg. 102.23.33.1
-> 102.23.33.3
). (means in the host machine, have configured the IPs to it)
If the host machine only use 102.23.33.1
, and there free out the 102.23.33.2
and 102.23.33.3
. We want to find out the free IPs.
How can I do that? I tried to use the forloop to ping the whole IPs, but this is not accurate, because some host machine are baned for ping
.
EDIT
I means the host machine if has 3 IPs, and all can ping them, but the host machine only use the first IP to connect with public network, how can I find the other 2 IPs host machine do not use (or do not often use)?
EDIT-2
I mean the IPs all configured on the OS but may not be actually using them.
EDIT – 3
So, all the before, there can be understood as bellow:
I have a Router, and under it, there are many host machines, and every host machine have some IPs, and how can I record the IPs that go through the Router everyday.
Is there a tool for record the IPs which get through the Router? Or how can I realize my requirement ?
Best Answer
This adds a logging rule into the iptables FORWARD chain:
This searches for the matching packets:
The file name may depend on your Linux distribution.
And this generates a list of unique IP addresses seen by the forwarding chain in your router: