How do I use Netstat to see connections

How do I use Netstat to see connections

Netstat has some very useful command line switches that help show the connections into a server.  If you are seeing many TCP TIME_WAITs that are not going away then that tends to indicate an issue, many times a box low on resources tends to build up TIME_WAITs because the machine does not have enough resources to handle the incoming connections along with clean up old connections.

Some examples.  Please note that there are slight differences between the output on linux and windows.


netstat -a  (this list can be very long on busy machines, this is just a small snip it)

Linux:
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 localhost:smtp          *:*                     LISTEN      
tcp        0      0 *:microsoft-ds          *:*                     LISTEN      
tcp        0      0 *:netbios-ssn           *:*                     LISTEN      
tcp        0      0 *:ssh                   *:*                     LISTEN      
tcp        0      0 localhost:ipp           *:*                     LISTEN      
tcp        0    224 webnet3:ssh             172.16.5.69:44122       ESTABLISHED 

Windows:
Active Connections

  Proto  Local Address          Foreign Address        State
  TCP    0.0.0.0:135            webnet4:0              LISTENING
  TCP    0.0.0.0:445            webnet4:0              LISTENING
  TCP    0.0.0.0:1099           webnet4:0              LISTENING
  TCP    0.0.0.0:1494           webnet4:0              LISTENING
  TCP    0.0.0.0:3306           webnet4:0              LISTENING
  TCP    0.0.0.0:3389           webnet4:0              LISTENING
  TCP    0.0.0.0:3390           webnet4:0              LISTENING
  TCP    0.0.0.0:4500           webnet4:0              LISTENING
  TCP    0.0.0.0:8090           webnet4:0              LISTENING


To count all connections that are connected to the machine.
netstat -an | wc -l   (linux only command)

To count all connections that are on port 80
netstat -an | grep :80 | wc -l  (linux only command)


A nice feature do to the extra utilities on linux can create a summary of connections.
netstat -ant | awk '{print $6}' | sort | uniq -c | sort -n
      1 Foreign
      1 TIME_WAIT
      1 established)
      3 ESTABLISHED
     22 LISTEN

To show all listening ports
netstat -l

To get a list of statistics 
netstat -s

To show the process ID of the connection.
netstat -p   (linux)
netstat -b  (windows)



Additional URLs 
https://www.exchangecore.com/blog/find-number-active-connections-linux-using-netstat/
http://www.binarytides.com/linux-netstat-command-examples/

    Can't find the KB

    Unable to find the KB to address your issue ?  

      • Recent Articles

      • Lenovo Unified Workspace End-of-Life Questions and Answers

        Will the shutdown of LUW servers and access to downloads affect my server licensing? No, the shutdown of the customer servers and access to the product and licensing downloads will not affect your server licensing. This license is downloaded and ...
      • How do I determine my Unified Workspace license expiration date?

        The best method for determining the licensing information including the expiration date of your Unified Workspace license: Login to your 8090 management console on each server This may take remoting into each LUW server and relay, opening a browser, ...
      • Lenovo Unified Workspace 7.0.2.13 Released

        Highlights of Unified Workspace 7.0.2.13 Before you install: Please view the installation notes here. 7.0.2.13 requires a 7.0 license file. Below is a list of enhancements and fixes released in Unified Workspace 7.0.2.13 Fixed external storage ...
      • LanSchool Documentation Guides

        LanSchool Classic Teacher Console The LanSchool Teacher Console is the interface teachers will use to manage their classroom and students. It contains all the tools necessary for a teacher to effectively interact with students and create a ...
      • Lenovo Unified Workspace 7.0.1.41 Released

        Highlights of Unified Workspace 7.0.1.41 Before you install: Please view the installation notes here. 7.0.1.41 requires a 7.0 license file. Below is a list of enhancements and fixes for Unified Workspace 7.0.1.41 Updated Log4j Updated Java Updated ...
      • Related Articles

      • TIME_WAITs in Netstat report

        ISSUE When I run a netstat, I see most of the connections to our UW server are in TIME_WAIT status.  How can I get those to close and open ports for connection again? SOLUTION By default the TCP Timed Wait Delay is 240 seconds.  When you find that ...
      • Built up connections and high CPU

        We have discovered a problem at some customer sites where connections build up which eventually leads to a high CPU state on the webNetwork relay server. The problem comes from a bug in SSL , Java and Jetty (the internal web server used in ...
      • Number of connections for webRDP Client

        Question: How many RDP connections can my users make, through Unified Workspace, using the webRDP client? Solution: As the webRDP client is very resource intensive, for the UW relay server, we've found that the each relay can handle approximately ...
      • Unable to see database connection in Report Builder

        You must add each uers/group to have access to those database connections. WebNetwork 5 has added security to see the database connections.
      • Using Web Monitor to see current number of active sessions

        Question: How can I see the number of users that are currently logged into the system? Solution: Using Web Monitor to see current user Sessions. Launch webAdmin. Expand Utilities. Click the Web Monitor option. This will show you the total number of ...