网络拓扑信息

发布于 2024-10-01 07:27:34 字数 320 浏览 3 评论 0原文

我有一个小型企业网络,有几个交换机、终端设备,但只有一个路由器。我想像图表一样显示网络拓扑(路由器位于顶部)。

我只能访问网络层地址,因此我设法为网络上的每个设备获取其 ip 地址和 ip 网络,即设备具有的每个接口的 192.168.2.9 和 192.168.2.0(掩码 255.255.255.0)。

我的猜测是我可以分析数据并建立网络的逻辑连接。所以,我想问的是我是否走在了解网络拓扑的正确路径上(至少是逻辑连接)。

这一切都是以编程方式完成的(c 和 Objective-c),并且用于学校项目。

另外:有谁知道任何可以绘制(鉴于此信息)拓扑的库吗?

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 i.e 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

万人眼中万个我 2024-10-08 07:27:34

这样您就已经拥有了每台设备的 IP 地址,这是一个有用的开始。从那里,“手动算法”可能是:

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

您正在做的是将您自己和设备之间的每个网络跃点添加到图形结构中。如果已找到节点(跳),则添加新边。如果没有,则添加一条边和一个顶点。最终结果将是网络上每个节点的图表以及到达它们的路径 - 您的拓扑。

因此,您所要做的就是自己实现跟踪路由,构建图形结构来存储跟踪路由运行的结果,然后制作一些东西来很好地绘制它!其中每一个都可能产生许多自己的问题。

当你给这个 Objective-C 贴上标签时,我会假设你是在 Mac 上做这件事。如果是这样的话,Cocoa 的绘图 API 可以很好地满足您的图形需求。

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.

枫林﹌晚霞¤ 2024-10-08 07:27:34

对于绘图,最简单的方法可能是以点形式输出文件,然后使用 graphviz 绘制它。

For graphing the easiest approach might be to output a file in dot and then graph it with graphviz.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文