LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   postfix appears not finding MX records or host names from DNS (https://www.linuxquestions.org/questions/linux-software-2/postfix-appears-not-finding-mx-records-or-host-names-from-dns-4175515210/)

rrangel11 08-18-2014 12:48 AM

postfix appears not finding MX records or host names from DNS
 
I am working on a test environment using a postfix server as an email gateway using the transport_maps parameter. The /etc/postfix/transport file looks like.

lornadell.com relay:[mail2.lornadell.com]

This configuration above works, but if mail2.lornadell.com goes down I would then want the email to go to mail.lornadell.com. What I understand from searching around you can't have two entries like this in the transport file.

lornadell.com relay:[mail2.lornadell.com]
lornadell.com relay:[mail.lornadell.com]

and is recommended to use MX records for this so that mail.lornadell.com would be secondary. In the above examples the brackets disables MX lookups so to get MX lookups working I modified the parameter to look like.

lornadell.com relay:lornadell.com

Right now I am sending an email message from the relay server itself but I also get the same results when sending messages from outside the network.

---------
Here is the error message from the logs

Aug 18 04:26:29 relay postfix/pickup[5294]: 592FD21E02: uid=0 from=<root>
Aug 18 04:26:29 relay postfix/cleanup[5299]: 592FD21E02: message-id=<20140818042629.592FD21E02@relay>
Aug 18 04:26:29 relay postfix/qmgr[5295]: 592FD21E02: from=<root@relay.localdomain>, size=419, nrcpt=1 (queue active)
Aug 18 04:26:29 relay postfix/smtp[5301]: warning: no MX host for lornadell.com has a valid address record
Aug 18 04:26:29 relay postfix/smtp[5301]: 592FD21E02: to=<rrangel@lornadell.com>, relay=none, delay=0.08, delays=0.06/0.02/0.01/0, dsn=5.4.4, status=bounced (Host or domain name not found. Name service error for name=mai12.lornadell.com type=A: Host not found)


---------
Here is the DNS zone configuration

$TTL 21600
@ IN SOA pepperrun.home.com. rrangel.lornadell.com. (
2014081000
10800
3600
604800
10800 )

IN NS pepperrun.home.com.

localhost IN A 127.0.0.1
relay IN A 192.168.1.71
mail IN A 192.168.1.72
mail2 IN A 192.168.1.73

lornadell.com. IN MX 10 mai12.lornadell.com.

---------
On the relay server here is what the DNS lookup shows

[root@relay postfix]# dig MX lornadell.com

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>> MX lornadell.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 29417
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:
;lornadell.com. IN MX

;; ANSWER SECTION:
lornadell.com. 21600 IN MX 10 mai12.lornadell.com.

;; AUTHORITY SECTION:
lornadell.com. 21600 IN NS pepperrun.home.com.

;; ADDITIONAL SECTION:
pepperrun.home.com. 21600 IN A 192.168.1.30

;; Query time: 48 msec
;; SERVER: 192.168.1.30#53(192.168.1.30)
;; WHEN: Mon Aug 18 04:36:39 2014
;; MSG SIZE rcvd: 98

--- and ---

root@relay postfix]# dig mail2.lornadell.com

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6 <<>> mail2.lornadell.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 17245
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:
;mail2.lornadell.com. IN A

;; ANSWER SECTION:
mail2.lornadell.com. 21600 IN A 192.168.1.73

;; AUTHORITY SECTION:
lornadell.com. 21600 IN NS pepperrun.home.com.

;; ADDITIONAL SECTION:
pepperrun.home.com. 21600 IN A 192.168.1.30

;; Query time: 4 msec
;; SERVER: 192.168.1.30#53(192.168.1.30)
;; WHEN: Mon Aug 18 04:37:58 2014
;; MSG SIZE rcvd: 98

---------
And here is what the postfix config looks like

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
html_directory = no
inet_interfaces = 192.168.1.71, localhost
inet_protocols = ipv4
local_recipient_maps =
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
masquerade_domains = lornadell.com
mydestination =
myhostname = relay
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
relay_domains = lornadell.com
relayhost = smtp-server.austin.rr.com
sample_directory = /usr/share/doc/postfix-2.6.6/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtp_host_lookup = dns
transport_maps = hash:/etc/postfix/transport
unknown_local_recipient_reject_code = 550

ceyx 08-18-2014 02:55 AM

Put all of your known hosts in the /etc/hosts file on each relevant server, and make sure that

Quote:

hostname -f
returns the right FQDN,

and I'll bet your problems go away...

:)

Plastic Freddie 08-18-2014 08:49 AM

Typo in hostnames in zone file
 
Quote:

mail2 IN A 192.168.1.73

lornadell.com. IN MX 10 mai12.lornadell.com.
mail2 in the "A" record
mai12 in the "MX" record

Look closely and you'll see what I mean. "A" record is correct, I believe.

rrangel11 08-18-2014 10:58 AM

Looks like Plastic Freddie's eagle eye was the answer. Being new to Postfix I was all tied up thinking there was at least one more parameter that needed setting and not really paying attention to what all my DNS testing output was showing me.

Also thanks to ceyx comment since lot of my test environments I use the short name for the hosts.


All times are GMT -5. The time now is 12:25 PM.