Mike Nguyen
Mike Nguyen

Reputation: 1053

Config reverse DNS PTR on cpanel with AWS EC2

Anybody here has experience with configuration SMTP on Cpanel host by AWS EC2.

After I have done configurations, DKIM is valid, SPF is valid, but PTR is not valid (reverse DNS). Then when I sent a test email to mail-tester.com, it was 3/10. Here is the error message

We didn't find a server (A Record) behind your hostname ip-172-31-1-135.ap-southeast-1.compute.internal.

You may want to publish a DNS record (A type) for the hostname 
ip-172-31-1-135.ap-southeast-1.compute.internal or use a different hostname in your mail software.

I'm a newbie for DNS stuff, if you need more information, please give me a comment.

Upvotes: 0

Views: 1114

Answers (3)

lipek
lipek

Reputation: 106

If you want to receive emails on this server you can't change port number from 25 to something else as other servers will try to connect on this port to deliver emails. You also have to ask AWS to remove throttle on port 25 as stated before.

If you haven't already, create A DNS record for cpanel.mydomain.com pointing to your elastic IP (it is important that you have elastic IP not automatically assigned public IP)

Upvotes: 1

Mike Nguyen
Mike Nguyen

Reputation: 1053

Finally, I got 9.8/10 after tweaking some configuration and waiting for AWS Support to map Elastic IP to my domain name, then I can get 10/10

enter image description here

Most importantly, have to make sure hostname has to your my domain 1. set hostname sudo hostname cpanel.mydomain.com

  1. Set it automatically
cd /etc/dhcp/dhclient-exit-hooks.d/
sudo nano set-hostname.sh

file set-hostname.sh

#!/bin/sh
hostname cpanel.mydomain.com
/scripts/fixetchosts

For more detail, please free to reference here

Upvotes: 0

Dusan Bajic
Dusan Bajic

Reputation: 10879

  1. You should configure your mail server software to use your custom hostname (for example mail.example.com), not the AWS assigned default (such as ip-172-31-1-135.ap-southeast-1.compute.internal)

  2. You need to contact AWS support to have PTR record configured https://aws.amazon.com/blogs/aws/reverse-dns-for-ec2s-elastic-ip-addresses/

  3. Keep in mind that Amazon EC2 throttles traffic on port 25 of all EC2 instances by default, but you can request for this throttle to be removed: https://aws.amazon.com/premiumsupport/knowledge-center/ec2-port-25-throttle/

Upvotes: 1

Related Questions