#!/bin/sh # Provides: iptables # Short-Description: IPtables script # Description: Sets up iptables rules IPT=/sbin/iptables IF="eth0" d_start() { # Temporarily set default policy to accept #$IPT -P INPUT ACCEPT # Flush input chain #$IPT -F INPUT $IPT -t nat -F $IPT -t filter -F $IPT -t mangle -F iptables-restore -c < /etc/iptables.conf # Reject everything else #$IPT -A INPUT -i $IF -j REJECT } d_stop() { # Set default policy to accept, and flush $IPT -P INPUT ACCEPT $IPT -F INPUT $IPT -t nat -F $IPT -t filter -F $IPT -t mangle -F } case "$1" in start) echo -n "Starting firewall" d_start echo "." ;; stop) echo -n "Stopping firewall" d_stop echo "." ;; restart) echo -n "Restarting firewall" d_stop d_start echo "." ;; *) echo "Usage: $0 {start|stop|restart}" >&2 exit 3 ;; esac exit 0