准备工作:昨天的邮件服务器为server1,IP:172.16.1.1,网卡模式为仅主机,网关为:172.16.1.2
克隆一台邮件服务器为server2 IP:192.168.18.105 网卡模式为桥接,网关为;192.168.18.1
Server1:
配置postfix主配置文件:vim /etc/postfix/main.cf
更改字段:myhostname = mail.zouying.com 定义主机名与DNS中一致
Mydomain = zouying.com 定义域名
Myorigin = $mydomain
Inet_interfaces = all
#inet_interfaces = localhost
Mydestination = $myhostname,$mydomain
Mynetworks = 192.168.18.0/24, 127.0.0.0/8,172.16.0.0/16
Relay_domains = zouying.com
启动认证服务:/etc/init.d/saslauthd start
修改SMTP认证的配置文件:vim /etc/sysconfig/saslauthd
MECH = shadow
重启认证服务: /etc/init.d/saslauthd restart
建立用户:useradd aaa
Passwd aaa
测试认证:testsaslauthd –u aaa –p ‘aaa’
显示OK “Success” 认证服务成功!
将认证加到启动项中: chkconfig saslauthd on
修改邮件服务器配置文件,关联SMTP与Postfix:vim /etc/postfix/main.fix
Readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
Smtpd_sasl_auth_enable = yes
Smtpd_sasl_local_domain = ‘’
Smtpd_recipient_restrictions=permit_mynetworks,permit_sasl_authenticated,reject_unaut h_destination
Broken_sasl_auth_clients = yes
Smtpd_client_restrictions = permit_sasl_wuthenticated
Smtpd_sasl_security_options = noanongmous
重启邮件服务:service postfix restart
重新设置开机启动:chkconfig postfix on
更改用户名(密码)格式:
Perl –MMIME::Base64 –e ‘print encode_base64(“aaa”);’
记下显示出的字段:YWFh
实现POP&IMAP
安装dovecot :yum install dovecot
修改dovecot配置文件:vim /etc/dovecot.conf
Protocols = POP3 POP3S
Protocol pops{
Listen = *;10100
}
启动dovecot服务并加到启动项:service dovecot start
Chkconfig dovecot on
安装cyrus:yum install cyrus*
修改postfix配置文件:vim /etc/postfix/main.cf
第456行去掉注释
启动imap服务: sercice cyrus-imapd start
加到启动项: chkconfig cyrus-imapd on
给cyrus用户设置密码为cyrus
重启邮件服务:service postfix restart
连后台,建立邮箱:cyradm –u cyrus localhost
Cm user.aaa
Cm user.aaa.Send
Cm user.aaa.Trash
Cm user.aaa.Drafts
实现webmail
安装squirrelmail:yum install squirrelmail
修改配置文件:vim /etc/squirrelmail/config/php &&
Usr/share/squirrelmail/config/conf.pl
D cyrus
2
1 zouying.com
3 2
4 5 t
启动httpd服务:service httpd start
所有配置完成,打开浏览器进行测试:
http://mail.zouying.com/webmail
server2:
配置postfix主配置文件:vim /etc/postfix/main.cf
更改字段:myhostname = mail.zouying1.com 定义主机名与DNS中一致
Mydomain = zouying1.com 定义域名
Myorigin = $mydomain
Inet_interfaces = all
#inet_interfaces = localhost
Mydestination = $myhostname,$mydomain
Mynetworks = 192.168.18.0/24, 127.0.0.0/8
Relay_domains = zouying1.com
启动认证服务:/etc/init.d/saslauthd start
修改SMTP认证的配置文件:vim /etc/sysconfig/saslauthd
MECH = shadow
重启认证服务: /etc/init.d/saslauthd restart
建立用户:useradd aaa
Passwd aaa
测试认证:testsaslauthd –u aaa –p ‘aaa’
显示OK “Success” 认证服务成功!
将认证加到启动项中: chkconfig saslauthd on
修改邮件服务器配置文件,关联SMTP与Postfix:vim /etc/postfix/main.fix
Readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
Smtpd_sasl_auth_enable = yes
Smtpd_sasl_local_domain = ‘’
Smtpd_recipient_restrictions=permit_mynetworks,permit_sasl_authenticated,reject_unaut h_destination
Broken_sasl_auth_clients = yes
Smtpd_client_restrictions = permit_sasl_wuthenticated
Smtpd_sasl_security_options = noanongmous
重启邮件服务:service postfix restart
重新设置开机启动:chkconfig postfix on
更改用户名(密码)格式:
Perl –MMIME::Base64 –e ‘print encode_base64(“aaa”);’
记下显示出的字段:YWFh
实现POP&IMAP
安装dovecot :yum install dovecot
修改dovecot配置文件:vim /etc/dovecot.conf
Protocols = POP3 POP3S
Protocol pops{
Listen = *;10100
}
启动dovecot服务并加到启动项:service dovecot start
Chkconfig dovecot on
安装cyrus:yum install cyrus*
修改postfix配置文件:vim /etc/postfix/main.cf
第456行去掉注释
启动imap服务: sercice cyrus-imapd start
加到启动项: chkconfig cyrus-imapd on
给cyrus用户设置密码为cyrus
重启邮件服务:service postfix restart
连后台,建立邮箱:cyradm –u cyrus localhost
Cm user.aaa
Cm user.aaa.Send
Cm user.aaa.Trash
Cm user.aaa.Drafts
实现webmail
安装squirrelmail:yum install squirrelmail
修改配置文件:vim /etc/squirrelmail/config/php &&
Usr/share/squirrelmail/config/conf.pl
D cyrus
2
1 zouying.com
3 2
4 5 t
启动httpd服务:service httpd start
所有配置完成,打开浏览器进行测试:
http://mail.zouying.com/webmail
server3:开启一台新的linux搭建DNS服务器:添加一块网卡,eth0连接server1,eth1连接server2,开启路由功能,开启网卡转发
1:配置DNS主配置文件:
Vim /var/named/chroot/etc/named.conf
Options{
Directory “/var/named
};
Zone “zouying.com”{
Type master;
File “zouying.com.zone”;
};
Zone “zouying1.com”{
Type master;
File “zouying1.com.zone”;
};
2.配置DNS区域文件;
Vim /var/named/chroot/var/named/zouying.com.zone
Zouying.com IN SOA dns,zouying,com, root zouying.com.(
42
3H
15M
1W
1D)
Zouying.com. IN NS www.zouying.com.
dns IN A 172.16.1.1
mail.zouying.com. IN A 172.16.1.1
Zouying.com. IN MX 10 mail.zouying.com.
Vim /var/named/chroot/var/named/zouying1.com.zone
@ IN SOA localhost root(
42
3H
15M
1W
1D)
Zouying1.com. IN NS www.zouying1.com.
mail.zouying1.com. IN A 192.168.18.105
Zouying1.com. IN MX 10 mail.zouying1.com.
开启转发功能:
Echo 1 > /proc/sys/net/ipv4/ip_forward
在server1上:route add default gw 172.16.1.2
Vim /etc/resolv.conf
Nameserver 172.16.1.2
Search localdomain