From: alexb@spsul.com.br
To: netfilter@newkirk.us
Cc: netfilter@lists.netfilter.org
Subject: Re: Is it possible connecting to a forwarded port from inside the network?
Date: Mon, 17 Mar 2003 15:17:09 -0300 (BRT) [thread overview]
Message-ID: <1047925029.3e761125061db@www.spsul.com.br> (raw)
In-Reply-To: <200303161503.41910.netfilter@newkirk.us>
And on the Gateway ? It seams that the PREROUTING DNAT on the OUTPUT chain has
some problems. It seams that the replays from connections started at the Gateway
to the DNATed ip:port doesn't get unDNATed when it comes back to the INPUT chain.
Exemple
|
| 200.200.200.200
-------
| GW |
| |
-------
| 192.168.200.1/24
|
|--|--|--|--|
| | | | |
| 192.168.200.200 DNS Server
iptables -t nat -A PREROUTIND -p tcp -d 200.200.200.200 --dport 53 -j DNAT --to
192.168.200.200:53
iptables -t nat -A PREROUTIND -p udp -d 200.200.200.200 --dport 53 -j DNAT --to
192.168.200.200:53
iptables -t nat -A OUTPUT -p tcp -d 200.200.200.200 --dport 53 -j DNAT --to
192.168.200.200:53
iptables -t nat -A OUTPUT -p udp -d 200.200.200.200 --dport 53 -j DNAT --to
192.168.200.200:53
iptables -t nat -A POSTROUTING -s 192.168.200.0/24 -d 192.168.200.200 -p tcp
-dport 53 -j SNAT --to 192.168.200.1
iptables -t nat -A POSTROUTING -s 192.168.200.0/24 -d 192.168.200.200 -p udp
-dport 53 -j SNAT --to 192.168.200.1
But the GW can't use 200.200.200.200 for his DNS server while external hosts and
internal host could.
Alex
Cópia Joel Newkirk <netfilter@newkirk.us>:
> On Sunday 16 March 2003 02:18 pm, Jiwei Wang wrote:
> > Hello,
> >
> >
> >
> > I'm using iptables on a RedHat 8.0 box to do firewalling and port
> > forwarding. The port-forwarding works perfectly when accessed from
> > outside my internal networks. However, I cannot access the
> forwarded
> > ports from inside the network.
> >
> >
> >
> > I tried to use two IP addresses to do this. That is, I have public
> IP
> > addresses a.b.c.x and a.b.c.y both assigned to my Internet facing
> > eth0; I use a.b.c.x for SNAT and a.b.c.y for DNAT port forwarding
> > (a.b.c.y:80 is forwarded to an internal host port 80); from the
> > Internet a.b.c.y:80 works ok, but I still cannot access a.b.c.y:80
> > from any of my internal box.
>
> add this, where d.e.f.y is the IP of the internal host, and d.e.f.z is
>
> the internal IP of the firewalling box:
>
> iptables -t nat -A POSTROUTING -o eth1 -d d.e.f.y -p tcp --dport 80 -j
> SNAT --to d.e.f.z
>
> This will force a.b.c.y to respond to the firewall instead of directly
> to
> the client, so that the reverse DNAT can take place. As it stands, the
>
> server is probably trying to reply directly to the client, which is
> discarding the reply. (it's waiting for a response from a.b.c.y, not
> d.e.f.y!) Once the reply comes back to the firewall, it will undo the
>
> SNAT, setting the destination of the reply back to the original client,
>
> then it will undo the DNAT, setting the 'source' of the reply back to
> the public IP a.b.c.y.
>
> j
>
>
next prev parent reply other threads:[~2003-03-17 18:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-16 19:18 Is it possible connecting to a forwarded port from inside the network? Jiwei Wang
2003-03-16 20:03 ` Joel Newkirk
2003-03-16 22:40 ` Jiwei Wang
2003-03-17 18:17 ` alexb [this message]
2003-03-16 20:25 ` Cedric Blancher
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=1047925029.3e761125061db@www.spsul.com.br \
--to=alexb@spsul.com.br \
--cc=netfilter@lists.netfilter.org \
--cc=netfilter@newkirk.us \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).