Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Where does `netstat` gets its information from? 1

Status
Not open for further replies.

josel

Programmer
Oct 16, 2001
716
US
Hello everyone! HAPPY NEW YEAR !!!

Can someone tell me the source for `netstat`. Is this something one can edit without having to use the netstat command itself?

Thank you all in advance,

josel If you have the knowledge, consult and educate those who need it! - Jose Lerebours
 
You could easily get *Linux* source to netstat, but you aren't likely to get SCO's version any time soon.

Just what is it you want to accomplish? Orther tools, like "lsof" may give you what you need- and you CAN get source for that if you want it.
Tony Lawrence
SCO Unix/Linux Resources tony@pcunix.com
 
Actually, getting the source code would be neat but that is not what I meant (sorry, it's a gift I have). :)

I meant, when you type commands suchs as `netstat -nr` your route tables are displayed (destination, gateways, etc). I wonder where is this information kept and if it was at all possible to edit bypassing the `route` command.
of `man netstat` resamble what I am looking for.

Tks;

josel If you have the knowledge, consult and educate those who need it! - Jose Lerebours
 
I'm sorry but I at least am still not understanding what you want.

The actual routing info is in a kernel table somewhere- netstat extracts it. On a Linux box you can get at it through /proc/net/route, but I don't know of any equivalent for SCO- unless theres a "crash" macro that will dump it.
Tony Lawrence
SCO Unix/Linux Resources tony@pcunix.com
 
I guess you answered the question:

"The actual routing info is in a kernel table somewhere- netstat extracts it. On a Linux box you can get at it through /proc/net/route, but I don't know of any equivalent for SCO- unless theres a "crash" macro that will dump it."

If this is the case, I then cannot simply find an text file, use vi and edit it as you would /etc/hosts, /etc/gateways, etc.

Thank you for your assistance;

josel


If you have the knowledge, consult and educate those who need it! - Jose Lerebours
 
Loved the article, thank you! (actually, love the website)

I found the file /etc/default/tcp where my default route is listed, edited file and changed it. I had used `route` to change it, but I recall having done so (different server) and after reboot, the change was gone ...

Thank you very much for having taken the time and been so patient.

Regards;

Jose Lerebours If you have the knowledge, consult and educate those who need it! - Jose Lerebours
 
Note for the futre: if you had said immediately that you were running 5.0.6 and wanted to set your default route, I would have immediately told you about /etc/default/tcp.

The reason it took so long to get here is because you asked about other things :) No problem, and maybe it was all the more useful to you because of that, but if you want a quick, direct answer to a specific problem, say what you are trying to do- don't ask about things related to how you THINK it might be done.

It's the difference between saying "my car won't start" and "where can I get gas?". If you KNOW you need gas, fine. But if you don't really know that is the reason for your problem, you should instead be describing what happens when you turn the key.

My oft-repeated suggestion is:

State your OS and version (SCO 5.0.6)
State any hardware if applicable (N/A here)
State what you are trying to accomplish (set a default route)
State what you did (used "route add..")
Say what happened and what you expected to happen (it worked but didn't survive a reboot).

That will get you the quickest answers.

Tony Lawrence
SCO Unix/Linux Resources tony@pcunix.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top