Answer the question
In order to leave comments, you need to log in
CentOS and iptables
Gentlemen, I decided to get acquainted with centos here, in fact, I need to configure iptables, everything is simple in principle and on other systems it didn’t raise any questions, but then I got into a stupor. opened the documentation
wiki.centos.org/HowTos/Network/IPTables
everything is actually clear, I create a script, write the rules from the example, as a result I get:
./firewall.sh: line 7: iptables: command not found
and so on for all commands, which I can’t understand it in any way
centos 5.5 final
Answer the question
In order to leave comments, you need to log in
which iptables does what?
And check if the given path is in the PATH variable.
It is more correct to do in scripts as follows:
IPT=/sbin/iptables (or other)
$IPT (hereinafter the rule)
$IPT (hereinafter the rule)
The simplest is whereis iptables
and then in the script add
IPTABLES=/sbin/iptables first (or a more general option -
IPTABLES=`whereis -b iptables | cut -d" " -f2`
) and then use
$IPTABLES -A < ...>
Are you running the script as root?
If not. Then run as root.
Full iptables path: /sbin/iptables
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question