Source ports for TCP/UDP connections are chosen at random from a system’s
available high ports. I assume you were thinking that the same port would
be used on the source side as the destination, though that would not be
conducive too an environment where you wanted to go to two sites at the
same time (since you could not use port 80 to go to two sites (or more)
simultaneously. Anyway, it’s random and the way that TCP is designed.
Good luck.
ariyoshi wrote:
> Hi every one,
>
> I have a question regarding Source ports, below is one of the display
> entry of netstat -antl.
>
> My question is, how does Linux Box determine what source port(55729) to
> use when establishing a connection /Session?
>
> tcp 0 0 192.168.1.6:55729 130.57.4.15:80 ESTABLISHED
>
> I can understand the destination port(port 80), but not the source
> port.
>
> thanks,
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
Generally there is no need to constrain the source port so the client chooses it at random. There are some (root operated) services that do choose a fixed source port when connecting to other servers to indicate that they are the “authorised” service. ntpd is one, and sometimes named is fixed at port 53.
ken yap wrote:
> What ab said.
>
> Generally there is no need to constrain the source port so the client
> chooses it at random. There are some (root operated) services that do
> choose a fixed -source- port when connecting to other servers to
> indicate that they are the “authorised” service. ntpd is one, and
> sometimes named is fixed at port 53.
Of course, as with almost averything in Linux, this too can be tweaked.