When an outgoing SecureNAT connection is made through a TMG server and NAT is applied, TMG has to determine the outgoing source port that will be used for the NAT connection. TMG maintains a pool of source ports to use for outgoing NAT connections. When a connection is closed, the outgoing source port is freed back to the pool and is immediately available for a later outgoing connection.
Consider the following scenario:
- An outgoing source port is used shortly after the previous connection through that source port is closed.
- The outgoing source port is used to make a new outgoing connection to the same external server.
- The previous connection on the external server is in the TIME_WAIT state.
In this scenario, this connection attempt may fail.
The TIME_WAIT state is part of the
TCP RFC 793 specification and is used to protect connections from being corrupted by data packets that may still be outstanding from a previous connection. As per RFC 793, when a connection is gracefully closed, it should be held in a TIME_WAIT state for four minutes, about two times the maximum segment lifetime.
The outgoing SecureNAT connection will fail when the following conditions are true:
- TMG uses the same source port for an outgoing connection to the external server within four minutes of a previous connection.
- The external server has the previous connection from the same source port in a TIME_WAIT state.
When these conditions are true, the external server will not accept the new connection attempt. This causes the outgoing SecureNAT connection to fail.
This issue is encountered only when there are high levels of outgoing SecureNAT client traffic and when most of the outgoing SecureNAT client traffic is directed to the same external server.