From owner-freebsd-net Tue Oct 22 8: 5:27 2002 Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 939F437B401 for ; Tue, 22 Oct 2002 08:05:26 -0700 (PDT) Received: from tigger.pacehouse.com (adsl-63-201-229-115.dsl.snfc21.pacbell.net [63.201.229.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id CCA6743E3B for ; Tue, 22 Oct 2002 08:05:25 -0700 (PDT) (envelope-from jepace@pobox.com) Received: from tigger.pacehouse.com (localhost [127.0.0.1]) by tigger.pacehouse.com (8.12.6/8.12.5) with ESMTP id g9MF5KT2013283; Tue, 22 Oct 2002 08:05:20 -0700 (PDT) (envelope-from jepace@pobox.com) Received: from localhost (jepace@localhost) by tigger.pacehouse.com (8.12.6/8.12.6/Submit) with ESMTP id g9MF5K6x013280; Tue, 22 Oct 2002 08:05:20 -0700 (PDT) X-Authentication-Warning: tigger.pacehouse.com: jepace owned process doing -bs Date: Tue, 22 Oct 2002 08:05:20 -0700 (PDT) From: James Pace X-X-Sender: jepace@tigger.pacehouse.com Reply-To: James Pace To: "Marc G. Fournier" Cc: freebsd-net@FreeBSD.ORG Subject: Re: dest vs source ports ... In-Reply-To: <20021022113147.X47756-100000@hub.org> Message-ID: <20021022075511.A85197-100000@tigger.pacehouse.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org 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 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message