0

Is there a way to overcome the port limit on a linux system? We have a server running that accepts incoming connection and it uses very little memory and cpu. It's rather silly that we have to build a cluster of small linux boxes just to overcome a software limit (number of points of around 60k). Any ideas?

6
  • 1
    Can you give any more information about the use-case here? Commented Aug 16, 2010 at 21:30
  • 3
    Have you tried using secondary IP addresses on the same interface? Commented Aug 16, 2010 at 21:33
  • @ar: that's a viable solution since the OP is already using multiple IP addresses. Post it as an answer so it can properly get voted and/or accepted. Commented Aug 16, 2010 at 21:58
  • possible duplicate of Max number of socket on Linux Commented Aug 16, 2010 at 22:13
  • It's been possible for a long time to have Linux boxes supporting well over 100,000 simultaneous inbound connections. You are hitting a configuration or resource limit - what is the actual error that makes you think you have hit a port limit? Commented Aug 17, 2010 at 0:06

3 Answers 3

12

There is no limit of 60k tcp or udp sockets, you just think there is. The actual limit is much higher. There are 64k ports, but the same port may be used for more than one connection, as only the pair of addresses/ports needs to be unique.

Having said that, if you have 60k distinct clients concurrently connected, you may a have high availability requirement which means you'll need to have several machines anyway.

Sign up to request clarification or add additional context in comments.

Comments

5

This isn't a software limit of ports, it's a networking limit.

http://en.wikipedia.org/wiki/TCP_and_UDP_port

There are only only a certain number of ports available on an IP network (65k). Your problem isn't a port limit, but perhaps how those ports are being used.

3 Comments

no we have persisted connections, we actually need that many ports.
Not uncommon. Most web servers do the same thing hence the HTTP Keep Alives. Without knowing the application here it's hard to give you any direction. Please tell us how you're using this.
Incoming connections all connect to the same port -- and any stack that can't handle two clients connecting from the same port number on different IPs is broken.
3

It's not Linux, it's TCP/IP design limitation - port number is a 16-bit unsigned integer, thus 64K limit. Assign multiple addresses - IP aliases - to an interface (or use multiple hardware interfaces), make different servers listen on different IPs. Each interface will give you a separate port range.

3 Comments

Incoming connections all connect to the same port -- and any stack that can't handle two clients connecting from the same port number on different IPs is broken.
Hmm, I'm talking about different linstening sockets on different IPs.
What i mean is, any self-respecting TCP/IP stack will keep the remote clients 10.0.0.1:1234 and 10.0.0.2:1234 separate, and will allow connections from the both of them at the same time to the same port on the server. So the 64k port limit doesn't apply, even if you use a single IP -- the local and remote socket addresses should be considered 48-bit values (32 bit address + 16 bit port).

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.