From: "Москаленко Алексей Владимирович" <mav@elserv.msk.su>
To: sysadmins@lists.altlinux.org
Subject: Re: [Sysadmins] iptables
Date: Fri, 15 Mar 2019 16:53:01 +0300
Message-ID: <4dad495e45db9472ec822640ae180490@elserv.ru> (raw)
In-Reply-To: <87230f19-c43b-d7ab-afb8-75e61f104f89@rambler.ru>
Фаизов Алишер писал 15.03.2019 16:36:
> Коллеги, подскажите какие правила необходимо прописать в iptables в
> следующей ситуации?
>
> Есть шлюз, у него интерфейс с внешним ip и с внутренним, за внутренним
> веб-сервер. Снаружи вижу сайт. А вот с самого веб сервера curl
> отвечает connection refused.
Здравствуйте.
Скорее всего, у Вас DNS-запись указывает на внешний IP вашего сайта,
поэтому он пытается обращаться к себе по внешнему IP. Вариантов решения
проблемы у Вас два:
1. Прописать в /etc/host на web-сервере или в локальном DNS A-запись для
сайта, указывающую на внутренний адрес web-сервера; или
2. На шлюзе прописать правило NAT вида iptables -t nat -A PREROUTING -i
${INTERNAL_IFNAME} -s ${INTERNAL_NET} -d {EXTERNAL_IP} -p tcp -m
multiport --dports ${WEB_SERVER_PORTS} -j DNAT --to-destination
${WEB_SERVER_IP} и (возможно) соответствующее ему правило FORWARD
(обратите внимание, что пакеты будут приходить и уходить с одного и того
же внутреннего интерфейса).
Мне первый вариант кажется более правильным.
next prev parent reply other threads:[~2019-03-15 13:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-15 13:36 Фаизов Алишер
2019-03-15 13:53 ` Москаленко Алексей Владимирович [this message]
2019-03-15 14:52 ` Sergey
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=4dad495e45db9472ec822640ae180490@elserv.ru \
--to=mav@elserv.msk.su \
--cc=sysadmins@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 sysadmins discussion
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/sysadmins/0 sysadmins/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 sysadmins sysadmins/ http://lore.altlinux.org/sysadmins \
sysadmins@lists.altlinux.org sysadmins@lists.altlinux.ru sysadmins@lists.altlinux.com
public-inbox-index sysadmins
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.sysadmins
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git