一.邮件服务器
1.接受并存储转发电子邮件的一种服务器
二.dns服务器
1.为网络中的主机提供动态域名解析的服务器
三.案例
1.案例前言
①.实验环境:随着信息化社会的快速建设,任何一个企业已经不能再独自为站。本实验架设有一天sisco和huawei之间开始了战略合作。当然第一步是建立共同的内部网络。公司内部的能够互联通讯的邮件网络。
②.实验目的:组建简单的企业级邮件服务器
③.实验设备:两台同时架构邮件服务器和dns服务器的linux(redhat 5.4)虚拟机。
一台加装两块网卡并打开路由功能的linux (redhat 5.4)虚拟机。
四台分别连接华为与sisco的虚拟内部windows xp 主机
vmware 虚拟机软件添加两块虚拟网卡vmnet1 与 vmnet2 均使用hostonly连接
实验拓扑:
2.sisco 中服务器环境的基本配置
①.修改主机名
vim /etc/sysconfig/network
②.检查hosts文件
检查 hosts文件 如下:
3 127.0.0.1 localhost
4 ::1 localhost6.localdomain6 localhost6
③.指定dns指向
[root@mail named]# vim /etc/resolv.conf
nameserver 192.168.20.244
④.修改服务器上的网关为
192.168.20.80
⑤.选择虚拟主机的链接方式
sisco服务器主机选择使用vmnet2(hostonly区域)
3.sisco 中dns服务器的配置
①.安装dns服务器并添加声明域
yum install named
[root@mail ~]# vim /var/named/chroot/etc/named.rfc1912.zones
27 zone "sisco.com" IN {
28 type master;
29 file "sisco.com.zone";
30 allow-update { none; };
31 };
vim /var/named/chroot/etc/named.rfc1912.zones
38 zone "20.168.192.in-addr.arpa" IN {
39 type master;
40 file "192.168.20.zone";
41 allow-update { none; };
42 };
②.创建配置文件并配置
[root@mail etc]# cp -p named.caching-nameserver.conf named.conf
[root@mail ~]# vim /var/named/chroot/etc/named.conf
15 listen-on port 53 { any; };
27 allow-query { any; };
28 allow-query-cache { any; };
29 forwarders { 192.168.10.244; };
38 match-clients { any; };
39 match-destinations { any; };
③.解析文件
[root@mail named]# cd /var/named/chroot/var/named
[root@mail named]# cp -p localhost.zone sisco.com.zone
[root@mail named]# vim sisco.com.zone
1 $TTL 86400
2 @ IN SOA ns.sisco.com. root.sisco.com. (
3 42 ; serial (d. adams)
4 3H ; refresh
5 15M ; retry
6 1W ; expiry
7 1D ) ; minimum
9 IN NS ns.sisco.com.
10 ns.sisco.com. IN A 192.168.20.244
11 mail IN A 192.168.20.244
12 smtp IN CNAME mail
13 pop3 IN CNAME mail
14 @ IN MX 10 mail
[root@mail named]# cp -p named.local 192.168.20.zone
[root@mail named]# vim 192.168.20.zone
1 $TTL 86400
2 @ IN SOA localhost. root.localhost. (
3 1997022700 ; Serial
4 28800 ; Refresh
5 14400 ; Retry
6 3600000 ; Expire
7 86400 ) ; Minimum
8 IN NS localhost.
9 244 IN PTR mail.sisco.com.
将dns 加入到开机自动启动
[root@mail ~]# chkconfig --add named
[root@mail ~]# chkconfig named on
4.sisco中sendmail服务器的配置
①.安装sendmail
默认情况下sendmail自动安装
[root@mail ~]# cd /etc/mail
[root@mail mail]# vim sendmail.mc
116 DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl
②.编辑配置文件
[root@mail mail]# vim access
Connect:192.168.10 RELAY
Connect:192.168.20 OK
sisco.com OK
huawei.com RELAY
[root@mail mail]# vim local-host-names
1 # local-host-names - include all aliases for your machine here.
2 sisco.com
3 mail.sisco.com
③.sisco服务器上的路由表并创建本地账号
[root@mail named]# useradd user3
[root@mail named]# passwd user3
Changing password for user user3.
New UNIX password:
BAD PASSWORD: it is WAY too short
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@mail named]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.20.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
0.0.0.0 192.168.20.80 0.0.0.0 UG 0 0 0 eth0
5.华为中服务器环境的基本配置
sisco服务器主机选择使用vmnet2(hostonly区域)
①.修改主机名
vim /etc/sysconfig/network
②.检查 hosts文件 如下:
3 127.0.0.1 localhost
4 ::1 localhost6.localdomain6 localhost6
③.服务器自身解析时的dns指向
[root@mail named]# vim /etc/resolv.conf
nameserver 192.168.10.244
④.选择虚拟主机的连接区域
华为服务器主机选择使用vmnet1(hostonly区域)
④.修改服务器上的网关为
192.168.10.80
6.华为中dns服务器的配置
①.安装dns并声明域
yum install named
[root@mail ~]# vim /var/named/chroot/etc/named.rfc1912.zones
添加如下!!!
32 zone "huawei.com" IN {
33 type master;
34 file "huawei.com.zone";
35 allow-update { none; };
36 };
②.创建配置文件并配置
[root@mail etc]# cp -p named.caching-nameserver.conf named.conf
[root@mail ~]# vim /var/named/chroot/etc/named.conf
15 listen-on port 53 { any; };
27 allow-query { any; };
28 allow-query-cache { any; };
29 forwarders { 192.168.20.244; };
38 match-clients { any; };
39 match-destinations { any; };
③.拷贝并添加dns解析文件
[root@mail ~]# cd /var/named/chroot/
[root@mail named]# cp -p localhost.zone huawei.com.zone
[root@mail named]# vim huawei.com.zone
1 $TTL 86400
2 @ IN SOA ns.huawei.com. root.huawei.com. (
3 42 ; serial (d. adams)
4 3H ; refresh
5 15M ; retry
6 1W ; expiry
1D ) ; minimum
9 IN NS ns.huawei.com.
10 ns.huawei.com. IN A 192.168.10.244
11 mail IN A 192.168.10.244
12 smtp IN CNAME mail
13 pop3 IN CNAME mail
14 @ IN MX 10 mail
④.将dns 加入到开机自动启动
[root@mail ~]# chkconfig --add named
[root@mail ~]# chkconfig named on
7.华为中sendmail服务器的配置
①.安装sendmail
默认情况下sendmail自动安装
②.编辑sendmail的配置文件
[root@mail ~]# cd /etc/mail
[root@mail mail]# vim sendmail.mc
116 DAEMON_OPTIONS(`Port=smtp,Addr=0.0.0.0, Name=MTA')dnl
[root@mail mail]# vim access
10 Connect:192.168.10 RELAY
11 Connect:192.168.20 OK
12 huawei.com RELAY
13 sisco.com OK
[root@mail mail]# vim local-host-names
1 # local-host-names - include all aliases for your machine here.
2 sisco.com
3 mail.sisco.com
③.华为服务器上的路由表并创建本地账号
[root@mail named]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.10.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
0.0.0.0 192.168.10.80 0.0.0.0 UG 0 0 0 eth0
[root@mail named]# useradd user1
[root@mail named]# passwd user1
Changing password for user user1.
New UNIX password:
BAD PASSWORD: it is WAY too short
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
8.路由器的配置
①.添加两块网卡eth0与eth1
eth0: 192.168.10.80 255.255.255.0 无网关
加入vmnet 1 区域
eth1: 192.168.20.80 255.255.255.0 无网关
加入vmnet 2 区域
②.打开路由转发功能
[root@111 ~]#vim /etc/sysctl.conf
7 net.ipv4.ip_forward = 1
启用路由转发功能
sysctl -p
创建本地账号
9.客户端的配置
客户机 pc1
网络参数设置
pc1 主机选择使用vmnet1(hostonly区域)
创建新账号
指定电子邮件的地址
指定接受和发送的邮件服务器
设置帐号名及密码
成功完成账号的添加
在账户属性中修改用户显示名
在pc3客户机上创建一个名为user3的账号所在的域为 sisco.com
过程和user1相同
pc3主机的网络设置使用vmnet2(hostonly区域)
10.测试邮件服务器
使用 [email protected] 向 [email protected] 发送一封主题为 0000000000000000 内容为: 111111111111111
使用 “tail –f /var/log/maillog”
Aug 5 00:00:31 mail sendmail[4866]: q74G0VJF004866: from=<[email protected]>, size=1229, class=0, nrcpts=1, msgid=<A0190CACDDA64B0A98B432724237F480@201208231440>, proto=SMTP, daemon=MTA, relay=[192.168.10.99]
Aug 5 00:00:31 mail sendmail[4868]: q74G0VJF004866: to=<[email protected]>, ctladdr=<[email protected]> (500/500), delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=121229, relay=mail.sisco.com. [192.168.20.244], dsn=2.0.0, stat=Sent (q74FbS1Y004686 Message accepted for delivery)
在pc3接收
使用[email protected] 账号回复[email protected]
Aug 5 00:02:49 mail sendmail[4873]: q74G2nZm004873: from=<[email protected]>, size=2807, class=0, nrcpts=1, msgid=<AF9DE57591FC49D8B29A1B72C3C9BCF4@201208231440>, proto=ESMTP, daemon=MTA, relay=mail.sisco.com [192.168.20.244]
Aug 5 00:02:49 mail sendmail[4874]: q74G2nZm004873: to=<[email protected]>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=32995, dsn=2.0.0, stat=Sent
Aug 5 00:03:50 mail dovecot: pop3-login: Login: user=<user1>, method=PLAIN, rip=::ffff:192.168.10.99, lip=::ffff:192.168.10.244
使用 “tail –f /var/log/maillog”
Aug 5 00:02:49 mail sendmail[4873]: q74G2nZm004873: from=<[email protected]>, size=2807, class=0, nrcpts=1, msgid=<AF9DE57591FC49D8B29A1B72C3C9BCF4@201208231440>, proto=ESMTP, daemon=MTA, relay=mail.sisco.com [192.168.20.244]
Aug 5 00:02:49 mail sendmail[4874]: q74G2nZm004873: to=<[email protected]>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=32995, dsn=2.0.0, stat=Sent
Aug 5 00:03:50 mail dovecot: pop3-login: Login: user=<user1>, method=PLAIN, rip=::ffff:192.168.10.99, lip=::ffff:192.168.10.244
嗯,韩宇说的对呀!!!