* [Comm] IPtables вопрос
@ 2004-11-11 13:22 Ivanov Maxim
2004-11-11 13:33 ` Alexey S. Kuznetsov
0 siblings, 1 reply; 6+ messages in thread
From: Ivanov Maxim @ 2004-11-11 13:22 UTC (permalink / raw)
To: community
Здравствуйте, community.
На серваке (он же шлюз в интернет) есть почтовый сервер - две сетвухи
- eth0 и eth1 - соответственно вовнутрь и наружу.
Хочу сделать так, чтобы только этот сервер и только он мог ходить по
25 порту (SMTP), принимать запросы на 110-й (POP3) только изнутри сети
и убивать все остальные запросы на eth1 относительно коннекта на
110-й порт.
пишу:
$IPT -A INPUT -p TCP -i $LOCAL_IFACE --destination-port 25 -j ACCEPT
$IPT -A INPUT -p TCP -i $LOCAL_IFACE --destination-port 110 -j ACCEPT
$IPT -A INPUT -p TCP -i $INET_IFACE --destination-port 25 -j ACCEPT
$IPT -A INPUT -p TCP -i $INET_IFACE --destination-port 110 -j DROP
Но закралась подленькая мыслишка: а не требуется ли еще и переброс
портов делать с внешнего интерфейса на внутренний? Ну типа
$IPT -A FORWARD -p TCP -i $INET_IFACE --destanation-port 25 \
--destanation 192.168.0.65 -j ACCEPT
$IPT -A FORWARD -p TCP -i $INET_IFACE --destanation-port 25 ACCEPT
$IPT -t NAT -A PREROUTING -p TCP -i $INET_IFACE -dport 25:25 \
--to-destination 192.168.0.65:25
$IPT -t NAT -A PREROUTING -p TCP -i $LOCAL_IFACE -dport 25:25 \
--destination $INET_ADDRESS -j DNAT --to-destination 192.168.0.65:25
Это часом уже не бред попер?
________________
С уважением,
Максим Иванов
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Comm] IPtables вопрос
2004-11-11 13:22 [Comm] IPtables вопрос Ivanov Maxim
@ 2004-11-11 13:33 ` Alexey S. Kuznetsov
2004-11-11 14:17 ` Re[2]: " Ivanov Maxim
0 siblings, 1 reply; 6+ messages in thread
From: Alexey S. Kuznetsov @ 2004-11-11 13:33 UTC (permalink / raw)
To: Ivanov Maxim
Hello!
Вы писали 11 листопада 2004 р., 15:22:41:
> Здравствуйте, community.
> На серваке (он же шлюз в интернет) есть почтовый сервер - две сетвухи
> - eth0 и eth1 - соответственно вовнутрь и наружу.
> Хочу сделать так, чтобы только этот сервер и только он мог ходить по
> 25 порту (SMTP), принимать запросы на 110-й (POP3) только изнутри сети
> и убивать все остальные запросы на eth1 относительно коннекта на
> 110-й порт.
> пишу:
> $IPT -A INPUT -p TCP -i $LOCAL_IFACE --destination-port 25 -j ACCEPT
> $IPT -A INPUT -p TCP -i $LOCAL_IFACE --destination-port 110 -j ACCEPT
> $IPT -A INPUT -p TCP -i $INET_IFACE --destination-port 25 -j ACCEPT
> $IPT -A INPUT -p TCP -i $INET_IFACE --destination-port 110 -j DROP
> Но закралась подленькая мыслишка: а не требуется ли еще и переброс
> портов делать с внешнего интерфейса на внутренний? Ну типа
> $IPT -A FORWARD -p TCP -i $INET_IFACE --destanation-port 25 \
> --destanation 192.168.0.65 -j ACCEPT
> $IPT -A FORWARD -p TCP -i $INET_IFACE --destanation-port 25 ACCEPT
> $IPT -t NAT -A PREROUTING -p TCP -i $INET_IFACE -dport 25:25 \
> --to-destination 192.168.0.65:25
> $IPT -t NAT -A PREROUTING -p TCP -i $LOCAL_IFACE -dport 25:25 \
> --destination $INET_ADDRESS -j DNAT --to-destination 192.168.0.65:25
> Это часом уже не бред попер?
пиши iptables -A INPUT -s !$INT_NET -d $INT_IP -p tcp --dport 25 -j ACCEPT
-//- --dport 110 -j ACCEPT
iptables -A input -s 0/0 -d $INET_IP -p tcp --dport 25 -j ACCEPT
iptables -A input -s 0/0 -d $INET_IP -p tcp --dport 110 -j REJECT
--
Sincerely,
Alexey S. Kuznetsov
AK2351-RIPE
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re[2]: [Comm] IPtables вопрос
2004-11-11 13:33 ` Alexey S. Kuznetsov
@ 2004-11-11 14:17 ` Ivanov Maxim
2004-11-11 14:24 ` Re[3]: " Ivanov Maxim
2004-11-11 14:34 ` Alexey S. Kuznetsov
0 siblings, 2 replies; 6+ messages in thread
From: Ivanov Maxim @ 2004-11-11 14:17 UTC (permalink / raw)
To: Alexey S. Kuznetsov
Здравствуйте, Alexey.
Вы писали 11 ноября 2004 г., 16:33:04:
> Hello!
> Вы писали 11 листопада 2004 р., 15:22:41:
>> Здравствуйте, community.
>> На серваке (он же шлюз в интернет) есть почтовый сервер - две сетвухи
>> - eth0 и eth1 - соответственно вовнутрь и наружу.
>> Хочу сделать так, чтобы только этот сервер и только он мог ходить по
>> 25 порту (SMTP), принимать запросы на 110-й (POP3) только изнутри сети
>> и убивать все остальные запросы на eth1 относительно коннекта на
>> 110-й порт.
>> пишу:
>> $IPT -A INPUT -p TCP -i $LOCAL_IFACE --destination-port 25 -j ACCEPT
>> $IPT -A INPUT -p TCP -i $LOCAL_IFACE --destination-port 110 -j ACCEPT
>> $IPT -A INPUT -p TCP -i $INET_IFACE --destination-port 25 -j ACCEPT
>> $IPT -A INPUT -p TCP -i $INET_IFACE --destination-port 110 -j DROP
>> Но закралась подленькая мыслишка: а не требуется ли еще и переброс
>> портов делать с внешнего интерфейса на внутренний? Ну типа
>> $IPT -A FORWARD -p TCP -i $INET_IFACE --destanation-port 25 \
>> --destanation 192.168.0.65 -j ACCEPT
>> $IPT -A FORWARD -p TCP -i $INET_IFACE --destanation-port 25 ACCEPT
>> $IPT -t NAT -A PREROUTING -p TCP -i $INET_IFACE -dport 25:25 \
>> --to-destination 192.168.0.65:25
>> $IPT -t NAT -A PREROUTING -p TCP -i $LOCAL_IFACE -dport 25:25 \
>> --destination $INET_ADDRESS -j DNAT --to-destination 192.168.0.65:25
>> Это часом уже не бред попер?
> пиши iptables -A INPUT -s !$INT_NET -d $INT_IP -p tcp --dport 25 -j ACCEPT
> -//- --dport 110 -j ACCEPT
Тут точно ACCEPT а не DROP или REJECT ??? Это 110-й порт...
> iptables -A input -s 0/0 -d $INET_IP -p tcp --dport 25 -j ACCEPT
> iptables -A input -s 0/0 -d $INET_IP -p tcp --dport 110 -j REJECT
_______________
С уважением,
Максим Иванов
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re[3]: [Comm] IPtables вопрос
2004-11-11 14:17 ` Re[2]: " Ivanov Maxim
@ 2004-11-11 14:24 ` Ivanov Maxim
2004-11-11 15:05 ` Dmitry Lebkov
2004-11-11 14:34 ` Alexey S. Kuznetsov
1 sibling, 1 reply; 6+ messages in thread
From: Ivanov Maxim @ 2004-11-11 14:24 UTC (permalink / raw)
To: Ivanov Maxim
Здравствуйте, Ivanov.
Вы писали 11 ноября 2004 г., 17:17:25:
> Здравствуйте, Alexey.
> Вы писали 11 ноября 2004 г., 16:33:04:
>> Hello!
>> Вы писали 11 листопада 2004 р., 15:22:41:
>>> Здравствуйте, community.
>>> На серваке (он же шлюз в интернет) есть почтовый сервер - две сетвухи
>>> - eth0 и eth1 - соответственно вовнутрь и наружу.
>>> Хочу сделать так, чтобы только этот сервер и только он мог ходить по
>>> 25 порту (SMTP), принимать запросы на 110-й (POP3) только изнутри сети
>>> и убивать все остальные запросы на eth1 относительно коннекта на
>>> 110-й порт.
>>> пишу:
>>> $IPT -A INPUT -p TCP -i $LOCAL_IFACE --destination-port 25 -j ACCEPT
>>> $IPT -A INPUT -p TCP -i $LOCAL_IFACE --destination-port 110 -j ACCEPT
>>> $IPT -A INPUT -p TCP -i $INET_IFACE --destination-port 25 -j ACCEPT
>>> $IPT -A INPUT -p TCP -i $INET_IFACE --destination-port 110 -j DROP
>>> Но закралась подленькая мыслишка: а не требуется ли еще и переброс
>>> портов делать с внешнего интерфейса на внутренний? Ну типа
>>> $IPT -A FORWARD -p TCP -i $INET_IFACE --destanation-port 25 \
>>> --destanation 192.168.0.65 -j ACCEPT
>>> $IPT -A FORWARD -p TCP -i $INET_IFACE --destanation-port 25 ACCEPT
>>> $IPT -t NAT -A PREROUTING -p TCP -i $INET_IFACE -dport 25:25 \
>>> --to-destination 192.168.0.65:25
>>> $IPT -t NAT -A PREROUTING -p TCP -i $LOCAL_IFACE -dport 25:25 \
>>> --destination $INET_ADDRESS -j DNAT --to-destination 192.168.0.65:25
>>> Это часом уже не бред попер?
>> пиши iptables -A INPUT -s !$INT_NET -d $INT_IP -p tcp --dport 25 -j ACCEPT
>> -//- --dport 110 -j ACCEPT
> Тут точно ACCEPT а не DROP или REJECT ??? Это 110-й порт...
>> iptables -A input -s 0/0 -d $INET_IP -p tcp --dport 25 -j ACCEPT
>> iptables -A input -s 0/0 -d $INET_IP -p tcp --dport 110 -j REJECT
А на эти две строчки ругается, что bad argument 'tcp' и предлагает
попробовать iptables -h. Наверное, издевается :)
_______________
С уважением,
Максим Иванов
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Re[3]: [Comm] IPtables вопрос
2004-11-11 14:24 ` Re[3]: " Ivanov Maxim
@ 2004-11-11 15:05 ` Dmitry Lebkov
0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Lebkov @ 2004-11-11 15:05 UTC (permalink / raw)
To: community
On Thu, 11 Nov 2004 17:24:52 +0300
Ivanov Maxim <ivanov@amos.ru> wrote:
[skip]
> >> iptables -A input -s 0/0 -d $INET_IP -p tcp --dport 25 -j ACCEPT
> >> iptables -A input -s 0/0 -d $INET_IP -p tcp --dport 110 -j REJECT
>
> А на эти две строчки ругается, что bad argument 'tcp' и предлагает
> попробовать iptables -h. Наверное, издевается :)
Возможно, важен порядок аргументов. Попробуй:
iptables -A input -p tcp -s 0/0 -d $INET_IP --dport 25 -j ACCEPT
--
WBR, Dmitry Lebkov
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re[3]: [Comm] IPtables вопрос
2004-11-11 14:17 ` Re[2]: " Ivanov Maxim
2004-11-11 14:24 ` Re[3]: " Ivanov Maxim
@ 2004-11-11 14:34 ` Alexey S. Kuznetsov
1 sibling, 0 replies; 6+ messages in thread
From: Alexey S. Kuznetsov @ 2004-11-11 14:34 UTC (permalink / raw)
To: Ivanov Maxim
Hello!
Вы писали 11 листопада 2004 р., 16:17:25:
> Здравствуйте, Alexey.
> Вы писали 11 ноября 2004 г., 16:33:04:
>> Hello!
>> Вы писали 11 листопада 2004 р., 15:22:41:
>>> Здравствуйте, community.
>>> На серваке (он же шлюз в интернет) есть почтовый сервер - две сетвухи
>>> - eth0 и eth1 - соответственно вовнутрь и наружу.
>>> Хочу сделать так, чтобы только этот сервер и только он мог ходить по
>>> 25 порту (SMTP), принимать запросы на 110-й (POP3) только изнутри сети
>>> и убивать все остальные запросы на eth1 относительно коннекта на
>>> 110-й порт.
>>> пишу:
>>> $IPT -A INPUT -p TCP -i $LOCAL_IFACE --destination-port 25 -j ACCEPT
>>> $IPT -A INPUT -p TCP -i $LOCAL_IFACE --destination-port 110 -j ACCEPT
>>> $IPT -A INPUT -p TCP -i $INET_IFACE --destination-port 25 -j ACCEPT
>>> $IPT -A INPUT -p TCP -i $INET_IFACE --destination-port 110 -j DROP
>>> Но закралась подленькая мыслишка: а не требуется ли еще и переброс
>>> портов делать с внешнего интерфейса на внутренний? Ну типа
>>> $IPT -A FORWARD -p TCP -i $INET_IFACE --destanation-port 25 \
>>> --destanation 192.168.0.65 -j ACCEPT
>>> $IPT -A FORWARD -p TCP -i $INET_IFACE --destanation-port 25 ACCEPT
>>> $IPT -t NAT -A PREROUTING -p TCP -i $INET_IFACE -dport 25:25 \
>>> --to-destination 192.168.0.65:25
>>> $IPT -t NAT -A PREROUTING -p TCP -i $LOCAL_IFACE -dport 25:25 \
>>> --destination $INET_ADDRESS -j DNAT --to-destination 192.168.0.65:25
>>> Это часом уже не бред попер?
>> пиши iptables -A INPUT -s !$INT_NET -d $INT_IP -p tcp --dport 25 -j ACCEPT
>> -//- --dport 110 -j ACCEPT
> Тут точно ACCEPT а не DROP или REJECT ??? Это 110-й порт...
сори немного не так. я ошибся выше:
1. iptables -A INPUT -s $INT_NET -d $INT_IP -p tcp --dport 25 -j ACCEPT
2. iptables -A INPUT -s $INT_NET -d $INT_IP -p tcp --dport 110 -j ACCEPT
3. iptables -A INPUT -s 0/0 -d $INET_IP -p tcp --dport 25 -j ACCEPT
4. iptables -A INPUT -s 0/0 -d $INET_IP -p tcp --dport 110 -j REJECT
а после этих правил можешь всем всё закрывать по этим портам.
>> iptables -A input -s 0/0 -d $INET_IP -p tcp --dport 25 -j ACCEPT
>> iptables -A input -s 0/0 -d $INET_IP -p tcp --dport 110 -j REJECT
--
Sincerely,
Alexey S. Kuznetsov
AK2351-RIPE
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2004-11-11 15:05 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-11 13:22 [Comm] IPtables вопрос Ivanov Maxim
2004-11-11 13:33 ` Alexey S. Kuznetsov
2004-11-11 14:17 ` Re[2]: " Ivanov Maxim
2004-11-11 14:24 ` Re[3]: " Ivanov Maxim
2004-11-11 15:05 ` Dmitry Lebkov
2004-11-11 14:34 ` Alexey S. Kuznetsov
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