How To Fix *Error* The path to iptables is either not set or incorrect for IPTABLES [/sbin/ip6tables]

Screenshot From 2021 01 13 00 10 40

On this today guide I will show you on how to solving error on ConfigServer Security & Firewall (CSF LFD). First of all, we must read the following error logs to identify the issues. The following error may occur on old-stable Linux distribution system, including Ubuntu 14.04 – 16.04 LTS and Debian 8/9.

-----------------------------------------------------------------------
*Error* The path to iptables is either not set or incorrect for IPTABLES [/sbin/ip6tables] in /etc/csf/csf.conf at /usr/local/csf/lib/ConfigServer/URLGet.pm line 26.
-----------------------------------------------------------------------

So, this error may be caused by IPTABLES path which you can see on the error log where the above path is set to [/sbin/ip6tables]. The solution is quite simple, so let’s fix the issues.

PREREQUISITES:
* VPS / Cloud / Dedicated Server
* Server IPv4 Address
* Full Root Access
* gNome Terminal for Linux
* PuTTy SSH client for Windows/Mac

1.) Find the correct iptables path

Run this command on your terminal:

Look for iptables path for IPv4

$ whereis iptables

And the result is as follow:

$ iptables: /usr/sbin/iptables /usr/share/iptables /usr/share/man/man8/iptables.8.gz

AND

Look for iptables path for IPv6

$ whereis ip6tables

Then, you will find the result like this:

$ ip6tables: /usr/sbin/ip6tables /usr/share/man/man8/ip6tables.8.gz

2.) Update firewall rule on csf.conf file inside /etc/csf/ directory

Scroll down to the SECTION:OS Specific Settings and then set correct iptables path to include /usr/sbin/ directory.

###############################################################################
# SECTION:OS Specific Settings
###############################################################################
Binary locations
-----------------------------------------------------------------------
IPTABLES = "/usr/sbin/iptables"
IPTABLES_SAVE = "/usr/sbin/iptables-save"
IPTABLES_RESTORE = "/usr/sbin/iptables-restore"
IP6TABLES = "/usr/sbin/ip6tables"
IP6TABLES_SAVE = "/usr/sbin/ip6tables-save"
IP6TABLES_RESTORE = "/usr/sbin/ip6tables-restore"
-----------------------------------------------------------------------

3.) After that make sure if everything working properly, and then simply run the following command to restart CSF LFD.

-----------------------------------------------------------------------
$ csf -r
$ lfd -r
-----------------------------------------------------------------------

CONCLUSION:

Solving any issues on CSF & LFD is quite easy. But, we need to understand first or move your mind to learning mode in order to learn on any issues we’re facing today on the CSF Firewall. After you know what’s exactly and where the issues, you will know on how to solving it. Happy coding… 🙂