邮件
1,先配置收发双方ip,dns。
配置ip:
发件方:vim /etc/sysconfig/network-scripts/ifcfg-eth0
DVICE=eth0
BOOTPROTO=none
IPADDR=172.25.254.x
NETMASK=255.255.255.0
ONBOOT=yes
TYPE=Ethernet
USERCTL=yes
PEERDNS=yes
IPV6INIT=no
PERSISTENT_DHCLIENT=1
systemctl restart network
修改主机名称:hostnamectl set-hostname westos-mail.westos.com
编辑yum源:vim /etc/yum.repos.d/rhel_dvd.repo
yum clean all
安装bind服务器 yum install bind -y
开启服务 systemctl start named
配置named , rfc1912.zone
编辑域文件
vim /etc/resolv.conf nameserver 172.25.254.X{主机ip】
vim /etc/postfix/main.cf
收件方:vim /etc/sysconfig/network-scripts/ifcfg-eth0
DVICE=eth0
BOOTPROTO=none
IPADDR=172.25.254.X
NETMASK=255.255.255.0
ONBOOT=yes
TYPE=Ethernet
USERCTL=yes
PEERDNS=yes
IPV6INIT=no
PERSISTENT_DHCLIENT=1
配置yum源
vim /etc/resolv.conf nameserver 172.25.254.X{主机ip】
vim /etc/postfix/main.cf
测试
mail root@jieshou.com 发送邮件
mailq 邮件队列
postqueue -f 重新发送
邮件别名
在接受机上面修改
vim /etc/aliases
主机给别名发邮件,依然能收到
邮件客户端的访问控制
限制用户发送
[root@faxin-mail ~]# postconf -e "smtpd_sender_restrictions =check_sender_access hash:/etc/postfix/sender"
[root@faxin-mail postfix]# vim /etc/postfix/sender
[root@faxin-mail postfix]# postmap /etc/postfix/sender
[root@faxin-mail postfix]# systemctl restart postfix.service
[root@faxin-mail postfix]#
student@faxin.com REJECT
出站地质伪装
[root@faxin-mail postfix]# postconf -e "smtp_generic_maps = hash:/etc/postfix/generic"
[root@faxin-mail postfix]# vim generic
[root@faxin-mail postfix]# vim main.cf
[root@faxin-mail postfix]# postmap /etc/postfix/generic
[root@faxin-mail postfix]# systemctl restart postfix.service
[root@faxin-mail postfix]# su - westos
Last login: Wed May 24 13:48:44 EDT 2017 on pts/1
[westos@faxin-mail ~]$ mail root@jieshou.com
Subject: ggggg
sds
fdsfs
.
EOT
接收端
[root@jieshou-mail postfix]# mail
Heirloom Mail version 12.5 7/5/10. Type ? for help.
"/var/spool/mail/root": 4 messages 4 new
>N 1 root Wed May 24 12:50 22/787 "hello"
N 2 root Wed May 24 13:02 23/762 "jjjjj"
N 3 root Wed May 24 13:06 23/763 "jfsd"
N 4 westos@westos.com Wed May 24 13:58 22/757 "ggggg"
&
本文转自铁骑传说51CTO博客,原文链接: http://blog.51cto.com/ybzbfs/1929175,如需转载请自行联系原作者