Troubleshooting “connect to aspmx.l.google.com:25: Network is unreachable” Error in Postfix Mail Server


3 views

When your Postfix mail server running on RHEL 6 fails to deliver emails specifically to Google's MX records (aspmx.l.google.com) with the error "Network is unreachable", this typically indicates one of several potential network configuration issues. The key observation here is that this only occurs with one specific domain (englishonlineuniversity.com), suggesting it's not a general mail server outage.

The log shows Postfix attempting to connect via IPv6 (2a00:1450:4013:c01::1b):

connect to aspmx.l.google.com[2a00:1450:4013:c01::1b]:25: Network is unreachable

This is a common problem with older RHEL 6 systems where IPv6 might not be properly configured or routed. Google's MX servers prefer IPv6 connections when available.

First, verify your server's IPv6 connectivity:

ping6 -c 4 aspmx.l.google.com
traceroute6 aspmx.l.google.com

If these fail, you might need to either:

# Option 1: Disable IPv6 in Postfix
postconf -e "inet_protocols = ipv4"

# Option 2: Fix IPv6 routing
# (Requires proper network configuration)

Check the specific DNS resolution for the problematic domain:

dig MX englishonlineuniversity.com +short
dig AAAA aspmx.l.google.com

Compare with working domains to identify differences in MX records or IP versions.

Examine your outbound SMTP rules on port 25:

iptables -L -n -v | grep 25
ip6tables -L -n -v | grep 25

Ensure there are no network policies blocking traffic to Google's mail servers, particularly over IPv6.

Consider these Postfix adjustments for better error handling:

# Set fallback to IPv4
postconf -e "smtp_address_preference = ipv4"

# Adjust connection timeouts
postconf -e "smtp_connect_timeout = 30s"

# Enable detailed logging
postconf -e "debug_peer_level = 2"
postconf -e "debug_peer_list = aspmx.l.google.com"

After making changes, test delivery with:

echo "Test" | mail -s "Connection Test" recipient@englishonlineuniversity.com
tail -f /var/log/maillog

Monitor whether Postfix now successfully connects to the Google MX servers.

For production systems, rather than completely disabling IPv6, consider:

  1. Proper IPv6 network configuration
  2. Implementation of SMTP fallback mechanisms
  3. Regular network connectivity tests

Document your mail server's network requirements and maintain monitoring for similar issues with other domains.


When your Postfix server running on RHEL 6 fails to deliver emails specifically to Google's mail servers (aspmx.l.google.com) with the error "Network is unreachable", it typically indicates an IPv6 connectivity issue. The log snippet shows Google's MX record resolving to an IPv6 address (2a00:1450:4013:c01::1b) which your server cannot reach.

First, verify if your server has IPv6 connectivity:

ping6 -c 4 ipv6.google.com
traceroute6 aspmx.l.google.com

If these commands fail, your network infrastructure might not support IPv6 properly. This is common in older RHEL 6 environments where IPv6 wasn't as widely adopted.

The most reliable solution is to configure Postfix to use IPv4 only. Edit your main.cf file:

# /etc/postfix/main.cf
inet_protocols = ipv4
smtp_address_preference = ipv4

Then reload Postfix:

service postfix reload

If you can't modify Postfix configuration, you can force DNS resolution to IPv4:

# /etc/hosts
74.125.200.26 aspmx.l.google.com

Or modify your DNS resolver configuration to prefer IPv4:

# /etc/resolv.conf
options inet6

After making changes, test your configuration:

postconf -n | grep inet_protocols
telnet aspmx.l.google.com 25

Check your mail logs to verify successful delivery:

tail -f /var/log/maillog | grep aspmx

The issue appears only with englishonlineuniversity.com because:

  • Google's MX records return both IPv4 and IPv6 addresses
  • Your DNS resolver may be prioritizing IPv6 records
  • Other domains might not have IPv6 MX records

For a more permanent solution, consider:

  • Upgrading to a newer OS version with better IPv6 support
  • Properly configuring IPv6 networking if your infrastructure supports it
  • Implementing proper fallback mechanisms in Postfix