Date: Tue, 22 Oct 2002 08:05:20 -0700 (PDT) From: James Pace <jepace@pobox.com> To: "Marc G. Fournier" <scrappy@hub.org> Cc: freebsd-net@FreeBSD.ORG Subject: Re: dest vs source ports ... Message-ID: <20021022075511.A85197-100000@tigger.pacehouse.com> In-Reply-To: <20021022113147.X47756-100000@hub.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 22 Oct 2002, Marc G. Fournier wrote: > Just a quick question ... how does the OS determine the 'source port' when > connecting to a remote site? The OS picks one from a pool of ports, unless told to use one explicitly. These are called ephemeral ports. > is it reasonably safe to assume that the lower of the two ports is > the dest port? This seems dubious, at best. It is easy to exactly determine what the ports involved are, rather than coming up with a heuristic. Check out 'netstat -a' or 'lsof'. > for instance, if I try to telnet to a remote site where the remote > site is running a service on port 6667, is it a pretty safe bet that > FreeBSD will pick a port >6667 to go out on? or is there an equal > chance of it being lower? In general, it will be greater than 6667 (32000+), but not guaranteed. If the applications chooses to bind(2) to a port, it could be almost anything. I think this question is better suited for freebsd-questions than freebsd-net. I would also recommend picking up a tutorial on TCP/IP. Thanks, -James -- James Pace <jepace@pobox.com> To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021022075511.A85197-100000>