yum install bind -y
vim /etc/name.conf
options {
//      listen-on port 53 { 127.0.0.1; };
//      listen-on-v6 port 53 { ::1; };
//      allow-query     { localhost; };
vim /etc/named.rfc1912.zones
zone "timo.com" IN {
        type master;
        file "timo.com.zone";
        allow-update { none; };
};

zone "rito.com" IN {
        type master;
        file "rito.com.zone";
        allow-update { none; };
};
cp -p name.localhost timo.com.zone
cp -p name.localhost rito.com.zone
vim timo.com.zone
$TTL 1D
@       IN SOA  dns.timo.com. root.timo.com. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
                NS      dns.timo.com.
dns             A       172.25.254.124
timo.com.       MX 1    172.25.254.124.
~                                       
vim rito.com.zone
$TTL 1D
@       IN SOA  dns.rito.com. root.rito.com. (
                                        0       ; serial
                                        1D      ; refresh
$TTL 1D
@       IN SOA  dns.rito.com. root.rito.com. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
                NS      dns.rito.com.
dns             A       172.25.254.124
rito.com.       MX 1    172.25.254.224.                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
                NS      dns.rito.com.
dns             A       172.25.254.124
rito.com.       MX 1    172.25.254.224.
主机和客户端都改为DNS服务端的ip
vim /etc/resolve.conf
nameserver 172.25.254.124

dig -t MX timo.com
dig -t MX rito.com
主客都改,发送接受都改

vim /etc/postfix/main.cf
75 myhostname = mailtimo.timo.com#
主机名
83 mydomain = timo.com     #
99 myorigin = $mydomain        #邮件后缀域名
113 inet_interfaces = all  #开放所有端口
116 #inet_interfaces = localhost  #注释掉
164 mydestination = $myhostname, $mydomain, localhost#本机能接受的邮件类型

systemctl restart postfix.server
发送不出去的两个原因:
systemctl stop firewalld.service  #关闭防火墙
netstat -antlpe | grep 25  #查看端口是否开放

mail root@rito.com#写邮件
abc
def
.
EOT
mail    #
查看邮件
mail -u root   #查看有关root的邮件
mailq   #查看排队邮件
postsuper -d QUEUE-ID  #删除排队的邮件
postqueue -f   #刷新
postconf -d | grep *   #查看默认设置
postconf -e#设置
postconf -n#查看当前设置
邮件接受方
vim /etc/aliases   #
# Person who should get root's mail
#root:          marc
timo:           root    #timo
是虚拟名,指代root
more:           :include:/etc/timo             
postalias /etc/aliases
systemctl restart postfix.service
邮件发送方

mail more@rito.com

发送地址转换包装
发送方
vim /etc/postfix/generic
  root@timo.com   739944675@qq.com#
前面是真实域名,后面为虚假域名
postmap generic    #文件加密
postconf -d | grep generic查看设置
postconf -e "smtp_generic_maps =hash:/etc/postfix/generic"   #编辑设置
systemctl restart postfix.service
mail root@rito.com
接收方
[root@mailrito mail]# mail
Heirloom Mail version 12.5 7/5/10.  Type ? for help.
"/var/spool/mail/root": 4 messages 1 new 3 unread
    1 root                  Sun Nov 27 01:55  23/728   "abc"
 U  2 root                  Sun Nov 27 03:08  23/727   "iop"
 U  3 root                  Sun Nov 27 03:10  26/851   "vbn"
>N  4 root                  Sun Nov 27 03:39  21/722   "fgh"
& 4
Message  4:
From 739944675@qq.com  Sun Nov 27 03:39:34 2016       ##
发送方已改变
Return-Path: <739944675@qq.com>
X-Original-To: root@rito.com
Delivered-To: root@rito.com
Date: Sun, 27 Nov 2016 03:39:32 -0500
To: root@rito.com
Subject: fgh
User-Agent: Heirloom mailx 12.5 7/5/10
Content-Type: text/plain; charset=us-ascii
From: 739944675@qq.com (root)
Status: R

jkl

&
远程发送
[kiosk@foundation24 Desktop]$ telnet 172.25.254.124 25       #邮件连接 ip的25端口
Trying 172.25.254.124...
Connected to 172.25.254.124.
Escape character is '^]'.
220 mailtimo.timo.com ESMTP Postfix
ehlo hello     #
检测
250-mailtimo.timo.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from:root@timo.com
250 2.1.0 Ok
rcpt to:root@rito.com
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
mnbv
grnregt
tymjts
.
250 2.0.0 Ok: queued as B5D3B246263
quit
221 2.0.0 Bye
Connection closed by foreign host.