Network topology information

I Have a small business network with a couple of switches, end devices but only one router. I want to display the network topology like a graph would like (with the router on top).

I'm only have access to network layer addresses, so I managed to obtain for every device on the network it's ip address and ip network ie 192.168.2.9 and 192.168.2.0 (mask 255.255.255.0) for every interface that device has.

My guess is that I could analyze the data and build up the network's logical connections. So, What I want to ask is if I'm on the right path to know the network topology (at least for it's logical connections).

This is all done programmatically (c, and objective-c) and is for a school project.

PLUS: Does anyone know any library that would draw (given this information) the topology?


So you have every device's IP address already, a useful start. From there, a 'manual algorithm' might be:

for each ip in devices
  traceroute ip
    for each hop in traceroute
      add hop to graph (if it's not there already)

What you're doing is adding each network hop between yourself and the device to a graph structure. If a node (hop) is already found, then you add a new edge. If not, you add an edge and a vertex. The end result will be a graph of every node on the network and the paths taken to reach them - your topology.

So all you've got to do is implement traceroute yourself, build the graph structure to store the results of your traceroute runs and then make something to plot it all nicely! Each of these could generate many questions of their own.

As you've tagged this Objective-C I'll make a leap and assume you're doing this on a Mac. If that is the case, your graphics needs are met nicely with Cocoa's drawing API.


对于图形来说,最简单的方法可能是以点形式输出文件,然后用graphviz将其图形化。

链接地址: http://www.djcxy.com/p/70122.html

上一篇: Android设备上保存的网络是否有唯一标识符?

下一篇: 网络拓扑信息