For AI agents: this documentation is indexed for you in llms.txt, and all of it in /llms.txt. Every page is also available as markdown: append .md to its address.

Service profiles and IP pools

TPOSS associates each user with a home country specified by a service profile. A service profile defines the following settings:

  • NAT IP pool
  • IP pools
  • Primary and secondary DNS servers

This document describes how to configure service profiles and the related settings in TPOSS.

Service profiles configuration

To find a suitable IP pool, assign a DNS server, and a NAT pool, TPOSS must know which service profile to use for a subscriber authorized in the network. TPOSS provisions service profiles during startup based on the provided configuration. See the example:

yaml

Note

In this example, the DE parameter specifies a home country name, but it is recommended to switch to the new configuration format for home country names.

Multiple service profiles with same home country

In the previous section, DE specifies a home country name for the given service profile. This configuration key must be unique across all service profiles. If you need to specify multiple service profiles with the same home country name, use the profiles.{PROFILE_ID}.name parameter.

Note

If you want to specify multiple service profiles with the same home country name, make sure that each such service profile has a configured selector.

See the example for profiles.DE-1 and profiles.DE-2 parameters:

yaml

Note

Since the name values for different profiles may be the same, the keys like DE-1 and DE-2 must be unique.

Service profiles selector

The service profile selector is an optional configuration parameter that is represented by the profiles.{PROFILE_ID}.selector field. When selecting a service profile, TPOSS looks through all profiles and defines a set of profile candidates to choose from. The set of profile candidates contains:

  • Profiles matching the selector
  • Profiles with no selector defined but matched by name

The selector represents a set of key-value pairs split by a comma. Multiple items of the set are interpreted as logical AND conditions. Each key must be split from its value with a colon :. The key represents the name of RADIUS AVP. The value is a regular expression that represents a value of this RADIUS AVP.

See the example:

yaml

If the selector is matched for the subscriber, but the home country name associated with the subscriber is not equal to the home country name associated with the profile, such profile is not selected. You can change this behavior by setting the profiles.{PROFILE_ID}.ignore_profile_name configuration option to true:

yaml

Service profile selection

Note

To prevent ambiguity during selection of a service profile, do not specify two or more service profiles with the same selector, the same home country name, and the same values of subscriber_required. In such a case, TPOSS may not know which profile to choose. The behaviour in such cases is unpredictable and the random service profile is used.

As described above, TPOSS must find a service profile to apply for a given subscriber at each RADIUS Access-Request. This process looks as follows:

  1. TPOSS receives a RADIUS Access-Request.
  2. TPOSS tries to fetch a subscriber and all the user data based on the IMSI from the incoming RADIUS Access-Request.
  3. TPOSS checks all the provisioned service profiles and selects those for which the selector is matched or selector not set at all.
  4. TPOSS checks all the provisioned service profiles and selects those for which a home country name is matched with the subscriber's home country name, and for which subscriber_required is set to true.
  5. If the list of profiles from step 4 is not empty, TPOSS looks through the list built in step 3 and tries to find a service profile that matches both name and selector, and has the highest precedence.
  6. If the list of profiles from step 4 is empty, the following steps depend on the subscriber:
    • If the subscriber is not provisioned, TPOSS looks for a service profile that is matched by the selector and its profiles.{PROFILE_ID}.subscriber_required is set to false.
    • If the subscriber is provisioned, TPOSS looks for a service profile that matches the selector and has profiles.{PROFILE_ID}.subscriber_required set to true. Moreover, it must match the subscriber’s home country name or have profiles.{PROFILE_ID}.ignore_profile_name set to true.
  7. If a service profile is not found, the request is rejected.

Service profiles without a subscriber

The user may not have a provisioned subscriber or associated service profile in the TPOSS database. You can specify service profiles for such users with the profiles.{PROFILE_ID}.subscriber_required configuration parameter. Such service profiles must not specify these parameters:

  • An IP pool
  • A NAT IP pool
  • Primary and secondary DNS servers

Service profiles precedence

The profiles.{PROFILE_ID}.precedence configuration parameter specifies the precedence of the service profile. If TPOSS finds two or more service profiles that can be applied for a user, it selects and applies a service profile with the highest precedence. You can change the precedence at runtime using the following API:

elixir
  • profile_id is the {PROFILE_ID} of the service profile. The data type of profile_id is atom, so if the profile ID is DE, pass it as :'DE'.
  • precedence is an integer number that represents the new value precedence for the given service profile.

Note

Don't set precedence to value other than 0 by default. It should be used only in the maintenance mode. If you change this value at runtime, TPOSS does not preserve it after a restart and uses the original value instead. To preserve this value, adjust the values.yaml configuration file.

IP pools

Each service profile may contain an IP pool. Such an IP pool must be defined in the ippools section. If a service profile specifies an IP pool which is not configured in the ippools section, TPOSS prints an error on start and exits. If a service profile does not specify an IP pool range, TPOSS accepts such users anyway, but an IP address is not allocated.

IP pools configuration

To allocate Framed-IP-Addresses, TPOSS uses IP pools. They are specified using these configuration options:

yaml
  • wan_ip_range - the name of a pool which defines an IP range from where IPs are allocated.
  • range - the range of IP addresses.
  • blocks - the number of sub-blocks into which the IP pool is split. The IP blocks are distributed over TPOSS instances within a cluster.
  • initial_active_blocks - the number of blocks to activate initially per instance. You can use this option to spread IP usage over the range.
  • mark_inactive - the percentage of block usage after which the block is marked as inactive. After the block is marked as inactive, TPOSS does not allocate IPs from this block anymore but only populates it back when IPs are released.
  • reactivate - the percentage of busy IPs within the inactive block after which the IP block that previously was marked as inactive is marked as active again and TPOSS continues to use it.
  • packed - the percentage of used IPs from a given block after which TPOSS tries to pre-fetch a new block of IP addresses.
  • allow_to_decrease_number_of_blocks - the boolean value that provides the ability to decrease the number of blocks. TPOSS ignores the new number of blocks if its value is set to false and the new number of blocks is lower than the previous one. In such a case, the original number of blocks is used.

The ippools_selectors parameter contains the mapping between pool names and their selectors based on the RADIUS attribute and its value.

If you expect TPOSS to allocate IP addresses, set this configuration option to false to handle RADIUS Access-Request from PGW properly:

yaml

By default, allocated Framed IP addresses are stored in the MySQL IP table. To reduce the number of database queries needed for the allocation of a Framed IP address, use this configuration option:

yaml

If the value of this option is set to true, the separate IP table is not used anymore and allocated IP addresses are stored only in the network session table.

Note

The sessions.store_ip_within_network_sessions feature is experimental. The new behaviour is disabled by default to preserve backward compatibility with the previous versions of TPOSS.

Change IP pools block size and count

Caution

You may change the IP pool block count only when the system is not under heavy load as it may affect the production environment. The ability to decrease the number of blocks is disabled by default as it may lead to ineffective usage of blocks when TPOSS is under load. You can change this behaviour by setting the ippools.{IP-POOL}.allow_to_decrease_number_of_blocks to true, although it is not recommended.

You can change the IP pool block count, for example, to have new blocks activated more frequently and spread the IP usage better over the range. You can also increase the block count to avoid bottlenecks that occur due to heavy usage.

There are two ways to change the IP pool block count. The first one is to adjust the TPOSS cluster configuration followed by a restart. To change the block count, adjust the ippools.{IP-POOL}.blocks configuration option. As a result, the next starting TPOSS instance will migrate the existing blocks to the desired size and count.

The second way is to adjust the number of blocks for the given IP pool at runtime without TPOSS restart. To change the number of blocks, use the following command in the TPOSS remote console:

elixir

Then, apply the configuration at runtime:

elixir
  • IP-POOL is an Elixir atomOpens in a new tab defined in the TPOSS values file at the path ippools.{IP-POOL}.
  • BLOCK-COUNT is an integer which represents number of blocks within an IP pool.

Note

If you change the number of blocks at runtime, adjust this IP pool configuration also in the values.yaml file. Otherwise, TPOSS will continue to use the original number of blocks after the restart.