Use netstat command to view active TCP connections on Machine.
Determining Network Connections
The netstat command examines many of the kernel's tables that deal with network connections. One of its most useful applications is to list active network connections involving your machine. The netstat command will list active TCP connections and show active “UNIX domain” connections. UNIX domain connections are internal to one machine; they are a form of interprocess communication. For the purposes of this course, we will concentrate on TCP connections. View the diagram below to see an example of using netstat to view active TCP connections.
Number of Bytes
Report on TCP connections using netstat -P tcp command
The command `netstat -P tcp` is generally used to view TCP connections on Solaris systems. Here's how it works:
Breakdown of the Command
netstat: The core network statistics utility present in many Unix-like operating systems, including Solaris.
-P tcp: Flags instructing `netstat` to:
-P: Display information for a particular protocol (in this case, TCP).
tcp: Focus on the TCP protocol specifically.
Typical Output
The output of `netstat -P tcp` includes columns like:
Local Address: Your local machine's IP address and port number.
Foreign Address: The remote IP address and port number the connection is established with.
State: The current state of the TCP connection (e.g., ESTABLISHED, TIME_WAIT, CLOSE_WAIT).
Additional Notes on Solaris
More detailed information: On Solaris, you might need to use the `-a` and `-n` flags to get the most useful output. Try this as well:
netstat -an -P tcp
User and Process ID: You can use `netstat -u` to display the user and process ID associated with each network endpoint
Output of Netstat Command
The following diagram contanis an example of using netstat to view active TCP connections.