-   Programming (
-   -   finding out network's topology (

vrikers 04-23-2005 01:51 PM

finding out network's topology
what easy steps exist for finding what the network topology looks like (bus, ring, star ...) using unix c programming?

the ideea is to find this out from a single node in the network. are there any more commands like 'traceroute', 'ping' or 'netstat' ? anything helpful ... and how can it be used for solving this problem..

acid_kewpie 04-23-2005 03:12 PM

You think there's a single "easy" step for discovering a whole network in c???? that's a huge task to do it properly.

vrikers 04-24-2005 11:54 AM

nope, i know it's not ... easy. i was talking about more than one single step.

it's actually all reduced to knowing if there's a direct connection between two nodes of the network. but i don't see how exactly this could be done...

rununix 04-24-2005 12:53 PM

i would imagine you would have to do it in steps like this:

scan the whole subnet that you are in based on your ip address and build a routing table

or get the routing table from your servers if there is a way for that.

btmiller 04-24-2005 01:22 PM

I'm not sure why a "normal" application should care what the topology of the network is. Just so long as the packets it needs all arrive/depart successfully it shgould be all good :). Still, if you're going to do this programatically, one way to approach it would be to understand how enterprise class routers and switches figure out topologies. Basically there are a number of protocols that routers and switches understand. Since you're working in layer 2, it seems, the one you're probably most interested is STP (spanning tree protocol, which pretty much every high end switch will support).

Depending on the network switches, you might be able to query their forwarding tables. You might also be able to do this by querying the switches via SNMP.

Of course, if you have a topology that doesn't have switching gear (e.g. a ring) this will obviously not work. In that case, I would follow rununix's suggestion of trying to figure it out from the routing table. I think it'd be messy though.

All times are GMT -5. The time now is 08:26 AM.