ALT Linux Community general discussions
 help / color / mirror / Atom feed
From: Michael Shigorin <mike@osdn.org.ua>
To: community@altlinux.ru
Subject: [Comm] Re: Как перезапустить IPTABLES без перез. компа?
Date: Fri, 28 May 2004 12:58:55 +0300
Message-ID: <20040528095855.GJ9051@osdn.org.ua> (raw)
In-Reply-To: <m3hdu1ou6e.fsf@mrkooll.tdr.pibhe.com>


[-- Attachment #1.1: Type: text/plain, Size: 593 bytes --]

On Fri, May 28, 2004 at 11:03:05AM +0300, Maxim Tyurin wrote:
> > Подскажите, как правильно перезапустить iptables?
> > Пишу свои правила в файл /etc/sysconfig/iptables
> Туда нельзя писать (точнее очень не рекомендуется).

Да ну.  Размножать любимые шаблоны -- любимое же дело :)

Для архива -- цепляю таковую для eth0->10.0.1.0/24, eth1->наружу
(в DSL-модем, например) с несколькими удобными хуками и кусочками.

> Туда пишет/читает iptables

iptables-{save,restore}, точнее.

-- 
 ---- WBR, Michael Shigorin <mike@altlinux.ru>
  ------ Linux.Kiev http://www.linux.kiev.ua/

[-- Attachment #1.2: iptables --]
[-- Type: text/plain, Size: 2006 bytes --]

# Generated by iptables-save v1.2.6a on Thu Nov 21 21:15:39 2002
*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A PREROUTING -d _REAL_IP -i eth0 -p tcp -m tcp --dport _EXT_PORT -j DNAT --to-destination _INT_HOST:_INT_PORT
-A POSTROUTING -s 10.0.1.0/24 -d ! 10.0.1.0/24 -j SNAT --to-source _REAL_IP
COMMIT
# Completed on Thu Nov 21 21:15:39 2002
# Generated by iptables-save v1.2.6a on Thu Nov 21 21:15:39 2002
*mangle
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
COMMIT
# Completed on Thu Nov 21 21:15:39 2002
# Generated by iptables-save v1.2.6a on Thu Nov 21 21:15:39 2002
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:eth1-in - [0:0]
:eth1-out - [0:0]
:tcprules - [0:0]
-A INPUT -i eth1 -j eth1-in
-A INPUT -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT
-A INPUT -s 10.0.1.0/24 -d 10.0.1.1 -i eth0 -j ACCEPT
-A INPUT -s 10.0.1.0/24 -d _REAL_IP -i eth0 -j ACCEPT
-A INPUT -d _REAL_IP -i eth0 -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -d _REAL_IP -i eth0 -p tcp -m tcp --dport 25 -j ACCEPT
-A INPUT -d _REAL_IP -i eth0 -p udp -m udp --dport 53 -j ACCEPT
-A INPUT -d _REAL_IP -i eth0 -p tcp -m tcp --dport 53 -j ACCEPT
-A INPUT -d _REAL_IP -i eth0 -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -d _REAL_IP -i eth0 -p tcp -m tcp --dport 110 -j ACCEPT
-A INPUT -d _REAL_IP -i eth0 -p tcp -m tcp --dport 113 -j REJECT --reject-with tcp-reset
-A INPUT -j tcprules
# block :25 to world (only through 10.0.1.1:25)
-A FORWARD -s 10.0.1.0/24 -p tcp -m tcp --dport 25 -j REJECT --reject-with icmp-port-unreachable
-A FORWARD -j tcprules
-A OUTPUT -o eth1 -j eth1-out
-A eth1-in -j RETURN
-A eth1-out -j RETURN
-A tcprules -i eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A tcprules -i ! eth1 -m state --state NEW -j ACCEPT
-A tcprules -i eth1 -m state --state INVALID,NEW -j DROP
-A tcprules -i eth1 -j REJECT --reject-with icmp-host-unreachable
COMMIT
# Completed on Thu Nov 21 21:15:39 2002

[-- Attachment #1.3: iptables --]
[-- Type: text/plain, Size: 2006 bytes --]

# Generated by iptables-save v1.2.6a on Thu Nov 21 21:15:39 2002
*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A PREROUTING -d _REAL_IP -i eth0 -p tcp -m tcp --dport _EXT_PORT -j DNAT --to-destination _INT_HOST:_INT_PORT
-A POSTROUTING -s 10.0.1.0/24 -d ! 10.0.1.0/24 -j SNAT --to-source _REAL_IP
COMMIT
# Completed on Thu Nov 21 21:15:39 2002
# Generated by iptables-save v1.2.6a on Thu Nov 21 21:15:39 2002
*mangle
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
COMMIT
# Completed on Thu Nov 21 21:15:39 2002
# Generated by iptables-save v1.2.6a on Thu Nov 21 21:15:39 2002
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:eth1-in - [0:0]
:eth1-out - [0:0]
:tcprules - [0:0]
-A INPUT -i eth1 -j eth1-in
-A INPUT -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT
-A INPUT -s 10.0.1.0/24 -d 10.0.1.1 -i eth0 -j ACCEPT
-A INPUT -s 10.0.1.0/24 -d _REAL_IP -i eth0 -j ACCEPT
-A INPUT -d _REAL_IP -i eth0 -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -d _REAL_IP -i eth0 -p tcp -m tcp --dport 25 -j ACCEPT
-A INPUT -d _REAL_IP -i eth0 -p udp -m udp --dport 53 -j ACCEPT
-A INPUT -d _REAL_IP -i eth0 -p tcp -m tcp --dport 53 -j ACCEPT
-A INPUT -d _REAL_IP -i eth0 -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -d _REAL_IP -i eth0 -p tcp -m tcp --dport 110 -j ACCEPT
-A INPUT -d _REAL_IP -i eth0 -p tcp -m tcp --dport 113 -j REJECT --reject-with tcp-reset
-A INPUT -j tcprules
# block :25 to world (only through 10.0.1.1:25)
-A FORWARD -s 10.0.1.0/24 -p tcp -m tcp --dport 25 -j REJECT --reject-with icmp-port-unreachable
-A FORWARD -j tcprules
-A OUTPUT -o eth1 -j eth1-out
-A eth1-in -j RETURN
-A eth1-out -j RETURN
-A tcprules -i eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A tcprules -i ! eth1 -m state --state NEW -j ACCEPT
-A tcprules -i eth1 -m state --state INVALID,NEW -j DROP
-A tcprules -i eth1 -j REJECT --reject-with icmp-host-unreachable
COMMIT
# Completed on Thu Nov 21 21:15:39 2002

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2004-05-28  9:58 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-27 11:32 [Comm] " Andrey Rudikov
2004-05-27 11:54 ` Mikhailov Vladimir
2004-05-27 13:32 ` Igor Solovyov
2004-05-27 14:29   ` Artem K. Jouravsky
2004-05-27 14:44     ` Artem Pastukhov
2004-05-27 14:59       ` Artem K. Jouravsky
2004-05-28  3:47     ` Gosha
2004-05-28  7:28       ` Artem K. Jouravsky
2004-05-28  7:37         ` Re[2]: " Alexey S. Kuznetsov
2004-05-28 10:03           ` [Comm] " Michael Shigorin
2004-05-28 12:37         ` [Comm] " Igor Solovyov
2004-05-28 12:43           ` Artem K. Jouravsky
2004-05-28 12:46             ` Igor Solovyov
2004-05-28 13:31               ` Artem K. Jouravsky
2004-05-28 17:18                 ` Pyatnitskich Evgeniy
2004-05-28  8:03 ` Maxim Tyurin
2004-05-28  9:58   ` Michael Shigorin [this message]
2004-05-28 10:32     ` [Comm] " Maxim Tyurin
2004-05-28 10:45       ` Michael Shigorin
2004-05-28 12:12       ` Artem K. Jouravsky
2004-05-28 12:31       ` Igor Solovyov
2004-05-28 12:40         ` Artem K. Jouravsky
2004-05-28 12:43           ` Igor Solovyov
2004-05-28 12:48             ` Artem K. Jouravsky
2004-05-28 14:07               ` Andrey Rahmatullin
2004-05-28 14:12                 ` Artem K. Jouravsky
2004-05-31  5:19               ` Mike Lykov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040528095855.GJ9051@osdn.org.ua \
    --to=mike@osdn.org.ua \
    --cc=community@altlinux.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git