ccihosting.com
Have questions? Call us.
Panama: (+507) 264.0852

Blocking IP Address in Linux

CCIHosting.com knowledgebase

Knowledgebase

How do I block an IP address in my Linux Server?

If you want to block an IP to access your linux server, you will need to login to the shell as root. Your server will either have the ipchains or iptables firewall to help accomplish this.

In this example, the attacking IP is 192.168.45.45

If you are using ipchains type

ipchains -A input -j DENY -p all -l -s 192.168.45.45/32

If you are using iptables type

iptables -A INPUT -s 192.168.45.45/32 -j DROP

If you just want to block access to one port from an IP

iptables -A INPUT -s 192.168.45.45/32 -p tcp -destination-port 80 -j DROP

The above would drop all packets from 192.168.45.45/32 to port 80 (HTTP) on your server.

Need a Web Hosting account?

Web Hosting

$ 6/month
Starting at

View Plans

  • Instant Activation
  • DDoS Protection
  • 24x7 Tech Support
  • Bitcoin Accepted

VPS

$ 15/month
Starting at

View Plans

  • Instant Activation
  • DDoS Protection
  • 24x7 Tech Support
  • Bitcoin Accepted

Cloud Servers

$ 35/month
Starting at

View Plans

  • Instant Activation
  • DDoS Protection
  • 24x7 Tech Support
  • Bitcoin Accepted

Dedicated Servers

$ 90/month
Starting at

View Plans

  • 48 Hours or Less
  • DDoS Protection
  • 24x7 Tech Support
  • Bitcoin Accepted
paypal
visa
mastercard
bitcoin

Need assistance choosing your right server? We are here to help

Call our sales team at +(507) 264.0852 or talk with us on Live Chat