Question about ports
Bl8ckr0uter
Inactive Imported Users Posts: 5,031 ■■■■■■■■□□
in CCNA & CCENT
Greetings:
I have a quick question about ports. I know that 0-1023 are commonly known ports and I know that the host will make up ports to identify what program the data stream is from. I just have a few questions about the process (please be as blunt as possible as I am trying to learn):
Is there a process or procedure in which the host will choose the port?
For an example if 1 web server has many host hitting it using port 80, what is the process in which it will choose the next port? Does it just start counting from 1024 and continue forward?
I know that you can redirect common ports to high level lesser known ports. In the case above if the webserver redirected all port 80 traffic to port 1024 and another port 80 connection was made, would it begin counting from there?
If someone could point in the right direction i would be pleased.
I have a quick question about ports. I know that 0-1023 are commonly known ports and I know that the host will make up ports to identify what program the data stream is from. I just have a few questions about the process (please be as blunt as possible as I am trying to learn):
Is there a process or procedure in which the host will choose the port?
For an example if 1 web server has many host hitting it using port 80, what is the process in which it will choose the next port? Does it just start counting from 1024 and continue forward?
I know that you can redirect common ports to high level lesser known ports. In the case above if the webserver redirected all port 80 traffic to port 1024 and another port 80 connection was made, would it begin counting from there?
If someone could point in the right direction i would be pleased.
Comments
-
tiersten Member Posts: 4,505I know that 0-1023 are commonly known portsIs there a process or procedure in which the host will choose the port?
-
Bl8ckr0uter Inactive Imported Users Posts: 5,031 ■■■■■■■■□□They're called Well Known ports.
This I knew. It has been a LONG day.Depends on the OS. Read this.
This I did not. Interesting. -
Bl8ckr0uter Inactive Imported Users Posts: 5,031 ■■■■■■■■□□that was very interesting. I noticed that windows only uses a little more than 3000 ports. Kind of makes you wonder why did they choose such a small port range and what happens to all of those wasted ports on a windows box.
-
gravyjoe Member Posts: 260that was very interesting. I noticed that windows only uses a little more than 3000 ports. Kind of makes you wonder why did they choose such a small port range and what happens to all of those wasted ports on a windows box.
That is strange. I didn't know that. I always knew about the high dynamic ports, but I didn't know that Windows only used a few thousand ports for outbound connections (not only that, but that they're not in the high, dynamic port range).
Normally, ports between 1024 - 49151 are used for inbound connections for vendor specific applications, while ports above 49151 are used for outbound connections.The biggest risk in life is not taking one. -
Bl8ckr0uter Inactive Imported Users Posts: 5,031 ■■■■■■■■□□That is strange. I didn't know that. I always knew about the high dynamic ports, but I didn't know that Windows only used a few thousand ports for outbound connections (not only that, but that they're not in the high, dynamic port range).
Normally, ports between 1024 - 49151 are used for inbound connections for vendor specific applications, while ports above 49151 are used for outbound connections.
Well apparently only BSD follows the IANA's suggested port range. I thought it was odd as well. I also think that the actual port numbers are strange. I wonder if there is any thing to the fact that the amount of ports it 2 to the 16th. I wonder if it had to do with OS technology at the time.... -
UnixGeek Member Posts: 151Well apparently only BSD follows the IANA's suggested port range. I thought it was odd as well. I also think that the actual port numbers are strange. I wonder if there is any thing to the fact that the amount of ports it 2 to the 16th. I wonder if it had to do with OS technology at the time....
You're thinking along the right lines. Both TCP and UDP headers include 16-bit source and destination port numbers, so that's where the upper limit comes in. -
tech-airman Member Posts: 953Greetings:
I have a quick question about ports. I know that 0-1023 are commonly known ports and I know that the host will make up ports to identify what program the data stream is from. I just have a few questions about the process (please be as blunt as possible as I am trying to learn):
Is there a process or procedure in which the host will choose the port?
For an example if 1 web server has many host hitting it using port 80, what is the process in which it will choose the next port? Does it just start counting from 1024 and continue forward?
I know that you can redirect common ports to high level lesser known ports. In the case above if the webserver redirected all port 80 traffic to port 1024 and another port 80 connection was made, would it begin counting from there?
If someone could point in the right direction i would be pleased.
knwminus,
In order to help understand port numbers, it helps to understand how TCP or UDP works with those port numbers. Imagine a simple system of client and web server. So when the client requests a webpage, the TCP segment would carry a destination port of 80 but a source port of some random number. Then that TCP segment is sent towards the web server.
The web server receives the TCP segment with a destination port of 80 and some random number for a source port, let's say 8000. So just like receiving an envelope in the mail, in order for the recipient of the mail to send a letter back to sender is to change the destination address from the recipient to the sender's address and change the sender's address from the sender's address to the recipient's address. Similarly, the same thing happens with the web server's reply to the client. The web server's reply back to the client is sent by another TCP segment, with destination port of 8000 and source port of 80.
Eventually, the client receives the TCP segment and since it recognizes the destination port of 8000 which originally referred to the outbound web request's source port, the operating system forwards that traffic to the web browser application.
Did this quick explanation help you understand port numbers better? -
cerberos Member Posts: 168The point is that Microsoft is violating the Standard with reason and without. IANA stated that for outbound connection u should go after port 49151 and above but still there is no obligation or restriction on this rule, I don't know what's the real reason for Microsoft breaking this rule.
-
Bl8ckr0uter Inactive Imported Users Posts: 5,031 ■■■■■■■■□□tech-airman wrote: »knwminus,
In order to help understand port numbers, it helps to understand how TCP or UDP works with those port numbers. Imagine a simple system of client and web server. So when the client requests a webpage, the TCP segment would carry a destination port of 80 but a source port of some random number. Then that TCP segment is sent towards the web server.
The web server receives the TCP segment with a destination port of 80 and some random number for a source port, let's say 8000. So just like receiving an envelope in the mail, in order for the recipient of the mail to send a letter back to sender is to change the destination address from the recipient to the sender's address and change the sender's address from the sender's address to the recipient's address. Similarly, the same thing happens with the web server's reply to the client. The web server's reply back to the client is sent by another TCP segment, with destination port of 8000 and source port of 80.
Eventually, the client receives the TCP segment and since it recognizes the destination port of 8000 which originally referred to the outbound web request's source port, the operating system forwards that traffic to the web browser application.
Did this quick explanation help you understand port numbers better?
Yes and no. I understand ports and all it is just the numbers. The wiki article answered some questions but caused some more. But i'll manage.