E
E
Evgeny Elizarov2010-09-27 11:48:09
iptables
Evgeny Elizarov, 2010-09-27 11:48:09

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

6 answer(s)
X
XRay39, 2010-09-27
@XRay39

which iptables does what?
And check if the given path is in the PATH variable.

X
XRay39, 2010-09-27
@XRay39

It is more correct to do in scripts as follows:
IPT=/sbin/iptables (or other)
$IPT (hereinafter the rule)
$IPT (hereinafter the rule)

D
dAverk, 2010-09-27
@dAverk

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 < ...>

S
Sergey, 2010-09-27
@bondbig

sudo?

X
XRay39, 2010-09-27
@XRay39

Are you running the script as root?
If not. Then run as root.
Full iptables path: /sbin/iptables

B
burgua, 2010-09-27
@burgua

sudo chmod 755 firewall.sh

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question