#

#

# 4.3.5 INPUT chain

#

#

# 4.3.6 FORWARD chain

#

#

# 4.3.7 OUTPUT chain

#

#

# 4.3.8 POSTROUTING chain

#

I.5. Пример rc.flush-iptables

#!/bin/sh

#

# rc.flush-iptables – Resets iptables to default values.

#

# Copyright (C) 2001 Oskar Andreasson <bluefluxATkoffeinDOTnet>

#

# This program is free software; you can redistribute it and/or modify

# it under the terms of the GNU General Public License as published by

# the Free Software Foundation; version 2 of the License.

#

# This program is distributed in the hope that it will be useful,

# but WITHOUT ANY WARRANTY; without even the implied warranty of

# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

# GNU General Public License for more details.

#

# You should have received a copy of the GNU General Public License

# along with this program or from the site that you downloaded it

# from; if not, write to the Free Software Foundation, Inc., 59 Temple

# Place, Suite 330, Boston, MA 02111-1307 USA

#

# Configurations

#

IPTABLES='/usr/sbin/iptables'

#

# reset the default policies in the filter table.

#

$IPTABLES -P INPUT ACCEPT

$IPTABLES -P FORWARD ACCEPT

$IPTABLES -P OUTPUT ACCEPT

#

# reset the default policies in the nat table.

#

$IPTABLES -t nat -P PREROUTING ACCEPT

$IPTABLES -t nat -P POSTROUTING ACCEPT

$IPTABLES -t nat -P OUTPUT ACCEPT

#

# reset the default policies in the mangle table.

#

$IPTABLES -t mangle -P PREROUTING ACCEPT

$IPTABLES -t mangle -P OUTPUT ACCEPT

#

# flush all the rules in the filter and nat tables.

#

$IPTABLES -F

$IPTABLES -t nat -F

$IPTABLES -t mangle -F

#

# erase all chains that's not default in filter and nat table.

#

$IPTABLES -X

$IPTABLES -t nat -X

$IPTABLES -t mangle -X

I.6. Пример rc.test-iptables

#!/bin/bash

#

# rc.test-iptables – test script for iptables chains and tables.

#

# Copyright (C) 2001 Oskar Andreasson <bluefluxATkoffeinDOTnet>

#

# This program is free software; you can redistribute it and/or modify

# it under the terms of the GNU General Public License as published by

# the Free Software Foundation; version 2 of the License.

#

# This program is distributed in the hope that it will be useful,

# but WITHOUT ANY WARRANTY; without even the implied warranty of

# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

# GNU General Public License for more details.

#

# You should have received a copy of the GNU General Public License

# along with this program or from the site that you downloaded it

# from; if not, write to the Free Software Foundation, Inc., 59 Temple

# Place, Suite 330, Boston, MA 02111-1307 USA

#

#

# Filter table, all chains

#

iptables -t filter -A INPUT -p icmp –icmp-type echo-request

–j LOG –log-prefix='filter INPUT:'

iptables -t filter -A INPUT -p icmp –icmp-type echo-reply

–j LOG –log-prefix='filter INPUT:'

iptables -t filter -A OUTPUT -p icmp –icmp-type echo-request

–j LOG –log-prefix='filter OUTPUT:'

iptables -t filter -A OUTPUT -p icmp –icmp-type echo-reply

–j LOG –log-prefix='filter OUTPUT:'

iptables -t filter -A FORWARD -p icmp –icmp-type echo-request

Вы читаете Iptables Tutorial 1.1.19
Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

Вы можете отметить интересные вам фрагменты текста, которые будут доступны по уникальной ссылке в адресной строке браузера.

Отметить Добавить цитату