Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)

I need help for it.
How can i find ip adresses of the device that directly connected to my pc ethernet adaptor (DHCP)


What I have tried:

A Small DHCP Server Using UDP With Asynchronous Callbacks and Events[^]
Posted
Updated 13-Nov-17 1:01am

You should ask here Add a Comment or Question[^], so that the author of the article [^] gets notified and replies for your post.
 
Share this answer
 
When using a DHCP server for a network segment, that will know about all systems that are actually present or have been present a short time ago (it will not be informed when a client shuts down).

But you can have only one DHCP server. If you want to know about the IP addresses assigned by DHCP, you have to add such functionality to the server (e.g. by implementing a request method) or check the log files generated by the server.

In a common network setup, the DHCP server is usually running on the gateway system (router) or another local server. Then it is impossible to query his internal table which holds the assigned IP addresses.

There is no absolute relibale method to get the IP addresses of all systems in a local network. One problem is that when some activity from a system has been detected, it might have been switched off meanwhile. The other problem is detecting all systems.

There are some methods that might be used:

ARP (Address Resolution Protocol - Wikipedia[^]).

You can use the arp command line utility to show the ARP table (use arp -? to show the available options):
arp -a
or
arp -av
The latter will also show old (invalid) IP addresses. Functionality can be implemented by applications by reading the ARP table using API functions, WMI, or parsing the output of the utility.
Problems:
Finds only systems that has communicated with the system running the arp command.

Network Status
This can be used to get the IP adresses of all current connections. The output has to be filtered for local addresses. See the Netstat[^] command line utility. May also use WMI or API calls to get the information.
Problems:
Only active connections. Requires system privileges for connections owned by the system or other users.

Packet sniffing
Use a packet sniffer to inspect all packets on a network interface using promiscuous mode.
Problems:
Will not see all packets when using a network switch (packets to other systems might not be forwarded to the interface by the switch).

Port scanning
Try to connect to specific ports and / or ping on all possible IP adresses.
Problems:
Not all systems might respond (no services running on used ports, requests are filtered).

DNS Queries
If you have a DNS server running for your local network, you can query that for all possible IP addresses. This is especially useful when the DNS server is feeded by the DHCP server (as with most SOHO routers).
Problems:
Returns addresses for all systems even for those that are not up or does not exist anymore.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900