0

When I was reading about web servers, I came to know that though servers listen to static port (say port 80 for http), immediately after the connection, they assign a different port and thread to process. This helps in scalability; otherwise the server cannot listen to the static port until the processing of the previous request is finished.

Now my question is that if you have a stateless firewall at the client side (I know it is not a common scenario), how can we configure this? We can allow outbound and inbound to/from the destination server at port 80. But since the target port is randomly assigned, we cannot be sure of the inbound port number. Since the firewall is stateless, it doesn't have any previous knowledge of outbound connection initiation. How do we configure this then? Thanks in advance.

1

You have a misunderstanding of the communication. The server is not assigning the high port (it’s not actually random), the client is the one doing the high port selection which in turn establishes the firewall permissions for that high port.

Nor does the server assign a new port to get off of 80 (or whatever). It continues listening on 80.

A “connection” is a quad of:

    Server IP
    Server Port (80)
    Client IP
    Client High-Port  (Dynamic)

The server listens on 80 and talks on the client defined High Port, the Client does the reverse.

There’s a whole bunch of handlers and threads involved for efficiency, but this is the essence.

  • Thank you. I knew that client side is having the random port, but I thought that at server side also this happens once connection is established. Now I understand - the server side port remains the same. Thank you. – SRaj Sep 11 at 19:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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