Postfix: "Connection timed out" on all outbound email [closed]

I've been attempting to setup mailing lists with GNU Mailman but it's been a complete disaster with tons of road blocks. Postfix is able to receive email but not send it back out at all, I've peeked in the log and this is what I found:

Mar 30 16:35:30 apott-server postfix/smtp[22572]: connect to gmail-smtp in.l.google.com[74.125.142.26]:25: Connection timed out
Mar 30 16:36:01 apott-server postfix/smtp[22572]: connect to alt1.gmail-smtp-in.l.google.com[173.194.76.27]:25: Connection timed out
Mar 30 16:36:31 apott-server postfix/smtp[22572]: connect to alt2.gmail-smtp-in.l.google.com[74.125.131.26]:25: Connection timed out
Mar 30 16:37:01 apott-server postfix/smtp[22572]: connect to alt3.gmail-smtp-in.l.google.com[173.194.67.27]:25: Connection timed out
Mar 30 16:37:31 apott-server postfix/smtp[22572]: connect to alt4.gmail-smtp-in.l.google.com[173.194.65.26]:25: Connection timed out
Mar 30 16:37:31 apott-server postfix/smtp[22572]: A0616100CCB: to=<[email protected]>, relay=none, delay=150, delays=0.06/0.01/150/0, dsn=4.4.1, status=deferred (connect to alt4.gmail-smtp-in.l.google.com[173.194.65.26]:25: Connection timed out)

So clearly something is preventing outgoing email, does anyone have any suggestions on how to fix this?

(Server is an Ubuntu Linux box)

Thanks for any help.


Solution 1:

Connection timeout means your TCP SYN packets are not getting SYN-ACKs back. This means something must be blocking either the SYNs or the SYN-ACKS.

You can use traceroute to find out how far your SYN packets get

traceroute -n -T -p 25 gmail-smtp-in.l.google.com

Notice that there exist different traceroute commands for Ubuntu. The above command works with traceroute.db, but not with traceroute-nanog or inetutils-traceroute.

It may be useful to run a second traceroute using port 80 rather than port 25 for comparison.

Solution 2:

This could be unrelated but I'm going to post it here because I had a hard time finding the answer to my question. I was able to get outbound email working from a vagrant virtual box by editing my /etc/resolv.conf to use Google's nameserver rather than the 10.0.x.x IP it was set to:

sudo vi /etc/resolv.conf

Change the nameserver IP:

nameserver 8.8.8.8

Then you'll need to restart postfix:

sudo /etc/init.d/postfix restart

Solution 3:

Setup a relay host to your isp smtp server, in: /etc/postfix/main.conf

then reload: sudo service postfix reload