1 | #!/bin/sh
|
2 | #
|
3 | # rc.flush-iptables - Resets iptables to default values.
|
4 | #
|
5 | # Copyright (C) 2001 Oskar Andreasson <bluefluxATkoffeinDOTnet>
|
6 | #
|
7 | # This program is free software; you can redistribute it and/or modify
|
8 | # it under the terms of the GNU General Public License as published by
|
9 | # the Free Software Foundation; version 2 of the License.
|
10 | #
|
11 | # This program is distributed in the hope that it will be useful,
|
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 | # GNU General Public License for more details.
|
15 | #
|
16 | # You should have received a copy of the GNU General Public License
|
17 | # along with this program or from the site that you downloaded it
|
18 | # from; if not, write to the Free Software Foundation, Inc., 59 Temple
|
19 | # Place, Suite 330, Boston, MA 02111-1307 USA
|
20 |
|
21 | #
|
22 | # Configurations
|
23 | #
|
24 | IPTABLES="/usr/sbin/iptables"
|
25 |
|
26 | #
|
27 | # reset the default policies in the filter table.
|
28 | #
|
29 | $IPTABLES -P INPUT ACCEPT
|
30 | $IPTABLES -P FORWARD ACCEPT
|
31 | $IPTABLES -P OUTPUT ACCEPT
|
32 |
|
33 | #
|
34 | # reset the default policies in the nat table.
|
35 | #
|
36 | $IPTABLES -t nat -P PREROUTING ACCEPT
|
37 | $IPTABLES -t nat -P POSTROUTING ACCEPT
|
38 | $IPTABLES -t nat -P OUTPUT ACCEPT
|
39 |
|
40 | #
|
41 | # reset the default policies in the mangle table.
|
42 | #
|
43 | $IPTABLES -t mangle -P PREROUTING ACCEPT
|
44 | $IPTABLES -t mangle -P OUTPUT ACCEPT
|
45 |
|
46 | #
|
47 | # flush all the rules in the filter and nat tables.
|
48 | #
|
49 | $IPTABLES -F
|
50 | $IPTABLES -t nat -F
|
51 | $IPTABLES -t mangle -F
|
52 | #
|
53 | # erase all chains that's not default in filter and nat table.
|
54 | #
|
55 | $IPTABLES -X
|
56 | $IPTABLES -t nat -X
|
57 | $IPTABLES -t mangle -X
|
58 |
|
59 |
|