I have created a SSH Tunnel to my memcached server as follows:

 ssh -f -N [email protected] -L 11211:

When i do netstat on my machine i get the following: So far looks good.

tcp        0      0*    LISTEN      976/ssh

The issue shows up when I telnet to the server as follows:

telnet 11211
Connected to
Escape character is '^]'.
channel 2: open failed: connect failed: Connection refused
Connection closed by foreign host.

So I went to the memcached server and tailed the auth.log file and found this message overytime i try to telnet to the server:

Apr  4 13:56:06 vmcachd sshd[1410]: error: connect_to port 11211: failed.

Does anyone know what is the issue, I have a similar setup with postgresql and it works perfectly fine! Any help is appreciated.

Thank You

  • Are you sure memcached is running on the server? Apr 4, 2016 at 18:46
  • Hi Tero, yes it is running I have included the output of netstat -tulpn tcp 0 0* LISTEN 1031/memcached Apr 4, 2016 at 20:41

2 Answers 2


do a:

 ssh -f -N [email protected] netstat -putan 

should show you something LISTENing in (or check the column "Local Address"

if you see something else (like listening in another interface) there are 2 options:

  1. you change the tunnel to listen to that interface i.e.: ssh -f -N [email protected] -L 11211:
  2. make memcache listen to i.e.: you start the service with memcached -l (or it's corresponding /etc/default/memcached in ubuntu/debian)
  • Hello, I run that command but it does not return anything. I also run this command on my another server where I do ssh tunnel to Postgresql and it also comes back with nothing. That postgresql ssh tunnel that i have set up works perfectly. Apr 4, 2016 at 20:43
  • postgress listens in by default. Memcache doesn't (it chooses an specific address, which I guess in your case is can you paste the output of ssh -f -N [email protected] netstat -putan ?
    – nicocesar
    Apr 6, 2016 at 0:49

I appreciate your help, I have solved the issue by reinstalling the latest Centos 7 operating system with the latest memcache server, everything works perfectly now. Before my memcache server was running on an older version of Debian 6.0.6/squeeze, not sure if that had anything to do with it, but surely the reinstall of the latest os solved my issue.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .