Manually opening TCP ports

shaap at uhweb64208.united-hoster.com shaap at uhweb64208.united-hoster.com
Tue Mar 11 10:37:52 UTC 2008


On Sun, Mar 09, 2008 at 11:07:15AM +0000, Siraj Shaikh wrote:
> On 09/03/2008, Michael R. Head <burner at suppressingfire.org> wrote:
> > On Fri, 2008-03-07 at 08:02 +0000, Siraj Shaikh wrote:
> > > Hello
> > >
> > > I am just wondering if there is a utility (or any feature in
> > > ubuntu/Linux) 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?
> >
> > After reading the rest of the thread, it appears to me that the best
> > solution would be to forward the ports you want to listen on to your
> > application. This can be done with iptables. For example, if you want to
> > forward all ports from 1 to 1024 to your server (which might be running
> > at 31337), then you could do it thusly:
> >
> > for (( PORT=1; PORT<=1024; PORT++ )); do
> >  sudo iptables -t nat -A PREROUTING -p tcp --dport $PORT  -j DNAT --to 127.0.0.1:31337
> > done
> >
> >
> Michael
> 
> Thanks. We might actually forward all ports to a service we run. This
> would mean doing it for 65534 ports and the one port left can be used
> to run the service. So any probe received on any of the ports would be
> picked up by our service.
> 
> What is the best tool (in linux) for us to log all packets that arrive
> at a particular port? Which simply receives any packets and stores the
> entire contents in a file, or logs it on syslog or some mysql
> database.

I suggest trying tcpdump(8)

shaap

> 
> Thanks
> 
> -- 
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users




More information about the ubuntu-users mailing list