From: AShen <ashen@nsrz.ru>
To: ALT Linux Community general discussions <community@lists.altlinux.org>
Subject: Re: [Comm] iptables и переброска порта
Date: Wed, 29 Apr 2009 17:35:18 +0400
Message-ID: <49F85796.4000106@nsrz.ru> (raw)
In-Reply-To: <49F856A2.8050902@aston.ru>
Roman V. Tutov пишет:
> возникла необходимость перебросить порт 3389 с машины в локалке на
> внешний интерфейс машины выполняющей роль gw
> aaa.aaa.aaa.aaa - внешний интерфейс шлюзовой машины
> bbb.bbb.bbb.bbb- адрес машины внутри сети порт которой нужно
> перебросить вовне
>
> контрукция вида
> iptables -t nat -A PREROUTING -p tcp -d aaa.aaa.aaa.aaa --dport 3389
> -j DNAT --to-destination bbb.bbb.bbb.bbb:3389
> вполне работает , но хочеться чтоб это правило было не для всего
> интернета а для конкретных адресов
> т.е я хочу указать "-dst" но для нескольких адресов
>
> собственно как ?
Пример правил для скрипта настройки iptables:
#Наш внешний IP-адрес
INET_IP=""
#IP-адрес в инете на который разрешаем ходить по RDP
RDP_IP=""
#IP-адрес в ЛВС кому разрешаем лезть в инет по RDP
RDP_USER_IP=""
#Слушаем на INET-интерфейсе RDP, если его нужно нам пробрасывать внутрь ЛВС
$IPTABLES -A INPUT -i $INET_IFACE -p tcp -m tcp --dport 3389 -j
ACCEPT # RDP
#Выход для RDP из ЛВС
$IPTABLES -t nat -A POSTROUTING -s $RDP_USER_IP -d $RDP_IP -o
$INET_IFACE -j SNAT --to-source $INET_IP
$IPTABLES -A FORWARD -s $RDP_USER_IP -d $RDP_IP -j ACCEPT
#Вход в ЛВС для RDP
$IPTABLES -t nat -A PREROUTING -s $RDP_IP -i $INET_IFACE -p tcp --dport
3389 -j DNAT --to-destination $RDP_USER_IP
$IPTABLES -A FORWARD -s $RDP_IP -i $INET_IFACE -p tcp --dport 3389 -d
$RDP_USER_IP -j ACCEPT
P.S.: вопрос для sysadmins@
next prev parent reply other threads:[~2009-04-29 13:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-29 13:31 Roman V. Tutov
2009-04-29 13:35 ` AShen [this message]
2009-04-29 13:45 ` Timur Batyrshin
2009-04-29 13:55 ` Roman V. Tutov
2009-04-29 14:51 ` Владимир Кутявин
2009-04-29 13:56 ` Владимир Кутявин
2009-04-30 4:31 ` Serge
2009-04-30 8:15 ` Владимир Кутявин
2009-04-30 13:47 ` Serge
2009-04-30 15:22 ` Владимир Кутявин
2009-04-29 14:43 ` Denis Nazarov
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=49F85796.4000106@nsrz.ru \
--to=ashen@nsrz.ru \
--cc=community@lists.altlinux.org \
/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