Bobcares

Iptables command not found – Quick Fix!!

by | Oct 29, 2019

Have you ever got stuck with the error: iptables command not found?

Though iptables works as a good firewall, it often create usability errors. This error mainly occurs due to incorrect path settings of the iptables command.

At Bobcares, we often receive requests to solve iptables errors as part of our Server Management Services.

Today, let’s discuss this error in detail and see how our Support Engineers fix it.

 

Why iptables command not found?

As we all know, the firewall is a set of rules. We test the contents of the data packet against the firewall rules to see if it should be allowed through the network space or not.

So, setting up a good firewall ensures better security. And, iptables is a standard firewall included in most Linux distributions.

Though iptables commands are simple to use, there is one important fact worth noting.

Iptables commands requires root privileges to execute.

This means you need to log in as root, use su or sudo -i to gain a root shell, or precede all commands with sudo. If not, the command will fail with an error message.

Essentially, this is a security mechanism that prevents firewall updates by any user. From our experience in managing servers, we often see the firewall as a critical system. Often bad edits will lockout even the root user from the server. In other words, the server becomes unusable.

 

How we fix this error?

Let us now discuss how our Support Engineers fix this error efficiently.

Recently, one of our customers approached us with an iptables error. He tried to configure the firewall using iptables. But he got the error as command not found.

bob@ubuntu:~$ iptables
-bash: iptables: command not found

Our Support Engineers checked and found that the customer was running the command as another user instead of root.

By default, iptables command will not be in the default command search path for users other than root. This created problems here.

Therefore, we advised the customer to run iptables as the root user. When working as a normal user, we suggest them to use the command:

sudo iptables --some-option …

This makes the executable accessible from /sbin, which is in the default command search path for root.

This resolved the error and iptables command worked fine.

 

[Need more help to fix this error?- We’ll help you.]

 

Conclusion

In short, the iptables command not found occurs due to incorrect path, privileges, etc. In today’s writeup, we discussed this error in detail and saw how our Support Engineers fixed it for our customers.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.