Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a computer with windows 7 under a firewall which can only initiate connections to other computers. It has a proxy server on it (port 9000) and I want to forward it to another machine (192.168.1.1) using netcat.

Suggestions/ideas as to how to do it? My plan was to use something like

1) On the remote machine: nc -l -p 80 -e 'nc -l -p 9000'

2) On the firewalled computer: nc 127.0.0.1 9000 -e 'nc 192.168.1.1 80'

The problem is: it doesnt work. I would love to use putty's ssh2 port forwarding, but it is completely broken and the bug is there since 2003. I doubt it will ever be fixed.

share|improve this question
    
1  
which bug? For me, it uses to work... –  glglgl Nov 18 '11 at 8:04
    
This bug: askldjd.wordpress.com/2010/07/07/… –  user59067 Nov 18 '11 at 23:01

1 Answer 1

TCP tunnel (port forwarding) using Netcat

Here is how to establish a tunnel using netcat to a given host and port.

netcat -L 127.0.0.1:22 -p 8080 -vvv

Listen on port 8080 of the server, and when somebody tries to connect, establish a link with 127.0.0.1:22 (i.e.: SSH server).

netcat -L google.fr:80 -p 25000 -vvv

Listen on port 25000 of the server, and when somebody tries to connect, connect him to Google web server.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.