配置DNS

mailwestos.example.com

vim /etc/named.rfc1912.zones

  zone "westos.com" IN {

         type master;

         file "westos.com.zone";

        allow-update { none; };

  };

  zone "linux.com" IN {

          type master;

         file "linux.com.zone";

         allow-update { none; };

  };


cp -p named.localhost westos.com.zone

vim /var/named/westos.com.zone 



cp -p westos.com.zone linux.com.zone

vim /var/named/linux.com.zone 

systemctl restart named

systemctl stop firewalld


vim /etc/postfix/main.cf 

wKiom1g_9J7zzEb8AAIMtEqhIKc325.png-wh_50

wKioL1g_9J7z0XCUAACohoTkvMQ460.png-wh_50

wKiom1g_9J-wcx6-AAFyQzAP-g4258.png-wh_50

wKiom1g_9KDiG1omAACpbM89kaE154.png-wh_50

maillinux.example.com

    

wKiom1g_9V_RhLb3AAIMtEqhIKc637.png-wh_50

wKioL1g_9V-BYJofAACohoTkvMQ224.png-wh_50

wKioL1g_9WDDFNwIAAFyQzAP-g4320.png-wh_50

wKiom1g_9WCC-DwdAACpbM89kaE680.png-wh_50

●别名发送:


linux.com 主机向 westos.com主机发送邮件,使用别名发送

vim /etc/aliases

wKiom1g_9cDhJk29AABvpDjr4cY136.png-wh_50


    vim /etc/moreusers 

        root

        student



 postalias /etc/aliases

 systemctl restart postfix.service 



4.出站地址伪装

server (westos.com)主机:

vim /etc/postfix/generic 

wKiom1g_9jKAavCjAAA9aZOBKD4483.png-wh_50

postmap /etc/postfix/generic

postconf -d | grep generic 会出来一段字符,选择最后的一行字符(如下),进行复制:

smtp_generic_maps =

postconf -e "smtp_generic_maps = hash:/etc/postfix/generic" ##此处用到上条语句复制的字符

systemctl restart postfix.servic





5.检测25端口

下载 yum install telnet -y

《Linux菜鸟入门2》mail服务_第1张图片

wKioL1g_9uGhYk7uAAC-S4hBO80772.png-wh_50

250 2.0.0 Ok: queued as 38E0C17E849

quit ##退出telnet

221 2.0.0 Bye

Connection closed by foreign host.