Networking: NAT gateway ErrorPortAllocation / SNAT port exhaustion — intermittent outbound connection timeouts
Many instances share few public IPs, and the NAT gateway runs out of source ports for outbound connections.
SNAT port exhaustionNAT gateway port allocation errorSNAT ports exhaustedoutbound connections intermittently time out NAT gateway Meaning
Each outbound connection to the same destination IP:port uses one SNAT port, so busy services hit the limit and new connections time out. Reuse connections, add public IPs (AWS: more EIPs; Azure: more frontend IPs), reduce idle timeouts, or use private endpoints for cloud services.
Common causes
- Many connections to the same destination
- No connection reuse in the app
- Too few public IPs on the NAT gateway
- Long idle timeout holding ports
- Calls to cloud APIs through NAT instead of private endpoints
⚡ Quick fix
- Check the gateway metric (
ErrorPortAllocation) - Add public IPs/frontends
- Use connection pooling and private endpoints
Detailed fix by platform
Shell
aws cloudwatch get-metric-statistics --namespace AWS/NATGateway --metric-name ErrorPortAllocation --dimensions Name=NatGatewayId,Value=nat-0abc --start-time 2026-10-29T00:00:00Z --end-time 2026-10-29T06:00:00Z --period 300 --statistics Sum
How to diagnose
- ErrorPortAllocation — Non-zero?
- Public IPs — Enough?
- Connections — Reused?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- bind() failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
- Cannot assign requested address (EADDRNOTAVAIL) Networking: connect: Cannot assign requested address — ephemeral port range exhausted by TIME_WAIT connections
- Idle connections silently dropped by firewall/NAT Networking: Connection works, then fails after being idle — firewall/NAT idle timeout dropped the TCP session (use keepalive)
Most viewed in Networking
- Native VLAN mismatch / wrong VLAN, no connectivity Networking: %CDP-4-NATIVE_VLAN_MISMATCH / device on the wrong VLAN can't reach the gateway
- Port err-disabled (psecure-violation) Networking: %PM-4-ERR_DISABLE: psecure-violation error detected on Gi0/5, putting Gi0/5 in err-disable state
- Rogue DHCP server hands out wrong gateway/DNS Networking: Clients receive the wrong default gateway or DNS server — a rogue DHCP server (often a home router) answers first
Other ways to find it
Where this error sits
Origin: Network. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 5 Nov 2026