Linux Netfilter discussions
 help / color / mirror / Atom feed
* Re: How to configure "full cone" NAT using iptables
@ 2023-05-16 14:32 Joshua Moore
  2023-05-16 14:48 ` Reindl Harald
  0 siblings, 1 reply; 11+ messages in thread
From: Joshua Moore @ 2023-05-16 14:32 UTC (permalink / raw)
  To: Kevin P. Fleming; +Cc: netfilter

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8-sig", Size: 1363 bytes --]

“Full cone” NAT simply means that there is no longer a strict connection tracking or enforcement of what IPs can connect back to the ports that are associated with the internal IP.

Traditional NAT:
- TCP connection to 1.1.1.1 from 192.168.1.10 over outside translated TCP source port 45619. All packets destined to port 45619 MUST come from 1.1.1.1.

Full cone NAT:
- TCP connection to 1.1.1.1 from 192.168.1.10 over outside translated TCP source port 45619. All packets destined to port 45619 are allowed from ANY IP.

Another word for this behavior is “endpoint independent” NAT/filtering.

> On May 16, 2023, at 4:46 AM, Kevin P. Fleming <lists.netfilter@kevin.km6g.us> wrote:
> 
> On Tue, May 16, 2023, at 07:07, Shane Wang wrote:
>> Thanks for your reply.
>> I think the "--to-destination 10.0.0.1" rule will be matched, and the
>> "--to-destination 10.0.0.2" rule will never be matched.
>> Does iptables unsupported "full cone" NAT for multiple internal IP addresses?
> 
> Does *any* platform support such a configuration? Based on my understanding of what 'full cone' means, every internal address needs a separate external address to be fully mapped to it. Your example shows that you have one external address, which means you can only provide 'full cone' mapping for one internal address, no matter which tool you use.

^ permalink raw reply	[flat|nested] 11+ messages in thread
* How to configure "full cone" NAT using iptables
@ 2023-05-16  9:58 Shane Wang
  2023-05-16 10:15 ` Reindl Harald
  0 siblings, 1 reply; 11+ messages in thread
From: Shane Wang @ 2023-05-16  9:58 UTC (permalink / raw)
  To: netfilter

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?

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-05-16 18:36 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-16 14:32 How to configure "full cone" NAT using iptables 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
  -- strict thread matches above, loose matches on Subject: below --
2023-05-16  9:58 Shane Wang
2023-05-16 10:15 ` Reindl Harald
2023-05-16 11:07   ` Shane Wang
2023-05-16 11:17     ` Reindl Harald
2023-05-16 11:18     ` Kevin P. Fleming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox