Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 04-23-2005, 01:51 PM   #1
LQ Newbie
Registered: Oct 2004
Posts: 4

Rep: Reputation: 0
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..
Old 04-23-2005, 03:12 PM   #2
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
You think there's a single "easy" step for discovering a whole network in c???? that's a huge task to do it properly.
Old 04-24-2005, 11:54 AM   #3
LQ Newbie
Registered: Oct 2004
Posts: 4

Original Poster
Rep: Reputation: 0
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...
Old 04-24-2005, 12:53 PM   #4
LQ Newbie
Registered: Aug 2004
Posts: 20

Rep: Reputation: 0
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.
Old 04-24-2005, 01:22 PM   #5
Senior Member
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,289

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you bridge networks on linux? Or share a network's internet connection? pugsley1218 Linux - Networking 1 11-14-2005 05:36 AM
How do I run a script when network's brought up in Debian? nazdrowie Linux - Networking 6 11-04-2004 04:16 PM
QLA2312 Topology Setting pomalley Linux - Software 0 10-06-2004 05:35 PM
What are a network's capabilites Travis86 Linux - Networking 4 03-03-2003 11:44 PM
Network Topology chaste Linux - Networking 6 08-06-2002 10:27 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:40 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration