Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Mar 2008 09:32:56 -0600
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Siraj Shaikh <siraj.shaikh@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Manually opening TCP ports
Message-ID:  <20080307153256.GA69157@dan.emsphone.com>
In-Reply-To: <3b2ddd940803062347w3fefeb72w519ac28ca73f24d7@mail.gmail.com>
References:  <3b2ddd940803062347w3fefeb72w519ac28ca73f24d7@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Mar 07), Siraj Shaikh said:
> I am just wondering if there is a utility (or any feature in FreeBSD)
> that allows me to manually open a TCP port on a machine. I am looking
> for a way that could either allow me to open ALL or many TCP ports on
> a machine.
> 
> Also, is there any way of running a service on more than a single
> port, or on all or many ports?

If you are concerned about managing 65000 listening sockets ports in a
single process, you can write a single ipfw rule to collapse many
incoming ports into a single one, so you only have to open one
listening socket in your program:

ipfw add 1300 fwd 127.0.0.1,7000 tcp from any to me dst-port 7000-8000

The correct answer to your question really depends on why you need to
open so many ports in the first place.

-- 
	Dan Nelson
	dnelson@allantgroup.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080307153256.GA69157>