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'm trying to forward a local port to a remote telnet host. Something like this.

MyHost -----> |2222 Proxy |------> |23 Destination |

  • MyHost: I'm on a Windows PC.
  • Proxy: Is a linux box which I control.
  • Destination: Is a custom device which only accepts connections via telnet.

My ultimate goal is to telnet to Destination from MyHost through Proxy. I've read several guides but can't seem to get the right command to run on Proxy to have this work.

Also, if it's not possible to do this via ssh forwarding, would netcat cut it? Lack of encryption is not a problem.

share|improve this question

1 Answer 1

If the proxy is running iptables, it is as simple as

iptables -t nat -A PREROUTING -d proxy.ip.add.ress -p tcp --dport 2222 -j DNAT --to-destination des.tina.tion.IP:23

share|improve this answer
    
Wouldn't I have to also allow the other way around? –  cookM Jul 13 '12 at 10:37
    
Yes, you would need to allow ESTABLISHED traffic back in. –  adaptr Jul 13 '12 at 11:50
    
Nevermind, I ended up using: netcat -L destination:23 -p 8888 on proxy. Thanks a lot for your help though. –  cookM Jul 13 '12 at 12:10
    
good luck when that dies. –  adaptr Jul 13 '12 at 12:16
    
What do you mean, will it leave a mess behind? –  cookM Jul 14 '12 at 9:41

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.