Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

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: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.)

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

 
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.