14 Sep 2007 04:32:14 UTC
- Distribution: tcpforward
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (1)
- Testers (26 / 0 / 0)
- License: unknown
- Activity24 month
- Download (2.92KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
tcpforward - forward or tunnel TCP connections
tcpforward [OPTIONS] -l|-c host1:port1 -l|-c host2:port2
-l host:port listen on host:port, forward accepted connections -c host:port connect to host:port, forward this connection -N count exit after forwarding count connections -k fork before forwarding (default: no) -s size chunk size for non-blocking reads (default: 1024) -V print version and exit -v turn on parseable logging -h display usage information
Forward local SMTP to a remote mailserver:
$ tcpforward -k -c mailserver:25 -l localhost:25
Forward tunnel the SSH service on 10.0.0.100 to 10.0.0.101:
[10.0.0.100]$ tcpforward -l 10.0.0.100:9922 -c localhost:22 [10.0.0.101]$ tcpforward -c 10.0.0.100:9922 -l localhost:22 [10.0.0.101]$ ssh localhost
Reverse tunnel the SSH service on 10.0.0.100 to 10.0.0.101:
[10.0.0.101]$ tcpforward -l 10.0.0.101:9922 -l localhost:22 [10.0.0.100]$ tcpforward -c 10.0.0.101:9922 -c localhost:22 [10.0.0.101]$ ssh localhost
tcpforward is a userspace TCP connection forwarder. It uses efficient non-blocking I/O and is protocol agnostic.
Some uses include:
Making remote services look like local ones
Offering a service on a different port number without restarting it
Allowing a non-root user to bind to a selected low port
Tunneling connections into NAT'ed networks or past firewalls
Evenly distributing a service-oriented architecture
Monitoring a service's network usage
tcpforward does not provide encryption of any sort. Forward only encrypted connections if security is an issue. Consider SSH tunneling or stunnel if you need an encrypted tunnel.
That said, part of the original motivation for tcpforward was reverse tunneling of the SSH service itself back through a NAT'ed gateway. Using ssh to establish the tunnel would have incurred the penalty of double encryption.
- -c host:port
Connect to host:port, then do forwarding on the socket.
- -l host:port
Listen for connections on host:port, then do forwarding on the accepted socket.
- -N count
Exit after forwarding count TCP connections.
Fork and perform forwarding in a child process. This permits multiple simultaneous forwarded connections. The default is non-forking.
- -s size
When forwarding, attempt non-blocking reads of size bytes at a time. Setting this to the median packet size for a given protocol may result in some small performance gain.
Print version number and exit.
Turn on parseable logging to standard out. Increase logging level with extra -v options.
Display usage information.
tcpforward should be rewritten in C. Please report other bugs on CPAN.
Alan Grow <email@example.com>
Copyright (C) 2007 by Alan Grow
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.3 or, at your option, any later version of Perl 5 you may have available.