I want list all the ip addresses that are used in a subnet and who is using them. I want to do that via the Google console (or gcloud command). Point is that I do not want to do a ping against all the ip's in the subnet to find that out - I am aware of this process but it is not practical when you have a large setup.
Another reason to ask for doing this via Google Console is that we can do this very easily using Azure Portal.
Hoping someone can help. Thanks !
Ping is not a reliable method to determine IP address usage. Ping requires the ICMP protocol to be enabled which is often not the case.
Internal IP addresses are either statically allocated, which you can list, or DHCP allocated, which you cannot list.
No single command will meet your objective. The closest is gcloud compute addresses list, which only lists statically allocated IP addresses.
You could use a combination of commands such as
gcloud compute instances listandgcloud asset listto create a list of resources and then parse IP addresses.In summary, you must write a script that combines commands and parses the output. It might be easy in Azure, but in Google Cloud, there are numerous network adapters, interfaces, connectors, gateways, proxies, etc and no command provides a single method of listing all IP addresses.
Once you have created a list it will become obsolete as soon as a service is launched (started/created/rebooted) or reconfigured. The VPC environment is predominately dynamic.