Results 1 to 5 of 5
I’m having trouble making a server connection with netcat. I first connect to Server A through Putty, then try to forward the connection to Server B with “nc serverb 22”. ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 06-22-2011 #1Just Joined!
- Join Date
- Jun 2011
- Posts
- 2
Netcat connection not working
I’m having trouble making a server connection with netcat. I first connect to Server A through Putty, then try to forward the connection to Server B with “nc serverb 22”. With the verbose flag turned on, I get a message saying the connection was successful, then the SSH version installed on Server B, then the process hangs for several minutes. Finally, it quits out back to Server A’s command prompt.
I’ve tried running netcat with the verbose and debug flags on and I’ve tried connecting to and from three different servers. I get exactly the same result every time. Syslogs don’t seem to have any information at all about the connection attempts. Does netcat itself keep logs that I can check? Has anyone seen this problem before?
- 08-23-2011 #2
Let me get this straight, you're trying to connect to Server B from your client using Server A as a "tunnel" for want of a better way of explaining it?
If so, why not use SSH's port forwarding feature.
e.g.
This will map your "localhost:2022" port to Server B's 22 port, therefore, runningCode:ssh -L 2022:ServerB'sIP:22 ServerA
, will connect to serverBCode:ssh localhost -p 2022
"I am not an alcoholic, alcoholics go to meetings"
Registered Linux user = #372327
- 10-18-2011 #3Just Joined!
- Join Date
- Jun 2011
- Posts
- 2
There are two problems with doing it that way.
1) I ultimately want to be able to tunnel through more than one server before reaching the endpoint. I don't know of a way to do that with port forwarding.
2) I want a fully encrypted tunnel- using port forwarding, data is decrypted and re-encrypted at each server in the chain (or so I've been told).
In theory, Netcat sounds perfect for my purposes. If only I could actually get it to work!
- 10-18-2011 #4Trusted Penguin
- Join Date
- May 2011
- Posts
- 3,694
Have you checked out iptables? You can forward all inbound TCP traffic on some port (e.g. 22) on server A to the ip address/port of server B (and it can do the same to server C, etc.).
- 10-18-2011 #5
If my memory serves me correctly, netcat won't support encrypted connections. They added all the features of netcat into openssh. But I digress. I believe you can find what you are trying to do here: 25 Best SSH Commands / Tricks
linux user # 503963


Reply With Quote

