LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Problems sending mail from one local machine to the other (https://www.linuxquestions.org/questions/linux-networking-3/problems-sending-mail-from-one-local-machine-to-the-other-253571/)

ricky_ds 11-11-2004 07:23 AM

Problems sending mail from one local machine to the other
 
Hi all,

I have two FC boxes in an intranet, let's call them box1.intranet.com and box2.intranet.com.

I've configured postfix on box1 and sendmail on box2 and can send mail without any problem to an external e-mail address, say joe@example.com. But if I send the mail to root@box1 (from box2, it gets delivered to the mailbox of postfix and not root. Why?

Let me explain how I send the mail, what logs I get in /var/log/maillog and finally what my main.cf configuration file looks like.

I sent the two mails from the command line:
Code:

# mail -s "Test to outside" joe@example.com
Hello World
Cc:
# mail -s "Test to intranet" root@box1
Hello World
Cc:

Here is the maillog on box 2
Code:

Nov 11 13:04:38 box2 sendmail[6524]: iABD4cBA006524: from=root, size=71, class=0, nrcpts=1, msgid=<200411111304.iABD4cBA006524@localhost.localdomain>, relay=root@localhost
Nov 11 13:04:38 box2 sendmail[6526]: iABD4cJ4006526: from=<root@localhost.localdomain>, size=381, class=0, nrcpts=1, msgid=<200411111304.iABD4cBA006524@localhost.localdomain>, proto=ESMTP, daemon=MTA, relay=box2 [127.0.0.1]
Nov 11 13:04:38 box2 sendmail[6524]: iABD4cBA006524: to=joe@example.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30071, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (iABD4cJ4006526 Message accepted for delivery)
Nov 11 13:04:39 box2 sendmail[6528]: iABD4cJ4006526: to=<joe@example.com>, ctladdr=<root@localhost.localdomain> (0/0), delay=00:00:01, xdelay=00:00:01, mailer=esmtp, pri=30381, relay=mail.example.com. [xxx.xxx.xxx.xxx], dsn=2.0.0, stat=Sent (OK)
Nov 11 13:10:40 box2 sendmail[6536]: iABAGQUO008543: to=<root@box2.intranet.com>, delay=02:54:14, xdelay=00:00:00, mailer=esmtp, pri=301418, relay=box2.intranet.com. [yyy.yyy.yyy.8], dsn=4.0.0, stat=Deferred: Connection refused by box2.intranet.com.
Nov 11 13:10:40 box2 sendmail[6536]: iAAAeu81008055: to=<root@box2.intranet.com>, delay=1+02:27:28, xdelay=00:00:00, mailer=esmtp, pri=930043, relay=box2.intranet.com., dsn=4.0.0, stat=Deferred: Connection refused by box2.intranet.com.
Nov 11 13:12:00 box2 sendmail[6539]: iABDC0hY006539: from=root, size=54, class=0, nrcpts=1, msgid=<200411111312.iABDC0hY006539@localhost.localdomain>, relay=root@localhost
Nov 11 13:12:00 box2 sendmail[6541]: iABDC0TG006541: from=<root@localhost.localdomain>, size=363, class=0, nrcpts=1, msgid=<200411111312.iABDC0hY006539@localhost.localdomain>, proto=ESMTP, daemon=MTA, relay=box2 [127.0.0.1]
Nov 11 13:12:00 box2 sendmail[6539]: iABDC0hY006539: to=root@box1, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30054, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (iABDC0TG006541 Message accepted for delivery)
Nov 11 13:12:00 box2 sendmail[6543]: iABDC0TG006541: to=<root@box1.intranet.com>, ctladdr=<root@localhost.localdomain> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=30363, relay=box1.intranet.com. [yyy.yyy.yyy.11], dsn=2.0.0, stat=Sent (Ok: queued as 41CD7717BC)

(Note the stat=Sent (Ok: queued as 41CD7717BC) at the end of the last line above, and how it reappears on box1)

and on box 1
Code:

Nov 11 13:10:40 box1 postfix/smtpd[8048]: connect from box2.intranet.com[yyy.yyy.yyy.8]
Nov 11 13:10:40 box1 postfix/smtpd[8048]: 41CD7717BC: client=box2.intranet.com[yyy.yyy.yyy.8]
Nov 11 13:10:40 box1 postfix/cleanup[8050]: 41CD7717BC: message-id=<200411111312.iABDC0hY006539@localhost.localdomain>
Nov 11 13:10:40 box1 postfix/nqmgr[7775]: 41CD7717BC: from=<root@localhost.localdomain>, size=791, nrcpt=1 (queue active) Nov 11 13:10:40 box1 postfix/smtpd[8048]: disconnect from box2.intranet.com[yyy.yyy.yyy.8]
Nov 11 13:10:40 box1 postfix/local[8053]: 41CD7717BC: to=<postfix@box1.intranet.com>, orig_to=<root@box1.intranet.com>, relay=local, delay=0, status=sent (mailbox)

Finally, here is my main.cf configuration file on box1.

Code:

# postconf -n
alias_database = hash:/etc/postfix/aliases
alias_maps = hash:/etc/postfix/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
debug_peer_level = 2
inet_interfaces = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, $mydomain
mydomain = intranet.com
myhostname = box1.intranet.com
myorigin = $myhostname
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.0.16/README_FILES
sample_directory = /usr/share/doc/postfix-2.0.16/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
unknown_local_recipient_reject_code = 450

Is there a problem with my configuration? or do you have hints on where else to look?

Greetings and thanks in advance.

scowles 11-11-2004 07:43 AM

Box 2 is configured to use sendmail, not postfix. You might want to fix that problem first. :) i.e. system-switch-mail

ricky_ds 11-11-2004 07:57 AM

scowles, I've just noticed that box2 was _again_ configured with sendmail. Thanks for your hint of system-switch-mail.

So anyways, it doesn't matter with which MTA the mail gets sent. The problem is obviously on box1 which doesn't correctly route the mail...

scowles 11-11-2004 08:17 AM

So what happens when you send an e-mail to: mail -s "Test to intranet" root@box1.intranet.com

Note the use of the FQDN in the e-mail address.

ricky_ds 11-11-2004 08:26 AM

No big change. Note that I sync-ed the clocks of both computers. My initial post had a difference of about 2 minutes between both machines. In the mean time I've also switched the MTA to postfix on both computers and rebooted them for checking that the right service was started. I've also emptied the queues so that no other mail is polluting the logs. Here they are:

box2 logs:
Code:

Nov 11 15:17:42 box2 postfix/pickup[6179]: E4BB831FB2: uid=0 from=<root>
Nov 11 15:17:42 box2 postfix/cleanup[6510]: E4BB831FB2: message-id=<20041111141742.E4BB831FB2@box2.intranet.com>
Nov 11 15:17:42 box2 postfix/nqmgr[6180]: E4BB831FB2: from=<root@box2.intranet.com>, size=343, nrcpt=1 (queue active)
Nov 11 15:17:43 box2 postfix/smtp[6512]: E4BB831FB2: to=<root@box1.intranet.com>, relay=box1.intranet.com[10.218.226.11], delay=1, status=sent (250 Ok: queued as ED4DC717B1)

box1 logs:
Code:

Nov 11 15:17:43 box1 postfix/smtpd[3040]: connect from box2.intranet.com[10.218.226.8]
Nov 11 15:17:43 box1 postfix/smtpd[3040]: ED4DC717B1: client=box2.intranet.com[10.218.226.8]
Nov 11 15:17:44 box1 postfix/cleanup[3042]: ED4DC717B1: message-id=<20041111141742.E4BB831FB2@box2.intranet.com>
Nov 11 15:17:44 box1 postfix/smtpd[3040]: disconnect from box2.intranet.com[10.218.226.8]
Nov 11 15:17:44 box1 postfix/nqmgr[2016]: ED4DC717B1: from=<root@box2.intranet.com>, size=560, nrcpt=1 (queue active)
Nov 11 15:17:44 box1 postfix/local[3045]: ED4DC717B1: to=<postfix@box1.intranet.com>, orig_to=<root@box1.intranet.com>, relay=local, delay=1, status=sent (mailbox)


r0b0 11-11-2004 08:37 AM

Check /etc/aliases or /etc/postfix/aliases
In most postfix installations on most systems, root is an alias for some other user, root's e-mail is delivered to this other user, not /var/spool/mail/root

ricky_ds 11-11-2004 08:48 AM

r0b0, thanks, you hit the nail.

I had the following in /etc/postfix/aliases:

Code:

# Person who should get root's mail.  This alias
# must exist.
# CHANGE THIS LINE to an account of a HUMAN
root:          postfix

# Note to the user: You must create the alias above!
# The root alias *must* exist under postfix because
# postfix runs as a non-privileged user and cannot
# touch a spool file which is UID/GID root
# The mapping to the postfix user is to ensure that root's mail
# doesn't get lost on a system installed out of the box.
# mailman aliases

I changed it accordingly.


All times are GMT -5. The time now is 10:23 AM.