Skip to contentSkip to conversation

NAPT with several IP addresses?

DISCUSSION Emmanuel Guiton 2 participants 3 messages Nov 21, 2003 netfilter

lore
Share & tools
lore
#0 lore raw

Hei!

I was looking at the Linux Netfilter Hacking HOWTO and at the source code in ip_nat_proto_tcp.c and I realized that doing NAPT with several ports is not supported, am I right?
I mean, in the HOWTO it's written "If IP_NAT_RANGE_PROTO_SPECIFIED isn't set, it means that the user is doing NAT, not NAPT". Well, we could also use a range of IP addresses and still perform NAPT, couldn't we? Still this possibility is not implemented, isn't it?

Anyway, that's just a remark to be sure that I'm not misunderstanding the code, nothing more.

Emmanuel

#1 lore raw
Quoted 5 lines · Emmanuel Guiton

Hei!

I was looking at the Linux Netfilter Hacking HOWTO and at the source code in ip_nat_proto_tcp.c and I realized that doing NAPT with several ports is not supported, am I right?

of course it is supported.

Quoted 4 lines

I mean, in the HOWTO it's written "If IP_NAT_RANGE_PROTO_SPECIFIED isn't set, it means that the user is doing NAT, not NAPT". Well, we could also use a range of IP addresses and still perform NAPT, couldn't we? Still this possibility is not implemented, isn't it?

I don't really understand what your point. IP_NAT_RANGE_PROTO_SPECIFIED just tells us if the give nat range has only a layer 3 (ip) range, or also layer 4 (tcp/udp/...) range. It doesn't tell you at all if you nat to a single address or to multiple addresses.

A nat mapping is internally always represented as a nat range. Even if the range has only the size of one (i.e. a single ip address or port).

Quoted 1 line

Emmanuel

Signature · 5 lines
- Harald Welte <[email protected]>             http://www.netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie
#2 lore raw

Sorry, my mistake, you can forget about my comment.
I'm not yet familiar with the whole code and I misunderstood the meaning of IP_NAT_RANGE_PROTO_SPECIFIED.

Thanks,
Emmanuel

Quoted 33 lines · Harald Welte
Quoted 5 lines · Emmanuel Guiton

Hei!

I was looking at the Linux Netfilter Hacking HOWTO and at the source code in ip_nat_proto_tcp.c and I realized that doing NAPT with several ports is not supported, am I right?

of course it is supported.

Quoted 3 lines

I mean, in the HOWTO it's written "If IP_NAT_RANGE_PROTO_SPECIFIED isn't set, it means that the user is doing NAT, not NAPT". Well, we could also use a range of IP addresses and still perform NAPT, couldn't we? Still this possibility is not implemented, isn't it?

I don't really understand what your point. IP_NAT_RANGE_PROTO_SPECIFIED just tells us if the give nat range has only a layer 3 (ip) range, or also layer 4 (tcp/udp/...) range. It doesn't tell you at all if you nat to a single address or to multiple addresses.

A nat mapping is internally always represented as a nat range. Even if the range has only the size of one (i.e. a single ip address or port).

Quoted 3 lines

Emmanuel