使用exfix4从具有exim4的VM发送电子邮件到VM


0

我有两个虚拟机,都运行Ubuntu服务器。我应该可以使用发送电子邮件从lab2发送到lab1 mail。 lab2正在运行 exim4 和lab1有 postfix 在端口25上监听。我应该在lab2上配置exim,以便它将实验室1的电子邮件发送给lab1,实验室2发送给lab2。我发送电子邮件时工作正常 mail 从lab2到lab2,但是从lab2发送到lab1时出错。我认为 exim 应该作为lab1的继电器吗?我得到的错误是 R=dnslookup_relay_to_domains defer (-1): host lookup did not complete,下面有更多细节。

从lab2我可以 pingssh 到lab1。谁能帮助我理解我做错了什么?我试过改变exim的配置,但我确信这里有一些我不理解的东西......

在lab1上

lab1的ip地址:

user@lab1:~$ ifconfig
enp0s3    Link encap:Ethernet  HWaddr 08:00:27:d5:ec:9a  
          inet addr:10.0.2.5  Bcast:10.0.2.255  Mask:255.255.255.0

Postfix正在侦听端口25:

user@lab1:~$ netstat -tulpn
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -               
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      -  

在lab2上

的内容 /etc/hosts

user@lab2:~$ cat /etc/hosts
127.0.0.1   localhost
127.0.1.1   lab2
10.0.2.5    lab1
# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

部分内容 /var/lib/exim4/config.autogenerated

# the following macro definitions were created
# dynamically by /usr/sbin/update-exim4.conf
.ifndef MAIN_LOCAL_INTERFACES
MAIN_LOCAL_INTERFACES=<; 127.0.0.1; 10.0.2.6
.endif
.ifndef MAIN_PACKAGE_VERSION
MAIN_PACKAGE_VERSION=4.86.2-2ubuntu2.3
.endif
.ifndef MAIN_LOCAL_DOMAINS
MAIN_LOCAL_DOMAINS=@:localhost:lab2: localhost
.endif
.ifndef MAIN_RELAY_TO_DOMAINS
MAIN_RELAY_TO_DOMAINS=lab1
.endif
.ifndef ETC_MAILNAME
ETC_MAILNAME=lab2
.endif
.ifndef LOCAL_DELIVERY
LOCAL_DELIVERY=maildir_home
.endif
.ifndef MAIN_RELAY_NETS
MAIN_RELAY_NETS=10.0.2.0/8 : 127.0.0.1 : ::::1
.endif
.ifndef DCreadhost
DCreadhost=empty
.endif
.ifndef DCsmarthost
DCsmarthost=mail.lab2
.endif
.ifndef DC_eximconfig_configtype
DC_eximconfig_configtype=internet
.endif
.ifndef DCconfig_internet
DCconfig_internet=1
.endif

在lab1上将lab2发送给用户的电子邮件:

user@lab2:~$ echo "test" | mail -s test user@lab1

输出 /var/log/exim4/mainlog

2019-01-26 01:31:24 1gnBsa-0000PD-2b <= user@lab2 U=user P=local S=310
2019-01-26 01:31:24 1gnBsa-0000PD-2b == user@lab1 R=dnslookup_relay_to_domains defer (-1): host lookup did not complete

Answers:


0

我一直在尝试很多东西,并且对配置有些混乱。最后整理出来,这里是正确的配置 /etc/exim4/update-exim4.conf.conf

dc_eximconfig_configtype='smarthost'
dc_other_hostnames='lab2; localhost'
dc_local_interfaces='127.0.0.1'
dc_readhost=''
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets=''
dc_smarthost='lab1'
CFILEMODE='644'
dc_use_split_config='false'
dc_hide_mailname='false'
dc_mailname_in_oh='true'
dc_localdelivery='maildir_home'

基本上使用 sudo dpkg-reconfigure exim4-config 我不得不选择 mail sent by smarthost 选项然后设置 lab1 作为smarthost。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.