Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When a client connects to something on the internet, does it always connect from an ephemeral port?

Are all the well-known ports only used by servers?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Ports below 1024 are reserved only for use by root / the administrator. This is a standard security feature which stops a normal user masquerading as a system service / daemon. The majority of well-known services run on ports < 1024.

As a result all user connections have to come from a port > 1024.

Unless it is a specific requirement of the software (such as a some UDP peer-to-peer scenarios) it really doesn't matter what port number the connection originates from as the remote end is told about the connection's origins as soon as the connection request arrives.

So in summary: Usually and If it's below 1024.

share|improve this answer
    
The restriction is Unix-only; Windows doesn't have it, being primarily a home user OS. –  grawity Mar 6 '11 at 15:06
    
... yet another area where Windows' security fails miserably ... –  Majenko Mar 6 '11 at 15:15
    
When Windows got TCP/IP support, there was no point in restricting local ports because 1) there were no local user accounts; 2) the user already had physical access and could do anything. On the other hand, Unix started as a mainframe OS. It's not until Windows NT that the "admin/mortal" distinction was added. (Admittedly, they could have added the port restriction to Windows by now.) –  grawity Mar 6 '11 at 15:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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