Wednesday, July 18, 2007

list out active host connection howto

Here's the dirty and quick way how to list out currently active and established host connection.

# netstat -nt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tcp 0 0 213.255.201.3:55366 216.155.193.182:5050 ESTABLISHED
tcp 0 0 213.255.201.3:59232 207.46.111.16:1863 ESTABLISHED
tcp 0 0 213.255.201.3:53297 213.255.201.9:22 ESTABLISHED
tcp 0 0 213.255.201.3:57768 213.255.201.17:22 ESTABLISHED
tcp 0 0 213.255.201.3:41423 64.233.185.19:80 ESTABLISHED
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Using the first line as example reference:

tcp = protocol used when connection was established
213.255.201.3 = local host IP address that the client is currently connected from
55366 = local port number assigned and used
216.155.193.182 = connected foreign host with his foreign IP address
5050 = foreign port number used by foreign host
last column = connection last seen status


Same goes by issuing alternative command:

# ss

This "ss" linux command translates port numbers to known protocols currently listed out by IANA. And which is mapped out as a /etc/services file in redhat distros. Check that file out.

As long as your box is connected to the net, there should always be an active connection between your host and another remote box.

0 comments:

Sign up for PayPal and start accepting credit card payments instantly.
ILoveTux - howtos and news | About | Contact | TOS | Policy