Unmetered Dedicated ServerDedicated Server SupportDedicated Server Live Help

How to view how many connections are connected from a certain ip with netstat

 

During an DDOS attacks it can be frustrating trying to gain access to your server. If you are able to access ssh you can view who is attacking you and then block them using iptables. Not all DDOS attacks can be detected this way but netstat it is a useful to any linux or centos administrator should know.

To view  the total number of connections from a single ip, run the following command in ssh

netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n

 

To view the total number of connections to a port, run the following command in ssh

netstat -tuna | awk -F':+| +' 'NR>2{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n

 

These commands are useful during a DDOS attack to view what ip is the attacker and then you can block them. To block an ip on linux or centos you can do that with iptables. Use the above commands to view how many connections an ip has to your server and then block them using iptables. To view our how to block or unblock an ip with centos or linux with iptables Click Here.

 

 

 

Linux Dedicated Server

 

Dedicated Server Price Match Guarantee

 

What's Includes?

Servers Include :
  • No Setup Fees!!
  • No Bandwidth Overages!!
  • No Hidden Fees!!
  • Free Raid 0/1
  • Free IPMI Access or
  • Free KVM Access
  • Month-to-Month Billing
  • Cancel Anytime
  • 1U Servers
  • Rent to Own Option
24 x 7 x 365 Support Staff
24 x 7 x 365 Datacenter Staff
24 x 7 x 365 Network / Power Monitoring

 

Dedicated Server Hosting Dallas Texas

 

Network

BGP Routing

  • BGP Routing with multiple ISPs
  • AboveNet - Zayo
  • NTT Communications
  • Global Crossing
  • Limelight Networks
  • Cogent Communications
  • Level 3 Communications
  • Private Peering