#netstat -r
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
66.193.212.0 * 255.255.255.0 U 0 0 0 eth0
192.168.8.0 * 255.255.255.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 0 0 0 eth0
default 66.193.212.1 0.0.0.0 UG 0 0 0 eth0

It will give the information about the IP table routing information.

Here flags indicate the stat.

u- Interface is up
G- Not a direct entry.
O- No ARP at this interface.

Below script will give you the count of the IP address which is having a concorrent connection to the server.

netstat -plan | grep tcp | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n

6 74.67.169.174
6 89.32.176.108
7 174.6.50.6
7 91.194.84.106
12 73.85.58.214
14
24 0.0.0.0

After finding the IP address you can run below command to check the stat of the connection.

netstat -plan | grep 91.194.84.106 | awk ‘{print $6}’

Below command will give the List count of the number of connections the IPs are connected to the server using TCP or UDP protocol.

netstat -ntu | grep ESTAB | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -nr

Windows netstat command:
Run below command to find all the active established TCP connection

netstat -an | findstr TCP | findstr EST

Below command should give the established connect with the port 80

netstat -an | findstr :80 | findstr EST

Run this command to check the TCP connection in the server.

netstat -an | findstr TCP | more

Below command will give you the details about all the established TCP connection.

netstat -an | findstr TCP | findstr EST

Below command you can use to count the number of TCP connection

netstat -an | find /C “TCP”

You can also find count of number of establish command with the help of below command.

netstat -an | find /C “EST”

Leave a Reply

×