Discussion:
relayhost with [domain] considered as "loops back to myself"
(too old to reply)
nouk nouk
2022-05-09 08:26:59 UTC
Permalink
Hi,

I'm starting a mail relay setup for my home LAN network, open to WAN. I've got a domain (let's say mydomain.fr) and fixed IPv4.

My homeserver is the mail gateway between LAN network and WAN ; ideally I would be able to use it as smtpd exposed to WAN, but as I cannot define the reverse DNS of my fixed IPv4 address to mydomain.fr, I currently use another server, I rent, relay.mydomain.fr

Use cases:

1- for LAN server to LAN address (From: @lan/@mydomain.fr, To: @lan/@mydomain.fr) => mail is relayed to homeserver (which stores it locally)

2- for an external incoming mail (From: gmail.com, To: mydomain.fr) => the MX of mydomain.fr points to relay.mydomain.fr, which relays to my homeserver

3- for a LAN mail outgoing to external mail (From: @lan/@mydomain.fr, To: @gmail.com) => mail relayed to homeserver, From rewrited to '***@mydomain.fr', relayed to relay.mydomain.fr, which relays to gmail.com

For case 3, @homeserver, I would like to define @homeserver relayhost=[relay.mydomain.fr] (with square braces), but it doesn't work until I replace domain with real IP. Otherwise I get an error "mail for relay.mydomain.fr loops back to myself"

=> Any idea ?
Thanks in advance.


---

homeserver:/etc/postfix/main.cf

('xxx.yyy.zzz.ttt' begin real IP address of relay.mydomain.fr)

```
mydomain = mydomain.fr
mydestination = $myhostname, $mydomain, localhost.localdomain, localhost
mynetworks = 127.0.0.0/8 192.168.0.0/16 [::ffff:127.0.0.0]/104 [::1]/128 xxx.yyy.zzz.ttt
relayhost = [xxx.yyy.zzz.ttt]
## but relayhost = [relay.mydomain.fr] doesn't work => considered as 'loopback for myself'
```

Exemple as ***@homeserver: echo "test" | sendmail ***@gmail.com

```
May 9 09:29:05 homeserver postfix/pickup[26725]: 554E0421F76: uid=0 from=<root>
May 9 09:29:05 homeserver postfix/cleanup[26752]: 554E0421F76: message-id=<***@homeserver>
May 9 09:29:05 homeserver postfix/qmgr[26726]: 554E0421F76: from=<***@mydomain.fr>, size=250, nrcpt=1 (queue active)
May 9 09:29:05 homeserver postfix/smtp[26757]: warning: relayhost configuration problem
May 9 09:29:05 homeserver postfix/smtp[26757]: 554E0421F76: to=<***@gmail.com>, relay=none, delay=0.08, delays=0.03/0.01/0.03/0, dsn=4.3.5, status=deferred (mail for relay.mydomain.fr loops back to myself)
```
Bob Nichols
2022-05-09 12:20:11 UTC
Permalink
Post by nouk nouk
homeserver:/etc/postfix/main.cf
('xxx.yyy.zzz.ttt' begin real IP address of relay.mydomain.fr)
```
mydomain = mydomain.fr
mydestination = $myhostname, $mydomain, localhost.localdomain, localhost
mynetworks = 127.0.0.0/8 192.168.0.0/16 [::ffff:127.0.0.0]/104 [::1]/128 xxx.yyy.zzz.ttt
relayhost = [xxx.yyy.zzz.ttt]
## but relayhost = [relay.mydomain.fr] doesn't work => considered as 'loopback for myself'
```
```
May 9 09:29:05 homeserver postfix/pickup[26725]: 554E0421F76: uid=0 from=<root>
May 9 09:29:05 homeserver postfix/smtp[26757]: warning: relayhost configuration problem
```
Is your homeserver able to look up the IP address of the relay host?
(For example does
$ ping -c 1 relay.mydomain.fr
do anything?)

If no, then either add a nameserver to /etc/resolv.conf or add the
address for relay.mydomain.fr to /etc/hosts.

If yes, then the problem is elsewhere...
--
Bob Nichols
(for e-mail remove .invalid)
Loading...