1

It is my understanding that technically there is no limitation on using port 0 in a TCP/IP packet, it is normally simply reserved to mean an ephemeral port. I tested this by writing a simple C-app that binded to port 0 and in fact netstat revealed that it had binded to an ephemeral port, 50252.

If I wrote an application, and explicitly made any (perhaps) necessary modifications to my networking library, operating system, and anything else that is physically under my control not to interpret port 0 (zero) as literally port zero and nothing special, would it be routed over the public internet? Or even perhaps reliably routed over the public internet?

1
  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can provide your own answer and accept it.
    – Ron Maupin
    Commented Aug 7, 2017 at 15:21

3 Answers 3

3

A port is a layer-4 address for some layer-4 protocols (you don't specify which layer-4 protocol). Routing is done with layer-3 addresses. Routing looks at the layer-3 packet, not the layer-4 segment. This is because layer-3 protocols can encapsulate any of a number of layer-4 protocols, some of which don't even use ports.

1

Using port 0 for an ephemeral port is simply an API convention (ie. something between the application and the OS's IP stack).

Technically, there is no reason why it can't work but practically, because it isn't used anywhere and potentially might trigger implementation weaknesses it's not unlikely to get filtered.

In order to actually create a socket on port 0 it might be necessary to generate "raw" IP packets and write your own TCP handler.

-1

Comcast blocks port 0 and we do deep packet inspection to an extent.

1
  • 1
    Do you have anything to back up these claims? Links or references perhaps?
    – YLearn
    Commented Dec 7, 2015 at 3:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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