This article explains why AP-P Out of Port Errors are seen in a lightly used CGNAT system, and how to determine if a single user is exceeding their allotted number of ports?
An MX configured for CGNAT with a low number of unique pool users is seeing AP-P Out of Port Errors incrementing consistently over time. The AP-P error applies to cases where the pool has paired pooling causing the same external address to be used for all sessions originating from the same internal host. The error indicates that there are no free ports or blocks available. However, there should be plenty of ports available given the number of active users. So, why would the counter still be incrementing? The system in this case is configured for Port Block Allocation using a block size of 200 ports and up to 8 blocks allocated to each user:
pool nat44-pool1 { address 13.13.0.0/21; port { automatic; secured-port-block-allocation block-size 200 max-blocks-per-address 8 active-block-timeout 0; } address-allocation round-robin; mapping-timeout 120; }
rule r1 { match-direction input; term t1 { from { source-address { 3.0.0.0/8; } } then { translated { source-pool nat44-pool1; translation-type { napt-44; } address-pooling paired; } syslog; } } }
lab> show services nat pool detail Interface: sp-0/0/0, Service set: nat44 NAT pool: nat44-pool1, Translation type: dynamic Address range: 13.13.0.1-13.13.7.254 Port range: 512-65535, Ports in use: 1699, Out of port errors: 0, Max ports used: 1699 AP-P out of port errors: 192 Max number of port blocks used: 107, Current number of port blocks in use: 107, Port block allocation errors: 0, Port block memory allocation errors: 0 Port blocks limit exceeded errors: 1 Unique pool users: 100 lab> show services nat pool detail Interface: sp-0/0/0, Service set: nat44 NAT pool: nat44-pool1, Translation type: dynamic Address range: 13.13.0.1-13.13.7.254 Port range: 512-65535, Ports in use: 1699, Out of port errors: 0, Max ports used: 1699 AP-P out of port errors: 240 Max number of port blocks used: 107, Current number of port blocks in use: 107, Port block allocation errors: 0, Port block memory allocation errors: 0 Port blocks limit exceeded errors: 1 Unique pool users: 100
The counter is incrementing in this instance because a single user has exceeded the number of ports that it is allowed. The configuration is set for 8 blocks of 200 addresses. One of the 100 unique pool users is going over that limit:
lab> show services nat mappings detail | match 1600 Ports In Use : 1600 lab> show services nat mappings detail Interface: sp-0/0/0, Service set: nat44 NAT pool: nat44-pool1 Mapping : 3.0.0.16 --> 13.13.0.104 Ports In Use : 1 Session Count : 1 Mapping State : Active ... Mapping : 3.0.0.3 --> 13.13.0.201 Ports In Use : 1600 Session Count : 1 Mapping State : Active
lab> show services nat pool detail Interface: sp-0/0/0, Service set: nat44 NAT pool: nat44-pool1, Translation type: dynamic Address range: 13.13.0.1-13.13.7.254 Port range: 512-65535, Ports in use: 1699, Out of port errors: 0, Max ports used: 1699 AP-P out of port errors: 336 Max number of port blocks used: 107, Current number of port blocks in use: 107, Port block allocation errors: 0, Port block memory allocation errors: 0 Port blocks limit exceeded errors: 1 Unique pool users: 100 lab> show services nat pool detail Interface: sp-0/0/0, Service set: nat44 NAT pool: nat44-pool1, Translation type: dynamic Address range: 13.13.0.1-13.13.7.254 Port range: 512-65535, Ports in use: 1699, Out of port errors: 0, Max ports used: 1699 AP-P out of port errors: 408 Max number of port blocks used: 107, Current number of port blocks in use: 107, Port block allocation errors: 0, Port block memory allocation errors: 0 Port blocks limit exceeded errors: 1 Unique pool users: 100
lab> show services nat pool detail Interface: sp-0/0/0, Service set: nat44 NAT pool: nat44-pool1, Translation type: dynamic Address range: 13.13.0.1-13.13.7.254 Port range: 512-65535, Ports in use: 100, Out of port errors: 0, Max ports used: 1699 AP-P out of port errors: 408 Max number of port blocks used: 107, Current number of port blocks in use: 100, Port block allocation errors: 0, Port block memory allocation errors: 0 Port blocks limit exceeded errors: 1 Unique pool users: 100
lab> show services nat pool detail Interface: sp-0/0/0, Service set: nat44 NAT pool: nat44-pool1, Translation type: dynamic Address range: 13.13.0.1-13.13.7.254 Port range: 512-65535, Ports in use: 99, Out of port errors: 0, Max ports used: 1699 AP-P out of port errors: 408 Max number of port blocks used: 107, Current number of port blocks in use: 99, Port block allocation errors: 0, Port block memory allocation errors: 0 Port blocks limit exceeded errors: 1 Unique pool users: 99
lab> show services nat pool detail Interface: sp-0/0/0, Service set: nat44 NAT pool: nat44-pool1, Translation type: dynamic Address range: 13.13.0.1-13.13.7.254 Port range: 512-65535, Ports in use: 1699, Out of port errors: 0, Max ports used: 1699 AP-P out of port errors: 458 Max number of port blocks used: 107, Current number of port blocks in use: 107, Port block allocation errors: 0, Port block memory allocation errors: 0 Port blocks limit exceeded errors: 2 Unique pool users: 100 lab> show services nat pool detail Interface: sp-0/0/0, Service set: nat44 NAT pool: nat44-pool1, Translation type: dynamic Address range: 13.13.0.1-13.13.7.254 Port range: 512-65535, Ports in use: 1699, Out of port errors: 0, Max ports used: 1699 AP-P out of port errors: 483 Max number of port blocks used: 107, Current number of port blocks in use: 107, Port block allocation errors: 0, Port block memory allocation errors: 0 Port blocks limit exceeded errors: 2 Unique pool users: 100