時悠帖・五差路

まだ若いつもりでいたがついに老いを隠せなくなった爺の 時悠生活雑記

Iptables/NetworkManager

Squeezeインストールを機にNetworkManagerを使ってみることにしました。
Debian Lennyのときは/etc/network/interfaces等でiptablesの設定を行っていましたが、NetworkManager/GUIにはiptablesの設定項目はありません。どうすればいいのでしょうか。

Community Ubuntu Documentation - IptablesHowTo を参考にしました。
/etc/NetworkManager/dispatcher.d 配下に次の内容の 00firewall を作成します。

if [ -x /usr/bin/logger ]; then
LOGGER="/usr/bin/logger -s -p daemon.info -t FirewallHandler"
else
LOGGER=echo
fi

case "$2" in
up)
if [ ! -r /etc/iptables.rules ]; then
${LOGGER} "No iptables rules exist to restore."
return
fi
if [ ! -x /sbin/iptables-restore ]; then
${LOGGER} "No program exists to restore iptables rules."
return
fi
${LOGGER} "Restoring iptables rules"
/sbin/iptables-restore -c /etc/iptables.rules
;;
*)
;;
esac