11.01.2013 Views

Workshop

Workshop

Workshop

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Socket to Me<br />

Previous Table of Contents Next<br />

Sometimes, a mere stopping and starting of a daemon won’t help. In the case of inetd, you may be in a<br />

situation where the cure may be worse than the disease. In such cases, you’ll need finer diagnostics.<br />

Enter netstat -a. This command is to network sockets what ps is to processes (remember from Hour 1,<br />

“The Telephone Analogy: Becoming Familiar with Basic Networking Concepts,” that a socket is like a phone<br />

extension that a service listens to for calls). netstat lists each socket that’s being used for a current<br />

connection or being listened to for a connection. It tells you whether things are backlogged, where they are<br />

backlogged from, and which socket is in use on both sides of the call. netstat -an will allow you to look<br />

at the numeric values only, which is valuable when you want to keep name services out of the picture. Let’s<br />

look at a specific example.<br />

Suppose someone calls and tells you that he can’t get into FROTZ. FROTZ is the Financial Remuneration<br />

with Overwhelming Trillions of Zeros system. He’s very important to your place of employment, Frobozzco,<br />

so you’re alarmed when someone can’t get in. The user at the other end of the line is incoherent with rage and<br />

will not answer any of your questions.<br />

You know by this person’s name that he’s in the Finance department. You can’t get an answer to the basic<br />

question “Are other people having problems?” Therefore, you decide to find out for yourself. You quickly<br />

check the network map and see that Finance lives on the subnet 200.1.1.0. In order to determine for<br />

yourself whether anybody else is having problems, you log in to the FROTZ UNIX host and type the<br />

following:<br />

netstat -a | grep 200.1.1<br />

You’re rewarded with this:<br />

Proto send-q recv-q Local Address Foreign Address (State)<br />

tcp 0 0 frotz.frob.com.telnet 200.1.1.10.1673 ESTABLISHED<br />

tcp 0 0 frotz.frob.com.telnet 200.1.1.25.1975 ESTABLISHED<br />

tcp 0 0 frotz.frob.com.telnet 200.1.1.27.1772 ESTABLISHED<br />

tcp 0 0 frotz.frob.com.telnet 200.1.1.29.1968 ESTABLISHED<br />

tcp 0 0 frotz.frob.com.telnet 200.1.1.33.1492 ESTABLISHED

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!