LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 04-23-2005, 12:51 PM   #1
vrikers
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, 02:12 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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, 10:54 AM   #3
vrikers
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, 11:53 AM   #4
rununix
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, 12:22 PM   #5
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

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.
 
  


Reply



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 04:36 AM
How do I run a script when network's brought up in Debian? nazdrowie Linux - Networking 6 11-04-2004 03:16 PM
QLA2312 Topology Setting pomalley Linux - Software 0 10-06-2004 04:35 PM
What are a network's capabilites Travis86 Linux - Networking 4 03-03-2003 10:44 PM
Network Topology chaste Linux - Networking 6 08-06-2002 09:27 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:49 AM.

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