How to resolve a Windows or Linux system that runs out of the tcp/udp ports on a single server? I have over around 65000 tcp/udp ports being used on a single server as a result of SQL connections, user connections for users to connect to the internet, and acting also as a gateway.

  • 4
    Is this a SQL server or client? Server processes generally only use 1 port, the well-known port assigned to that service. – Barmar Feb 23 '16 at 1:05

I recommend to plan separation of roles (unless the gateway requires the SQL to be on the same host) - not due the fact that you're running out of ports. If the SQL is not required by the gateway and/or it's holding company data, it's quite risky to be on a gateway node.

Speaking of TCP, there are plenty of available ports. You may (while ignoring things like port sharing) only bind 216 ports per address, you may have far more active connections per address.

You can handle thousands of connections with even a single TCP port - the connection is defined due multiple parameters:


See more here.

An important parameter may be half-open connections - if one of your services has some trouble, it may affect other services running on the system. You may get some more information here.


Sounds like a heavy load server in an important role.

  • You can use more than one Ethernet interface - that would gain also physical expansion.

  • You can use more than one IP address on any interface - easy software solution.

I would also suggest to use a proxy / NAT eventually


Split the server role to other server if the load is too big.

In example, in windows if you virtualize a Windows Server Standard license you can got two running instance free in virtual (1:2)

Other idea to give more physical's interface or virtual IP could help in the short term, but having such role (SQL, Gateway and user connection to the internet) is not a good idea.

In example, if a user get a malware and flood your gateway it will put down other service on the server.


There are only 65,535 available ports available in TCP/UDP. It's a restriction that is an inherent part of IP (the protocol).

You might be able to work around the limit by assigning more than one IP address to the machine that is opening all these connections.

  • The number of ports in TCP or UDP have nothing to do with IP, since IP can carry a variety of layer-4 protocols besides TCP and UDP, and not all of them even use ports. The layer-4 address (port) is part of both the TCP standard and the UDP standard, but it not part of the IP standard. – Ron Maupin Feb 24 '16 at 5:32

Not the answer you're looking for? Browse other questions tagged or ask your own question.