Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am trying to telnet from Ubuntu server (running Maverick) on ec2 to another machine I have set up not on ec2 - we'll call it "server-x". Server-x is running an imap server and I am trying to test connectivity to it.

The two machines are connected via vpn. I can ping from the ec2 machine to server-x no problem. On another machine also on the vpn but also not on ec2 I can telnet to server-x without issue so it is accepting incoming connections on that port.

But when I run telnet from the ubuntu instance to server-x I get :

ubuntu@ip-10-111-11-11:~$ telnet 5.1.1.1 9143
Trying 5.1.1.1...
telnet: Unable to connect to remote host: Connection refused

Other telnets work like this:

ubuntu@ip-10-111-11-11:~$ telnet imap.gmail.com 993
Trying 173.194.76.108...
Connected to gmail-imap.l.google.com.
Escape character is '^]'.

I have disabled ufw on the ubuntu machine. Is there anything else that can be blocking this outgoing connection? I tried adding the outgoing port to iptables but I'm not certain I'm doing that right.

Update: The service running on server-x is an imap server. When I changed it to use the traditional imap port 143 - the ubuntu machine can now telnet without problem. Why can it not telnet out on 9143?

I'm pretty sure 9143 is open and listening on server-x, when I run netstat:

netstat -an |grep 9143    
tcp46      0      0  *.9143                 *.*                    LISTEN
tcp4       0      0  *.9143                 *.*                    LISTEN
share|improve this question
add comment

1 Answer

Connection refused, apart from the port being blocked, may also mean that nothing is listening on that port (or that IP/interface).

Please run the following on the machine you are trying to telnet to:

netstat --numeric-ports -l | grep 9143

And paste the output as a comment, or edit it into your question. If you get no output, then there's a problem with whatever program is supposed to be listening on port 9143.

share|improve this answer
    
I've now changed the port the remote service is listening on and now it works. See my update. –  brendan Jul 8 '12 at 14:06
    
Was it listening on 9143 as shown by netstat? Anyway, glad it got solved :) –  izx Jul 8 '12 at 14:08
    
yeah it was, the remote machine is not linux, so I had to tweak my netstat but results the same –  brendan Jul 8 '12 at 14:20
add comment

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.