Server Fault is a question and answer site for system and network administrators. 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

Here is the thing, my server fails to connect to gmail SMTP with timeout error. I think the 465 port is closed on my server so I did couple of thing, now my csf.config file hase this two lines:

TCP_IN = "20,21,22,25,53,80,110,143,443,465,587,993,995,2011,2222,8080"
TCP_OUT = "20,21,22,25,53,80,110,113,443,2011,2222,8080,465"

and I searched the iptable file for 465 and there is three occurance like so:

-A INPUT -p tcp -m tcp --dport 465 --tcp-flags FIN,SYN,RST,ACK SYN -j ACCEPT
-A INPUT ! -i lo -p tcp -m state --state NEW -m tcp --dport 465 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 465 -j ACCEPT

when I run netstat -tulpn command I get this result:

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
tcp        0      0  *                   LISTEN      1938/named
tcp        0      0      *                   LISTEN      1938/named
tcp        0      0        *                   LISTEN      1552/sshd
tcp        0      0        *                   LISTEN      1681/exim
tcp        0      0       *                   LISTEN      9671/httpd
tcp        0      0       *                   LISTEN      1505/dovecot
tcp        0      0       *                   LISTEN      1505/dovecot
tcp        0      0      *                   LISTEN      1689/mysqld
tcp        0      0       *                   LISTEN      1681/exim
tcp        0      0       *                   LISTEN      1505/dovecot
tcp        0      0       *                   LISTEN      1505/dovecot
tcp        0      0        *                   LISTEN      9671/httpd
tcp        0      0 :::21                       :::*                        LISTEN      1817/proftpd
tcp        0      0 :::22                       :::*                        LISTEN      1552/sshd
tcp        0      0 :::25                       :::*                        LISTEN      1681/exim
tcp        0      0 :::587                      :::*                        LISTEN      1681/exim
tcp        0      0 :::2222                     :::*                        LISTEN      1675/directadmin
udp        0      0  *                               1938/named
udp        0      0      *                               1938/named

The server ip is : and smtps port (465) is not open yet! What should I do?

share|improve this question

closed as off-topic by 84104, Jenny D, Falcon Momot, dawud, Scott Pack Oct 10 '13 at 15:45

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must demonstrate a minimal understanding of the problem being solved. Try including attempted solutions, why they didn't work, and the expected results. See How can I ask better questions on Server Fault? for further guidance." – 84104, Jenny D, Falcon Momot, dawud, Scott Pack
If this question can be reworded to fit the rules in the help center, please edit the question.

Is your server trying to connect (send) to gmail? Or is it the other way around? Your question doesn't make sense that way it's currently written. – MDMarra Oct 9 '13 at 23:56
@MDMarra ~ I am trying to send emails through gmail SMTP. I wrote the code in PHP. but the fsockopen function gives error unable to connect to (Connection timed out) – safaali Oct 10 '13 at 0:00
Your outgoing connections have nothing to do with your incoming firewall! – Michael Hampton Oct 10 '13 at 0:57
@MichaelHampton ~ Sorry but I am newbie in this and I cant follow you! can you please add some details about what I am doing (thinking) wrong? – safaali Oct 10 '13 at 1:02
up vote 3 down vote accepted

Your firewall is not the problem here, something in your code must be (and thus, this is not the right site to ask on).

What you're doing is allowing incoming connections to your server on port 465 though your server's firewall. The problem is that when you go to connect to gmail, you're connecting to port 465 on their servers. Port 465 on your server has nothing to do with this. There is nothing in that activity that establishes an inbound connection on port 465 on your server.

You're barking up the wrong tree, opening these ports isn't going to solve your problem.

share|improve this answer
Thank you for the explanation, I've checked the code, I am pretty sure it is ok. Is there any chance that another upper level firewall is blocking the outgoing trafic on port 465? I am on a VPS, surely the main server got a firewal. Should I check with the Hosting provider (main server administrator)? – safaali Oct 10 '13 at 1:48
Sure there's a possibility, but it's not probably. I am unaware of any large hosts that filter outbound traffic. You can always ask your host, though. – MDMarra Oct 10 '13 at 1:49

As seen in the output of your "netstat -tulpn" , you have RHEL distros, Exim smtp and Apache web server so you should check /var/log/messages file for more information about your problem with tailf -f command. If you are trying to send mail through PHP you should also check your httpd log file(/var/log/httpd/error_log or for vhosts check your httpd.conf file to find path under the VirtualHost scope)

<VirtualHost *:80>
    DocumentRoot /www/docs/
    **ErrorLog logs/**
    CustomLog logs/ common
  1. As explained above posts it is not about incoming firewall rules. The problem may be in your outgoing firewall/iptables. Is this complete of iptables-save command output? Try

    iptables -L OUTPUT or iptables-save | grep OUTPUT

  2. Check your network interface and /etc/resolv.conf file.Your server may not resolve Try to ping or other tools.

  3. Check your exim configuration and logs for more details. /var/log/exim_mainlog
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.