0

If I try:

telnet localhost 143

I can get access to imap

If I try

telnet server.name 143

I get

telnet: Unable to connect to remote host: Connection timed out

See output of my netstat.

netstat --numeric-ports -l | grep 143

tcp        0      0 0.0.0.0:143             0.0.0.0:*               LISTEN     
tcp6       0      0 :::143                  :::*                    LISTEN   

What does the above output mean?

Am at my wits end cannot get imap to work remotely, works perfectly with webmail on the server.

I'm accessing the server from laptop terminal remotely, and locally for localhost connection

Ben
  • 51,770
  • 36
  • 127
  • 149
Grant
  • 2,413
  • 2
  • 30
  • 41

1 Answers1

1

The output you quote:

tcp        0      0 0.0.0.0:143             0.0.0.0:*               LISTEN     
tcp6       0      0 :::143                  :::*                    LISTEN

means that you have a program (presumably your imap server) listening on port 143 via tcp (on both IPv4 and IPv6). And the "0.0.0.0" part means it should accept connections from any source. (If it said "127.0.0.1:143" for the local address, it would mean that only local connections would be accepted.)

So, since it looks like you have the serer listening correctly, I'd first check that server.name actually resolves to the correct IP address. Can you contact any other services on that server to make sure that part works?

Assuming that that works, then the next thing I'd check would be your firewall. You might look at http://www.cyberciti.biz/faq/howto-display-linux-iptables-loaded-rules/ but you could probably start by just running:

sudo iptables -L -v

On my machine which has no firewall rules I get this:

$ sudo iptables -L -v
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

If you get something much different, the I'd take a closer look to see if that's blocking your traffic.

cds
  • 95
  • 6
  • Yes I can access telnet server.name 25 no problem – Grant Aug 05 '12 at 14:42
  • My Firewall is not run on that machine but on my ISP's gateway, I don't use IP tables on this server or UFW because of this, he {ISP} says that the ports are all open. Not sure what that means though, he could mean port 25 etc are open but might not include 143 – Grant Aug 05 '12 at 14:45
  • I get same problem when trying to authenticate via smtp the connection times out, I can send email out through smtp if I don't set authenticate in the mail client, weird. – Grant Aug 05 '12 at 14:50
  • You might try using tcpdump (or wireshark or whatever) to see if you see the packets from the client showing up at the server. If you see traffic to some ports show up but traffic to others doesn't then you have reason be believe that they're being filtered by a firewall somewhere or that something else is interfering. – cds Aug 05 '12 at 15:56
  • If you see the packets to port 143 are arriving intact, then I'd look at the log files for the server. Though that seems unlikely since most likely cause of the connection timing out is the packets being dropped somewhere en route from client to server. – cds Aug 05 '12 at 16:00
  • I tried tcpdump port 143 -v and see no traffic while I try and connect via telnet server.name 143 – Grant Aug 05 '12 at 16:23
  • If you "telnet server.name 25" do you see *those* packets arrive? – cds Aug 05 '12 at 16:30
  • Yes, I ran telnet server.name 25 and then tcpdump -v port 25 and those packets show up. – Grant Aug 05 '12 at 16:34
  • So, it sounds like there's a firewall or other interfering networking device. It sounded like you were traversing your ISP's network (ie. it's not two local machines) so I'd talk to the ISP again. You also might try connecting to the 143 port from a machine local to the server to confirm that that works. – cds Aug 05 '12 at 16:43
  • Yes it works, I can telnet from my other server on the same network, thank you so much, I would never have thought of doing that. I will get the ISP to open those ports in their firewall must be what the problem is. – Grant Aug 05 '12 at 16:51