From: "Christoph Galuschka" <christoph.galuschka@tikom.at>
To: netfilter@lists.netfilter.org
Subject: Re: Trying to set up NAT
Date: Fri, 01 Apr 2005 18:13:33 +0200 [thread overview]
Message-ID: <424D8F4D.3445.1199BB81@localhost> (raw)
In-Reply-To: <424D6F69.8000803@mnemon.de>
Hello,
thanks Jörg for the help. It helped me solve the problem.
First I had to enable forwarding on the machine (echo 1 >
/proc/sys/net/ipv4/ip_forward). Then I wrote four rules, one for
postrouting and one for prerouting, and two for forwarding to
and from the new destination.
And everything works :)
thanks any have a nice weekend.
Christoph
Am 1 Apr 2005 um 17:57, schrieb Jörg Harmuth:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi Christoph,
>
> unfortunately you don't provide any information about your
rule set.
> So this is only a wild guess.
>
> I assume your ruleset looks something like this:
>
> iptables -L -t nat:
> Chain PREROUTING (policy ACCEPT)
> target prot opt source destination
> DNAT tcp -- anywhere anywhere tcp \
> dpt:15000 to:10.1.1.2:80
>
> Chain POSTROUTING (policy ACCEPT)
> target prot opt source destination
> MASQUERADE all -- anywhere anywhere
>
> Chain OUTPUT (policy ACCEPT)
> target prot opt source destination
>
> Also assuming, that a client - say 10.10.10.3 - tries to
connect to
> 10.10.10.1:15000 you have a conntrack entry like this:
>
> cat /proc/net/ip_conntrack | grep -i unreplied:
> tcp 6 80 SYN_SENT src=10.1.1.3 dst=10.1.1.1
sport=1759 \
> dport=15000 [UNREPLIED] src=10.10.10.2 dst=10.10.10.3
sport=80 \
> dport=1759 use=1
>
> As you can see client 10.10.10.2 gets an answer package
from
> 10.10.10.3 but expects the answer from 10.10.10.2. If this is
your
> scenario you need SNAT too, eg:
>
> iptables -t nat -A POSTROUTING -p tcp -d 10.10.10.2 --
dport 80 -j SNAT \
> - --to 10.10.10.1
>
> Another possibility is that you didn't allow this traffic in your
> FORWARD chain and the policy is DROP (REJECT).
Something like this
> makes it work:
>
> iptables -A FORWARD -p tcp -d 10.10.10.2 --dport 80 -m
state --state \
> NEW,ESTABLISHED,RELATED -j ACCEPT
>
> iptables -A FORWARD -p tcp -s 10.10.10.2 --sport 80 -m
state --state \
> ESTABLISHED,RELATED -j ACCEPT
>
> If you need further help, please post your rule-set.
>
> HTH and have a nice time
>
> Jörg
>
>
> Christoph Galuschka schrieb:
>
> > Hello,
> >
> > I've tried the whole day setting up NAT and it won't work. I
have
> > the follinwg situation: I have a proxy server (the machine
running
> > NAT) and various other machines. I want the proxy server
to NAT
> > some incoming connections to other machines. ie: A
connection to
> > the proxy (10.1.1.1) on port 15000 should go to another
machine
> > (10.1.1.2) on port 80 via the proxy. I have already
managed a
> > locale NAT (meaning chaning ports ie from 15000 to 80 on
the
> > proxy), but as soon as I try to DNAT to another machine it
won't
> > work anymore.
> >
> > Any help would be apprechiated.
> >
> > thanks, happy weekend an regards Christoph
> >
>
>
> - --
> - -----------------------------------------------------------------------
> mnemon
> Jörg Harmuth
> Marie-Curie.Str. 1
> 53359 Rheinbach
>
> Tel.: (+49) 22 26 87 18 12
> Fax: (+49) 22 26 87 18 19
> mail: harmuth@mnemon.de
> Web: http://www.mnemon.de
> PGP-Key:
http://www.mnemon.de/keys/harmuth_mnemon.asc
> PGP-Fingerprint: 692E 4476 0838 60F8 99E2 7F5D B7D7
E48E 267B 204F
> - -----------------------------------------------------------------------
> Diese Mail wurde vor dem Versenden auf Viren und andere
schädliche
> Software untersucht. Es wurde keine maliziöse Software
gefunden.
>
> This Mail was checked for virusses and other malicious
software before
> sending. No malicious software was detected.
> - -----------------------------------------------------------------------
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.5 (MingW32)
> Comment: Using GnuPG with Thunderbird -
http://enigmail.mozdev.org
>
>
iD8DBQFCTW9ot9fkjiZ7IE8RAvtQAKDz5Fx6w8Kb4ZGxPriU7
RCRBPPA+wCg6Ptk
> a6MktEG9Y9O0ZVoE2QSbkuY=
> =eoTF
> -----END PGP SIGNATURE-----
>
>
prev parent reply other threads:[~2005-04-01 16:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-01 15:09 Trying to set up NAT Christoph Galuschka
2005-04-01 15:34 ` Harold Burchey
2005-04-01 15:50 ` Christoph Galuschka
[not found] ` <424D6F69.8000803@mnemon.de>
2005-04-01 16:13 ` Christoph Galuschka [this message]
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=424D8F4D.3445.1199BB81@localhost \
--to=christoph.galuschka@tikom.at \
--cc=netfilter@lists.netfilter.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
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