Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 =

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 [] 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/ 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?

share|improve this question
up vote 3 down vote accepted

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

Spot the difference? Try this:

ssh -L 6669: hostB

Your IRC daemon listens to 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 (from hostb), does it? (Thus your command tries to connect to hostb:6669 where no daemon listens.)

share|improve this answer
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 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.