How to detect IP in a network?

This is mini-project for my internship. They wanted a program to show the IP of devices within the network and later to show the bandwidth usage of each IP. They just gave me the project to keep me occupied here while waiting for other tasks.

My question is, where do I start? Reading materials, sample codes would be helpful, or basic logic and flow. Total newbie when it comes to network related codes.
What IP are you looking for to find ? Your computer IP address (could be more than one) or external IP address (that every website can see) ?.
Howdy,
If I understand correctly it's a VERY difficult task.

In order to get the IP addresses of all devices on the network you will have to either listen on an un-switched network for traffic, listen on a switched network (99% of networks) for broadcast packets OR have the machine running your software act as a proxy/router for all network traffic.

In order to determine the bandwidth use of a device on the network you either have to install software directly on that device, or have that device's traffic routed through a machine running your software. So either build them a proxy/gateway server, or install your software on EVERY device that want to monitor.

Honestly, unless you're an expert level C++ developer with 5+ years of professional experience I'd be looking for a more viable project.
Last edited on
Hmm, I've read some e-books and they talks about the IP stuff which I am still trying to get a feel on it. So my best guess is the external, or basically the IP that can tell the number of devices that is connected to the network.

Owh found this one on the web, would it help me?

http://www.codeproject.com/Articles/2106/How-to-get-the-clients-IP-address-using-TcpClient
That won't help you. You need to look at networking topology and switched networks. This is only like 10% programming and 90% networking. That link is not going to be helpful.
Ouch, got it. Networking topology and switched network.
Wireshark sort of does this. Run a trace on a busy network. There's some analysis tools within Wireshark that'll graph stuff; one of them is kind of what you want.

Play around with it and you'll get a feel for what needs to be captured and how to process that information. As Zaita said, it isn't really a programming task.
Ok thanks. Lazy question, is there any network monitoring tools that allows you to see their codes? an open source perhaps. Or libraries that I can use? I need more info before I can dive in into the network world.
is there any network monitoring tools that allows you to see their codes? an open source perhaps. Or libraries that I can use? I need more info before I can dive in into the network world.
Did you look at Wireshark?
GaGoKoYa,

I think kbw gave you good advice. If you learn Wireshark, read some RFCs(like 1180, the tcp/ip tutorial, 792 the ip protocol, 791 the ipmp protocol) from ietf.org, and and a few relevant sections from a good computer networks textbook(probably paying good attention to the sections on subnetting) you can do this! It may sound like a lot, but as Zaita intimates, you need expert knowledge to accomplish this task. My suggestion is not optimal, but one of many possible solutions. Rise to the occasion GaGoKoYa. Good luck Son(Daughter)!
Honestly, unless you're an expert level C++ developer with 5+ years of professional experience I'd be looking for a more viable project.

yup, me too. but again it just a filler tasks for me to do while waiting. it is a VERY difficult task for me who have the basic c ~~

but luckily i have people like u guys ^^ and my professor. i manage to get a working-ish program which works fine in my home pc. but not in the internship place due to windows error. works fine in linux.

for the bandwidth part, i used a code i got from my professor (which is so long), but it does the job.

and so. thanks all.
Last edited on
This'll get you the physical adapters and the addresses associated with each adapter.
http://msdn.microsoft.com/en-us/library/windows/desktop/aa366062%28v=vs.85%29.aspx
@kbw

I will break down the codes into parts later, and the link will be useful for that purpose. thx.
Even using Wireshark is not going to solve the fundamental flaw in this software.

Switched networks do NOT distribute packets to all other nodes on a network (routed networks are even stricter). Unless EVERY device on the network is running the same software, and that software supports broadcast response (e.g file sharing) it's pretty much impossible to map the entire network without doing comprehensive IP scanning (even this is unlikely to work in large networks because of subnetting and routing rules).

1st requirement: Get IP addresses on ALL devices on the network.
Solution 1. Get a list of all static IPs from network administrator, install listening software on DHCP server or intercept it by putting the DHCP server behind a proxy.
Solution 2. Install a proxy/gateway server for the internet connection. This will only give you IP addresses of devices using the Internet.

2nd requirement: Get Bandwidth utilitisation for devices on network
Solution 1. Write software and install it on EVERY switch/router in the network. Then have this software report to a centralised server running custom software.
Solution 2. Install a proxy/gateway server for the internet connection. Install monitoring software on this. This will only allow you to track bandwidth of connections using the Internet, not local or wide area networks.


Again,I HIGHLY recommend you ask for a more viable project.
@Zaita ^^ no worries.

Update on OP:

I don't plan to map the entire network, just until the 1st level (routers). The bandwidth usage will be taken per router/switch. Now I just need to do my stuff which is to create an interface that read all the data then create the report that they need. (~~ there are software that can do this, but... that life)

This topic was for me to have a little bit knowledge about the network codes so that I won't be too blind or clueless when I see them. What does the codes do, how does it work, the flow of thing and so on.

Thanks to all the reply to this post and throwing in their brain.
Topic archived. No new replies allowed.