I have a problem finding local IP address in NodeJS. The best solution I have found so far is to call the os.networkInterfaces()
method (or ifconfig
) and simply parse the results checking if family == 'IPv4'
and internal == true
. The problem is, when we have an VM installed with a virtual network interface, we get two such addresses and there is no way (or is there?) to distinguish which one is the 'real' one.
Any idea how to do it?
Thanks in advance