Linux下配置邮件服务器

 
实验一:搭建Sendmail 服务
1.       配置 DNS ,添加 MX 记录
# service named start
# vi /etc/named.conf
  zone “aaa.com” IN {
        type master;
        file “aaa.com.dns”;
  };
 
# cd /var/named
# ls
# cp named.local aaa.com.dns  
# vi aaa.com.dns     
$ TTL   86400
@      IN      SOA       [url]www.aaa.com.root.localhost.[/url]  (
                            19970220700 ; Servial
                            28800       ; Refresh
                            14400       ; Retry
                            3600000     ; Expire
                            86400 )      ; Minimum
            IN        NS      [url]www.aaa.com[/url].
aaa.com     IN        MX  10    [url]www.aaa.com.[/url]
www        IN        A       192.168.1.150
# service named restart
windows 上把 dns 指向 192.168.1.150
使用 nslookup 查看
nslookup
set type=mx .or.  set type=any
aaa.com
ping [url]www.aaa.com[/url]
2.       启动 POP3 服务
# vi /etc/xinetd.d/ipop3
disable=no
# service xinetd restart
# nmap 192.168.1.150      查看当前系统打开的端口
3.       启动 SMTP 服务
# vi /etc/mail/sendmail.cf
Addr=192.168.1.150   进入配置文件,把 IP 地址改成本机地址
    # service sendmail restart
4.       设置邮件接收域
# vi /etc/mail/local-host-names
aaa.com           添加一个域名
5.       设置邮件发送中继
# cd /etc/mail
# vi access
aaa.com      RELAY
   # makemap hash access.db < access
6.       重启服务
# service sendmail restart
7.       创建用户
# useradd a01
# passwd a01
# 输入密码
# useradd a02
# passwd a02
# 输入密码
8.       客户端用服务器上所创建好的 2 个用户,进行邮件转发。
 
 
 
 
   
实验二:设置邮件的别名
1. 添加别名
①添加用户别名
# vi /etc/aliases            添加别名
# newaliases              更新别名
②添加邮件别名
# cd /etc/mail
# vi sendmail.cw         
       sohu.com         添加别名
         aaa.com          原来的域名
# vi /etc/mail/local-host-names
   sohu.com
2. 添加一个 Sohu 的正向解析配置文件
# vi /etc/named.conf       
  zone “sohu.com” IN {
     type master;
     file “sohu.com.dns”;
  };
# cd /var/named
# cp aaa.com.dns sohu.com.dns
# vi sohu.com.dns
$ TTL   86400
@      IN      SOA       [url]www.sohu.com.root.localhost.[/url]  (
                            19970220700 ; Servial
                            28800       ; Refresh
                            14400       ; Retry
                            3600000     ; Expire
                            86400 )      ; Minimum
            IN        NS      [url]www.sohu.com[/url].
sohu.com     IN        MX  9   [url]www.sohu.com.[/url]
www        IN        A       192.168.1.150
3. 重启服务
# service named reload
# service sendmail restart
 
 
 
   
 
实验三:SMTP 认证
# rpm -qa |grep sasl         检查软件包安装是否安装
# mount /dev/cdrom   /mnt/cdrom    挂载安装光盘
# cd  /mnt/cdroom /redhat/rpms      
# rpm -ivh cyrus-sasl-gssapi - 2.1.10 -4.i386.rpm    安装软件包
# cd /etc/mail
# m4 sendmail.mc > sendmail.cf
# vi sendmail.mc
    TRUST_AUTH_MECH ('EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
      define ('confAUTH_MECHANISMS', 'EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN ')dnl
       DAMON_OPTIONS ('Port=submission, Name=MSA, M=Ea')dnl
    去掉这 3 行前面的注释标记
     DAMON_OPTINS ('Port =smtp,Addr=192.168.1.150,Name=MTA')dnl
    Addr 指向本机 IP
# m4 sendmail.mc > sendmail.cf
# service sendmail restart
 

本文出自 “技术论坛” 博客,谢绝转载!

你可能感兴趣的:(linux,邮件,配置,服务器,linux下)