Saturday, 8 October 2016

Monitoring the TCP ESTABLISHED Connections


The following script tcpConnect.sh uses nestat to record the number of connection as well as the date and the time of the measurement.

cat /usr/local/src/tcpConnet.sh
#!/bin/bash
C=$(/bin/netstat -nt | tail -n +3 | grep ESTABLISHED | wc -l)
D=$(date)
printf "%s %s %s\n" "$C" "||" "$D"

crontab -l
*/5 * * * * /usr/local/src/tcpConnet.sh >> /var/log/tcpConnet.data

tail -5 /var/log/tcpConnet.data
25 || Sat Oct  8 11:10:01 PDT 2016
26 || Sat Oct  8 11:15:01 PDT 2016
23 ||  Sat Oct  8 11:20:01 PDT 2016
23 || Sat Oct  8 11:25:01 PDT 2016
23 || Sat Oct  8 11:30:01 PDT 2016

2 comments:

  1. Nice topics you have written here, It is important for the company to monitoring the record of connection and data. Find the place to fill the TCP license application for TCP license.

    ReplyDelete
  2. Monitoring TCP connections in the ESTABLISHED state is an important task in network management and security. A TCP connection reaches the ESTABLISHED state when a successful three-way handshake has been completed and data transfer between client and server is actively taking place. Tracking these connections helps administrators understand current network activity, detect unusual behavior, and troubleshoot performance issues.

    To monitor ESTABLISHED connections, system tools and utilities can be used to list active network sessions along with details such as source and destination IP addresses, ports, and process IDs. Common tools include netstat, ss, and lsof on Unix-based systems, which allow filtering connections by their state. For example, filtering only ESTABLISHED connections helps identify which applications are actively communicating over the network. Continuous monitoring can also reveal suspicious patterns such as unexpected remote connections, which may indicate unauthorized access or malware activity.
    Networking Projects for Final Year Students
    In addition to basic monitoring, advanced techniques involve using packet analyzers and network monitoring systems to inspect traffic in real time. This enables deeper analysis of data flow, bandwidth usage, and connection behavior. Logs and alerts can be configured to notify administrators when abnormal numbers of ESTABLISHED connections occur, helping prevent potential attacks like distributed denial-of-service (DDoS). Overall, monitoring TCP ESTABLISHED connections is essential for maintaining network reliability, performance, and security. Network Security Projects for Final Year Students

    ReplyDelete