2

This might be just a misunderstanding of how ssh tunneling works, but here goes:

In my ngirgd.conf file I have the following:

Ports = 6669
Listen = 127.0.0.1

This ngircd server is running on HostA. I've tunneled into it using the following:

wayne@HostB % ssh -N wayne@HostA -L 6669:HostA:6669

I enter my password. Then inside irssi on HostB, I do:

/connect localhost 6669

And I get

Looking up localhost
Connecting to localhost [127.0.0.1] port 6668
Connection to localhost established
Connection lost to localhost

Inside the terminal window where I launched the tunnel, I get:

channel 2: open failed: connect failed: Connection refused

From what I've understood, the ssh tunnel should be connecting HostB:6669 to HostA:6669, so as far as ngirgd is concerned, the connection came from localhost/127.0.0.1. But it appears this is not the case - when I forwarded to port 80 it connected to my server just fine.

Am I misunderstanding something, or is something wrong? And how do I fix it?

3

The ssh manpage mentions your use-case in section "TCP FORWARDING".

Spot the difference? Try this:

ssh -L 6669:127.0.0.1:6669 hostB

Your IRC daemon listens to 127.0.0.1:6669 on hostb and the host:hostport part of -L port:host:hostpart is relative to the server you connect to. So I guess hostb doesn't resolve to 127.0.0.1 (from hostb), does it? (Thus your command tries to connect to hostb:6669 where no daemon listens.)

  • It appears that the guide I was looking at was full of crap (or, misinformation). I just found the answer here, too. – Wayne Werner Sep 26 '12 at 12:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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