How to monitor incoming and outgoing network connections in Linux servers

April 19, 2024 / How-to Guide

This guide explains how to monitor incoming and outgoing network connections in Linux servers. As a Linux or system administrator, it is crucial to monitor both incoming and outgoing network connections on your servers. This awareness is invaluable for troubleshooting server-level issues effectively.

In Unix-like systems, the netstat command proves indispensable for this task. Offering a plethora of options, netstat simplifies the process by allowing you to observe incoming and outgoing TCP and UDP connections, as well as listing all other UNIX connections. This command is a foundation in diagnosing and resolving network-related issues efficiently.

Before proceeding with the following commands, it is vital to have root access to your server. This means logging in as the root user to execute these commands-

  1. To monitor all active network connections, including TCP, UDP, and Unix connections, use the following command-
    netstat –a

    The command above will generate an output detailing all network connections, along with their respective addresses and states.

  2. Command to exclusively monitor TCP port connections-
    netstat -at
  3. Command to exclusively monitor UDP port connections-
    netstat -au
  4. Furthermore, we can utilise the netstat command to list listening ports. The command to list all listening ports is-
    netstats -l
  5. Command to list all listening TCP port connections-
    netstats -lt
  6. Command to list all listening UDP port connections-
    netstats –lu

In this manner, you can monitor incoming and outgoing network connections in Linux servers. If you encounter any issues, feel free to contact our support staff.

 

Dominos Search