I am using CentOS 5.5. I want to add new IP in my iptables. But I cannot do it.

Tried everything with 'iptables'. The latest version of 'iptables' is at sbin. I'm in 'sbin' directory. But it says "iptables: command not found". What shall I do now?

  • Can you please format your question in a readable way. – Thomas Erker Sep 11 '15 at 10:26
  • And elaborate. Because just the output of ls isn't a question. – Shadur Sep 11 '15 at 10:34
  • First off, check if it's really there and not just a busted symlink: ls -lsa /usr/sbin/iptables – Shadur Sep 11 '15 at 10:38
  • What is the output of ls -l /usr/sbin/iptables ? And what is the output of echo $PATH? – Thomas Erker Sep 11 '15 at 10:40
  • 4
    Please edit your question and i) remove the ls output and replace it with ls -l iptables, that's all we need; ii) tell us which sbin directory that is in. Is it /usr/sbin? /sbin? /usr/local/sbin? iii) show us the output of echo $PATH run as root. Finally, you seem to be logged in as root, why are you using sudo? – terdon Sep 11 '15 at 10:40

In CentOS5, the iptables configuration file is /etc/sysconfig/iptables. Edit that file, and restart the firewall with /sbin/service iptables restart.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.