InMotion Hosting Support Center

In this tutorial:

In this Dedicated Hosting tutorial we will cover basic CSF commands. The basic commands include Restarting Services, Allowing IP's, Blocking IP's, and Unblocking IP's, among others. After explaining what the command does, we will show you an example of the CSF Command.

Service Control Commands

Service CSF commands:

Here is a breakdown of the the csf service commands:
service csf [start|stop|restart]

Below is an example of the command you can run, highlighted in red:

root@ded999 [~]# service csf restart

IPtables Commands:

The iptables may also need to be restarted for 'hung' rules. If you ever need to restart iptables, make sure you restart CSF afterwards to apply the firewall rules. Below is a breakdown of iptables commands: iptables {start|stop|restart|condrestart|status|panic|save}

Below is an example of a command you can run, highlighted in red:

root@ded999 [~]# iptables restart

CSF Commands

Block an IP address (permanently):

csf -d $ip

Below is an example of the command you can run, highlighted in red:

root@ded999 [~]# csf -d 123.456.789

Block an IP address (temporarily):

csf -td $ip $duration (duration is how long to block for (default:seconds, can use one suffix of h/m/d)

Below is an example of the command you can run, highlighted in red:

root@ded999 [~]# csf -td 123.456.789 3600

Allow an IP Address:

csf -a $ip

Below is an example of the command you can run, highlighted in red:

root@ded999 [~]# csf -a 123.456.789

Temporarily Allow an IP Address:

csf -ta $ip $duration (duration is how long to block for (default:seconds, can use one suffix of h/m/d)

Below is an example of the command you can run, highlighted in red:

root@ded999 [~]# csf -ta 123.456.789 3600

Unblock an IP (permanent block):

csf -dr $ip

Below is an example of the command you can run, highlighted in red:

root@ded999 [~]# csf -dr 123.456.789 3600

Unblock an IP (temporary block):

csf -tr $ip

Below is an example of the command you can run, highlighted in red:

root@ded999 [~]# csf -tr 123.456.789 3600

List temporary blocked IPs and block durations:

csf -t

Below is an example of the command you can run, highlighted in red:

root@ded999 [~]# csf -t

Remove all temporary IP blocks:

csf -tf

Below is an example of the command you can run, highlighted in red:

root@ded999 [~]# csf -tf

Log all SYN packets from an IP:

csf -w $ip

Below is an example of the command you can run, highlighted in red:

root@ded999 [~]# csf -w 123.456.789


Congratulations, now you are familiar with the basic CSF commands for Restarting Services, Allowing IP's, Blocking IP's, and Unblocking IP's, among others!

Support Center Login

Our Login page has moved, Click the button below to be taken to the login page.

Social Media Login

   
Social Login Joomla

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

0 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!