Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:dpi:faq:cgnat:start [2024/08/05 14:35] – elena.krasnobryzh | en:dpi:faq:cgnat:start [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== CG-NAT and NAT (Service 11)====== | ||
- | {{indexmenu_n> | ||
- | < | ||
- | < | ||
- | < | ||
- | The non-blocking dispatch algorithm in DPI, which distributes sessions across worker threads, imposes a limitation on which public IP address can be assigned to a subscriber from the pool: | ||
- | - To ensure that a subscriber receives their designated public address, the pool must contain at least as many addresses as there are worker threads (typically 2 for SSG-6 and 4 for SSG-10 and higher). You can determine the number of worker threads with the command <code bash> | ||
- | - If the pool contains only one address, it may not be assigned to all subscribers but only to those who fit the load balancing algorithm. | ||
- | </ | ||
- | |||
- | < | ||
- | You can see which public address has been assigned to a private one with the command <code bash> | ||
- | |||
- | Predicting the exact address that will be assigned to a subscriber from the pool in advance is impossible; it depends on various factors, particularly the current pool load. | ||
- | </ | ||
- | |||
- | < | ||
- | < | ||
- | Indeed, the session lifetime in NAT is limited because the number of sessions per subscriber is a limited resource, and a large number of inactive sessions in the pool reduces NAT and overall performance. | ||
- | |||
- | NAT cannot distinguish whether a session became inactive due to an accident or simply because there is no activity, and it closes such long-hanging sessions by inactivity timeout. This behavior is standard and supported by most CG-NAT manufacturers. | ||
- | |||
- | In SSG, session lifetimes can be adjusted with the following parameters: | ||
- | * '' | ||
- | * '' | ||
- | |||
- | <note warning> | ||
- | |||
- | To maintain long inactive connections, | ||
- | |||
- | You can configure '' | ||
- | |||
- | **Example** configuration on the ssh server: add the line to the ''/ | ||
- | <code bash> | ||
- | ServerAliveInterval 60 | ||
- | </ | ||
- | |||
- | **Example** configuration on the ssh client: add the lines to the '' | ||
- | <code bash> | ||
- | Host * | ||
- | ServerAliveInterval 60 | ||
- | </ | ||
- | or in the command line: | ||
- | <code bash> | ||
- | ssh -o TCPKeepAlive=yes -o ServerAliveInterval=60 user@example.com | ||
- | </ | ||
- | |||
- | **Example** configuration for all applications in CentOS: add the lines to the ''/ | ||
- | <code bash> | ||
- | net.ipv4.tcp_keepalive_time = 600 | ||
- | net.ipv4.tcp_keepalive_intvl = 60 | ||
- | net.ipv4.tcp_keepalive_probes = 20 | ||
- | </ | ||
- | </ | ||
- | |||
- | < | ||
- | <note important> | ||
- | |||
- | Details: | ||
- | |||
- | By default, 64512 ports (65535-1023, | ||
- | |||
- | On average, an individual creates 50-60 simultaneous sessions, meaning 64512/ | ||
- | |||
- | Also, consider the feature of port release mechanism in the NAT Pool: | ||
- | - When Service 11 is enabled for a subscriber, [[dpi: | ||
- | - When a subscriber starts establishing sessions, ports are taken from the common SSG DPI queue and [[dpi: | ||
- | - If a specific Public IP has many subscribers competing for free ports, subscribers may experience access issues. | ||
- | |||
- | Recommendations for creating and operating NAT Pools: | ||
- | - Subscribers under blocking (Service 5 + policing) should be placed in a separate NAT Pool to avoid impacting active subscribers. For instance, an iPhone may establish many sessions searching for an active service. | ||
- | - Create sparse pools and separate clients into different NAT Pools by type: individuals and corporate users. | ||
- | - Monitor clients generating high load and work with them. For receiving, processing, and storing NetFlow from DPI, we suggest using the [[dpi: | ||
- | </ | ||
- | |||
- | < | ||
- | < | ||
- | - Changing the session limit:< | ||
- | - Adding additional addresses to the pool:< | ||
- | - Reducing the pool | ||
- | |||
- | <note important> | ||
- | In this case, you will need to free the pool, delete it, and create it with new parameters.</ | ||
- | |||
- | For convenience, | ||
- | <code bash> | ||
- | yum install epel-release yum-utils | ||
- | yum-config-manager --disable epel | ||
- | yum --enablerepo epel install jq | ||
- | </ | ||
- | |||
- | Then save the information about the subscribers of the current pool, delete and recreate the pool, and reconnect the subscribers: | ||
- | <code bash> | ||
- | fdpi_ctrl list all --service 11 --profile.name test_nat_4000 --outformat json | jq ' | ||
- | fdpi_ctrl list all --service 11 --profile.name test_nat_4000 --outformat json | jq -r ' | ||
- | fdpi_ctrl del all --service 11 --profile.name test_nat_4000 | ||
- | fdpi_ctrl del profile --service 11 --profile.name test_nat_4000 | ||
- | fdpi_ctrl load profile --service 11 --profile.name test_nat_4000 --profile.json '{ " | ||
- | fdpi_ctrl load --service 11 --profile.name test_nat_4000 --file save_users.txt | ||
- | </ | ||
- | Do not forget to change the pool name and its new parameters in the commands to the ones you need. | ||
- | </ | ||
- | |||
- | accordion-item> | ||
- | |||
- | < | ||
- | < | ||
- | Yes, the IP is reflected in the accounting messages, such as Start and Interim. For example, using Cisco AVPair attributes in FreeRadius. | ||
- | |||
- | **Example: | ||
- | <code bash> | ||
- | echo " | ||
- | </ | ||
- | </ | ||
- | </ | ||