[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debian-users:49801] iptablesの自動化



こんにちは、朧月です。

今iptableを自動化しようとして苦戦中です。OSはDebian4 etchです。

http://www.zuk.jp/debian/iptables.shtml

ここのサイトのマネをしようと思って同じスクリプト(終了スクリプトをコピー
しました)を/etc/network/if-post-down.d/に入れて、実行してみました。

#sh /etc/network/if-post-down.d/iptables-down

終了スクリプトは以下の用になっているのですが、

#!/bin/sh

# 基本ポリシー(全部通過)
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT

# 初期化(設定を全消去 -F:全チェイン -Z:カウント -X:ユーザ定義チェイン)
iptables -F
iptables -Z
iptables -X

その結果は
iptables : Bad policy name
iptables : Bad policy name
iptables : Bad policy name
iptables : No Chaine/target/match by that name
iptables : No Chaine/target/match by that name

と表示されるので、たぶんうまく行ってないと思います。それで少し変えて以下
のようにしてみました。

#!/bin/sh

#この辺が変更ですね。(^^;)
IPTABLES='/sbin/iptables'

# 基本ポリシー(全部通過)
$IPTABLES -P INPUT ACCEPT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -P FORWARD ACCEPT

# 初期化(設定を全消去 -F:全チェイン -Z:カウント -X:ユーザ定義チェイン)
$IPTABLES -F
$IPTABLES -Z
$IPTABLES -X

とすると、今度は「/sbin/iptables:そのようなファイルやディレクトリはあり
ません」となり、やっぱりうまくいきません。ちなみにsbinフォルダはあります
し、その下に実行形式のiptablesというファイルも存在します。

なにかかしら間違ってると思うのですが、どこが間違ってるかわかりません。

よろしくお願いします。


-- 
朧月
mailto:oboro@xxxxxxxxxxxxxxx