X
X
X
X

Knowledge Base

HomepageKnowledge BaseLinux - MultiVPS IPv6+IPv4How do I calculate the port range f...

How do I calculate the port range for IPv4 NAT?

How do I calculate my ports?

IPv4 NAT external 10-port range is, funnily, calculated from the end of your... IPv6 address.

IPv6 is a hexadecimal system, meaning that, past the usual allocation 0-9 on a given IP, you also have A-F.  Our IPv6s are usually given sequentially, but, due to the NAT implementation being made later, port allocation is organized slightly differently to the IPv6 allocation. We'll now explain.

An IPv6 address can range at its end, e.g. f800-f809, and then go f80a, f80b, etc. The "Decimal Range" shows the IP order you are located at from a normal standpoint, from 1 to 255, and it's used in combination with hexadecimal values. Check this explanatory table:

An address ending on, for example, f80e::1, for example, is the 14th address on the decimal range;
Our ports allocation starts at 10000, meaning that each block has ports 10000-10009, 10010-10019, etc;
Therefore, you multiply to have your port allowance:

14 x 10 = 140
Port Start: 10000
Your Block of IPv4 Ports: 10000+140 = 10140-10149

Let's assume a harder example, one earlier on the table, for example an address ending on f8d1::1.

Per the previous table, this is the 209th address on the list (Decimal Range says "d0-df" does the range 208-223, therefore d1 is one address later than d0, making it the 209th address);
Remember the port allocation starts at 10000;
Therefore, you multiply to have your port allowance:

209 x 10 = 2090
Port Start: 10000
Your Block of IPv4 Ports: 10000+2090 = 12090-12099.

You always locate the address on the hexadecimal scale first, and then count to the equivalent on the decimal scale. This way, you'll always know in which order your IP address is, and therefore, which ports you have available. The rule is the same regardless of the end having numbers only, numbers+letters or letters only.

Inbound and outbound ports usage

Inbound: freely available via IPv6, supported over the 10-port range on IPv4 only, in TCP and UDP.
Outbound: freely available via IPv6, supported over the 10-port range on IPv4 only, in TCP and UDP.

ICMP is not supported on this mode, however the forwarding is in place. Ports are opened automatically and listeners are in-place automatically - simply go ahead and use the range.

Naturally, should you have any question on which port you're allowed, you can always send us a ticket and we'll answer your port range. This also means more purchased IPv6s allow you extra IPv4 NAT port range, at 10 extra ports per each acquired IPv6 (but also mean you need to do more routing/internal VPS work to include all of those IPv6s on your VPS, of course).

Known usage incompatibilities

Check this article.

Can't find the information you are looking for?

Create a Support Ticket
Did you find it useful?
(139 times viewed / 0 people found it helpful)

Powered by WISECP
Top