N
N
NameOf Var2017-10-27 12:03:34
Programming
NameOf Var, 2017-10-27 12:03:34

How to get a list of IP addresses from a DHCP server?

I need to get a list of local IP addresses on my network. There is an IP address of DHCP, DNS servers. Is it possible to somehow get a list of IP addresses connected to them using .NET tools?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
S
Saboteur, 2017-10-27
@hax

No way.
The DHCP server issues information to the client that concerns this particular client, and not all other network members.
The administrator can view information about current leases through the DHCP admin panel, but leases is not a list of current IPs, it is a list of current leases. That is, the client appeared, requested an IP, worked and disconnected. The IP is still hanging on it. If another client connects, then the released IP can be given to him, depending on the expiration settings. But DHCP doesn't call clients "hey, are you online or not".
And for this you need to have the rights of the administrator of this DHCP.
If you are an admin - the API is available through the same powershell - see Get-DHCPServerv4scope | Get-DHCPServerv4Lease.

D
d-stream, 2017-10-27
@d-stream

I suggest that you first forget about programming, C # and .NET and simply describe what you want in words.
Minimum - having received from DHCP the address and a mask - it is possible to receive the estimated size of a network - possible addresses.
For example, DHCP issued
IP 192.168.199.48
MASK 255.255.255.0
GW 192.168.199.1
, thus we can assume that we are talking about a network 192.168.199.0/24 with addresses from 192.168.199.1 to 192.168.199.254
BUT: which range of these DHCP addresses gives - a question about its settings. Perhaps its pool is from 192.168.199.47 to 192.168.199.49 and possibly 192.168.199.2 to 192.168.199.254
DNS - well, theoretically, of course, clients can register in the local DNS, or maybe not ....
p / s / you can, of course, by pinging DHCP (at its level) sorting through the addresses, get responses like "address is busy", "address is invalid", "address issued" and indirectly conclude that:
- DHCP does not issue such and such addresses
- such- then we occupied (for this they can be beaten with a candlestick)
- such and such addresses were rented and perhaps now the host is connected, or maybe already turned off ...

V
Vadim Choporov, 2017-10-27
@tolstyiii

The mask is your network. If you have rights to read DHCP - without any problems, Posh to help (Export-DhcpServer) - a.k. Posh now refers directly to .NET, and this can be implemented on it without problems.
If there are no rights to DHCP, then it's sad, you need to assemble a bicycle. You can use network scanners (such as pinging), but again - it's not a fact that the ping is not disabled on the computer.
In short, if there are no rights to DHCP, you will not receive guaranteed accurate data. Plus, there may be static addresses with forbidden echo reply on the host - they will hang like a stone, FIG knows if the host works there or not, especially if there is a record in the DNS.

K
kisaa, 2017-10-27
@kisaa

https://www.google.ru/search?q=get+dhcp+leases

A
Alexander, 2017-10-30
@TemperOK

and ARP table is what is bad? Cleaned, filled and done.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question