0

I'm wondering if routers limit the possible ports available to NAPT when port forwarding is configured. For example, given one public IP address all but two ports assigned via port forwarding, would there be only two ports available for NAPT for all devices?

To research this, I ran a search and came across the following excellent post, but the informative answer on Port Forwarding stopped short of getting into how port allocation works when both of these features are being used.
Why are IPv4 addresses running out?

4
  • For example, forwarding the standard HTTP port (TCP port 80) to an internal host means only that one host will be the HTTP server for the standard HTTP port. You cannot have two internal hosts receive HTTP on the standard port. NAPT is a kludge to extend the life of IPv4 until IPv6 becomes ubiquitous, and every host has a unique IP address, restoring the IP paradigm of end-to-end connectivity.
    – Ron Maupin
    Jan 21, 2022 at 20:32
  • I'll have to push myself to get IPv6 adopted in my premises then, thanks for the info! Let's get to it!
    – Q31
    Jan 21, 2022 at 20:35
  • 1
    one public IP address all but two ports assigned via port forwarding - why would anyone do that?...
    – Zac67
    Jan 21, 2022 at 20:45
  • @Zac67 to gather a data point about how port allocation works when port forwarding and NAPT are in use at the same time on same router for one public IP address. I dared not do it on my network and just thought to provide it as example for a thought exercise for those who know better than to do such a thing and I think I got my answer. Thanks.
    – Q31
    Jan 21, 2022 at 20:51

2 Answers 2

1

I'm wondering if routers limit the possible ports available to NAPT when port forwarding is configured.

That depends on the actual NAPT implementation at hand. Technically, it's possible to match incoming packets (or rather segments or datagrams) to existing (source) NAT sessions first and only apply the destination NAT mapping when there's no session yet.

0

I can't speak for other implementations, but for iptables the answer is no.

In iptables, the (user-editable) tables used to decide what-if any NAT to apply to new connections are entirely separate from the (machine generated) tables used to track existing connections and apply NAT mappings to them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.