Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Easiest way to find free IPAddress in current subnet?

What is the easiest way to find the next unused IP address on a local adaptors subnet?

IPAddress GetNextFreeIP(NetworkInterface intface)
{
    ...?
}

Update
I've written a BOOTP/TFTP server that could be used in many different scenarios (cross-over cable, small private network, large corporate network). I have to give the small embedded system I'm updating an IP address and would like to find a spare one for it to use...

like image 604
Tim Avatar asked Nov 06 '22 16:11

Tim


1 Answers

If you have DHCP-managed IP ranges, you have an instance you can talk to - the DHCP server (like David recommended)

If you don't have managed IP ranges and no other instance you can talk to, there is no reliable way to tell if an IP is used or unused. IP does not offer such a service itself.

like image 54
Thorsten79 Avatar answered Nov 13 '22 18:11

Thorsten79