netfilter.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shane Wang <xwang4396@gmail.com>
To: netfilter@vger.kernel.org
Subject: How to configure "full cone" NAT using iptables
Date: Tue, 16 May 2023 17:58:00 +0800	[thread overview]
Message-ID: <CAF_hPjN0pV9w+RmO8rkSnNwd-2+ep6vmy-7JaREvUFSyNzuGhg@mail.gmail.com> (raw)

Hi folks,

I have found a solution on
https://www.joewein.net/info/sw-iptables-full-cone-nat.htm, which
works fine for a single internal IP address. However, I am struggling
to configure "full cone" NAT for multiple internal IP addresses using
iptables.

I have tried the following rules, but they do not seem to work:

iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to-source 192.168.2.170
iptables -t nat -A PREROUTING -i eth0 -j DNAT --to-destination 10.0.0.1
iptables -t nat -A PREROUTING -i eth0 -j DNAT --to-destination 10.0.0.2

Could you please advise me on how to configure "full cone" NAT for
multiple internal IP addresses using iptables? If this is impossible,
are there any alternative solutions to achieve this goal?

             reply	other threads:[~2023-05-16  9:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-16  9:58 Shane Wang [this message]
2023-05-16 10:15 ` How to configure "full cone" NAT using iptables Reindl Harald
2023-05-16 11:07   ` Shane Wang
2023-05-16 11:17     ` Reindl Harald
2023-05-16 11:18     ` Kevin P. Fleming
  -- strict thread matches above, loose matches on Subject: below --
2023-05-16 14:32 Joshua Moore
2023-05-16 14:48 ` Reindl Harald
2023-05-16 14:59   ` Joshua Moore
2023-05-16 15:11     ` Reindl Harald
     [not found]       ` <CAKbpK3xkw5oryaxGdgFmNyxRpgGsh5OnZXsDEjN9DKaJZqhnsw@mail.gmail.com>
2023-05-16 15:16         ` Reindl Harald
2023-05-16 18:36     ` imnozi

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=CAF_hPjN0pV9w+RmO8rkSnNwd-2+ep6vmy-7JaREvUFSyNzuGhg@mail.gmail.com \
    --to=xwang4396@gmail.com \
    --cc=netfilter@vger.kernel.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).