L
L
largotek2014-03-16 14:13:24
DHCP
largotek, 2014-03-16 14:13:24

How to get (or create) a free ip address in LAN?

Hello dear experts.

Here is such a problem. I am writing a module for a product, and when applications that listen to some ip (read servers) are launched, it should make the server listen to another ip.

Example:

Apache starts when it writes calls the bind() function to register that it is listening on port 80 and some kind of ip, or rather the ip that the system gave it, and the system, in turn, wi-fi router, router, provider and etc.

I have written an lsp provider that intercepts these calls. And at runtime, bind() changes ip from what it was by default to [U]its own.[/U] In order to add a new IP to the system, I use AddIPAddress, and then another ip appears on my network card address, but virtual.

Attention, question. How do I know which ip address to add? To be in the subnet.

At first I thought that I need to ask the dhcp server for information, but the dhcp server does not always happen.
Maybe check the ip range in LAN and choose a free one. Tell me, please!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2014-03-16
@OLS

There is probably no 100% solution. Any host on the network can fully own the IP and still not send or even respond to ICMP.
Try to monitor the ARP table of the local network for an hour or two:
www.rsdn.ru/forum/winapi/13779.flat
The bulk of the workstations will be noted in it.
Then, for a guarantee, you can scan the identified range
and then study the ARP table again.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question