[TriLUG] need help in port forwarding

Jon Carnes jonc at nc.rr.com
Thu Jan 15 11:58:39 EST 2004


On Thu, 2004-01-15 at 11:17, Magnus Hedemark wrote:
> On 15 Jan 2004, Jon Carnes wrote:
> 
> > > ssh -l payal -L 1080:127.0.0.1:3128 <ip>
> > 
> > Why are you using ssh to do local port forwarding (127.0.0.1) - or was
> > that just an example?
> 
> That's not local port forwarding;  that's forwaring port 3128 of "<ip>" to 
> localhost port 1080.  The 127.0.0.1 in there is not from the context of 
> the ssh client but from the ssh server specified at the end of the command 
> line.
> 
> In other words, the machine he's ssh'ing to is the same machine that also 
> listens on port 3128 that he would like to forward to his own localhost's 
> port 1080.

Hmmm, here are the man page entries for ssh:
-L port:host:hostport
    Specifies that the given port on the local (client) host is to be
    forwarded to the given host and port on the remote side.  This
    works by allocating a socket to listen to port on the local side,
    and whenever a connection is made to this port, the connection is
    forwarded over the secure channel, and a connection is made to
    host port hostport from the remote machine.  Port forwardings can
    also be specified in the configuration file.  Only root can for-
    ward privileged ports.  IPv6 addresses can be specified with an
    alternative syntax: port/host/hostport


BTW: I've done this for a couple of clients, and it works a charm.

Note that only root can port forward ports below 1024.

Jon Carnes




More information about the TriLUG mailing list