sfreemire / IP_MAP_Calculator

MAP-T Parameter Calculator for IP Networking
MIT License
5 stars 1 forks source link

IP_MAP_Calculator

IP Networking MAP-T Addressing Calculator

MAP-T, the 'Mapping of Address and Port using Translation,' is a stateless NAT64 solution that enables sharing of IPv4 addresses between multiple end user gateway devices. It is primarily used by Internet service providers (ISPs) to reduce the number of Internet-routable IPv4 addresses used when configuring a group of customer gateway routers. For example, one MAP-T configuration allows 64 devices to share the same IP address. This sharing ratio allows 16,384 customer gateways to be connected to the Internet using only 256 unique IPv4 addresses.

IP_MAP_Calculator calculates IPv4 address sharing and port allocations for "Mapping of Address and Port" (MAP) rules, as described in RFC7599 (MAP-T) and RFC7597 (MAP-E). It also displays binary translations, to show how these values are calculated using MAP-T rules and the assigned IPv6 address prefixes at the bit level.

Dependencies

*In February 2024, the developer of PySimpleGUI deleted the open-source package from github and pypi, moved the package ownership to PySimpleSoft Inc., and changed the license to a subscription model requiring registration and a downloading a key. There are two licenses available, a free "Hobbyist" license and a paid "Commercial" license. If registration or licensing is an issue for you, the PySimpleGUI project has been forked on github as FreeSimpleGUI. It is available through pypi with pip install FreeSimpleGUI. I will be testing this package with IP_MAP_Calculator and sharing the results here.

FreeSimpleGUI Update, 08/28/2024:\ I have tested the application with the latest version of FreeSimpleGUI (v5.1.1), and it appears to work fine. Therefore, I am going to add another app version, named IPMC.py, to this repository for use with that package. If FreeSimpleGUI continues to be actively maintained for a reasonable period of time, I will probably be deprecating the PySimpleGUI version of the app (IP_MAP_Calculator.py).

MAP-T Function and Rules Explanation

The ability to share the same IPv4 address between multiple devices is accomplished by allocating unique sets of IP source port numbers to each device sharing a particular IPv4 address. Using this strategy, a device can be identified using its source address and port number. The allocation of ports is part of the MAP-T algorithms, and only requires that each device be assigned a unique, MAP-T IPv6 prefix as part of their configuration. Once configured, MAP-T devices begin translating their outbound IPv4 packets into IPv6 packets. The source ports used are taken from their unique allocation of IP port numbers. Translated packets are forwarded to a MAP-T Border Relay (BR) router, which acts as a NAT64 gateway to external networks.

Having large numbers of devices doing 4-in-6 encapsulation, which is stateful and requires tables to record IP/port/device relationships, would create significant memory and compute overhead for MAP-T BR routers. Additionally, encapsulation of IPv4 traffic into IPv6 brings with it all of the well-known issues with tunneling in general. Translation of IPv4 into IPv6 by embedding IPv4 addresses directly into IPv6 addresses is stateless, and greatly reduces the additional overhead required. It also enables redundant or load-balanced BR routers to handle traffic for the same MAP-T endpoints without the use of synchronization or failover protocols. For these reasons, MAP-T is increasingly being seen as the protocol of choice when an IPv4 conservation strategy is needed.

MAP-T "Rules" enables customer gateways to translate their IPv4 source addresses into unique IPv6 addresses for sending outbound packets across the internal network. It also enables the BRs to re-calculate the same IPv6 addresses for forwarding reply packets to those gateways across the internal network. The ability to calculate the required addresses instead of having to do stateful table lookups greatly reduces the hardware requirements for the BRs. It also allows for the use of redundant and load-balanced BRs, without the need for failover or other state-sharing protocols.

The MAP-T solution is enabled by:

Native IPv6

Native IPv6 traffic does not participate in MAP-T translation. Any native IPv6 packets transmitted by devices in a MAP-T domain are not modified in any way, and bypass the BR gateways when transiting to external networks.

Executables

Executable files are located in the executables folder. They might only run on the OS or hardware they were built on.

v0.7.0:

v0.8.1: Window is scrollable for use on smaller displays.

v0-9-1: Added User IPv6 hex & binary Source Address display field

v0-10-4: Added active highlighting to Source Address display field Added "Excluded Ports" number to "Results" display "Rule String" entry field now automatically strips off comments

v0-11-9: Fixed several crash bugs Changed some formatting

License

IP_MAP_Calculator is released under the "MIT License Agreement".

See LICENSE file for details.