Chinaunix首页 | 论坛 | 博客
  • 博客访问: 487709
  • 博文数量: 82
  • 博客积分: 3003
  • 博客等级: 中校
  • 技术积分: 1285
  • 用 户 组: 普通用户
  • 注册时间: 2007-09-11 15:27
文章分类

全部博文(82)

文章存档

2011年(1)

2010年(5)

2009年(63)

2008年(13)

我的朋友

分类: LINUX

2009-11-02 12:10:26

实验环境

1DNS服务器,主机名为yoko

2mail服务器,主机名为server1server2server1上有sina.comyahoo.com


要实现多域,首先得在DNS中添加MX记录,使这几个域名都能够被解析

DNS

[root@yoko chroot]# vim etc/named.rfc1912.zones ###加上以下域####

zone "sina.com" IN {

type master;

file "sina.com.zone";

allow-update { none; };

};

zone "yahoo.com" IN {

type master;

file "yahoo.com.zone";

allow-update { none; };

};

zone "163.com" IN {

type master;

file "163.com.zone";

allow-update { none; };

};

zone "12.168.192.in-addr.arpa" IN {

type master;

file "sina.com.local";

allow-update { none; };

};


zone "20.168.192.in-addr.arpa" IN {

type master;

file "163.com.local";

allow-update { none; };

};

[root@yoko named]# vim sina.com.zone

$TTL 86400

@ IN SOA yoko root@sina.com. (

42 ; serial (d. adams)

3H ; refresh

15M ; retry

1W ; expiry

1D ) ; minimum

IN NS yoko.sina.com.

IN MX 5 server1.sina.com.

yoko IN A 192.168.12.1

server1 IN A 192.168.12.23

client1 IN A 192.168.12.2

[root@yoko named]# vim yahoo.com.zone

$TTL 86400

@ IN SOA yoko root@yahoo.com. (

42 ; serial (d. adams)

3H ; refresh

15M ; retry

1W ; expiry

1D ) ; minimum

IN NS yoko

IN MX 5 server1

yoko IN A 192.168.12.1

server1 IN A 192.168.12.23

[root@yoko named]# vim 163.com.zone

$TTL 86400

@ IN SOA yoko.163.com. root@163.com. (

42 ; serial (d. adams)

3H ; refresh

15M ; retry

1W ; expiry

1D ) ; minimum

IN NS yoko.163.com.

IN MX 5 server2.163.com.

yoko IN A 192.168.20.1

server2 IN A 192.168.20.23

[root@yoko named]# vim 163.com.local

$TTL 86400

@ IN SOA yoko root@163.com. (

1997022700 ; Serial

28800 ; Refresh

14400 ; Retry

3600000 ; Expire

86400 ) ; Minimum

IN NS yoko

1 IN PTR yoko.163.com.

23 IN PTR server2.163.com.

一,sendmail的配置方法

Server1

#rpm -ivh sendmail-cf

[root@server1 mail]# vim sendmail.cf

O DaemonPortOptions=Port=smtp,Addr=0.0.0.0, Name=MTA ###打开所有端口###


[root@server1 mail]# netstat -tlunp |grep 25 ####查看已对所有网段开放端口###

tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1625/portmap

tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 7824/sendmail: acce

udp 0 0 0.0.0.0:111 0.0.0.0:* 1625/portmap


[root@server1 mail]# vim access

###Connect

From:和to:连接的是telnet的时候mail from rcpt to,在邮件发出的时候会去check这些用户是否真的存在,若不存在就relay deny.

如果有了connect这项,那么fromto可以任意指定,没有的话只能指定实际存在的用户和域名。###

Connect:192.168.12 RELAY

Connect:192.168.20 RELAY

[root@server1 mail]# vim local-host-names ###表示本台mail server允许接受的域有多个###

sina.com

yahoo.com

[root@server1 mail]service sendmail restart ###重启服务使配置生效###


Test:

Server2 163

[root@server2 mail]# mail test@yahoo.com

Subject: test3

yoyoyo

.

Cc:

[root@server2 mail]# mail test@sina.com

Subject: test4

wawawa

.

Cc:


Server1sina/yahoo

[root@server1 mail]# su - test

[test@server1 ~]$ mail

>N 14 root@server2 Wed Oct 21 10:52 19/707 "test3"

Message 14:

From root@server2 Wed Oct 21 10:52:11 2009

Date: Wed, 21 Oct 2009 10:52:57 +0800

From: root

To: test@yahoo.com

Subject: test3


yoyoyo


[test@server1 ~]$ mail

>N 14 root@server2 Wed Oct 21 10:58 19/703 "test4"

& 14

Message 14:

From root@server2 Wed Oct 21 10:58:50 2009

Date: Wed, 21 Oct 2009 10:59:36 +0800

From: root

To: test@sina.com

Subject: test4

wawawa

二,postfix 配置

Server1


[root@server1 postfix]# vim main.cf


myhostname = server1.sina.com

myhostname = server1.yahoo.com 主机名


mydomain = sina.com 本机的域名

inet_interfaces = all 对所有网段开放25端口

mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, yahoo.com指定postfix接收邮件时收件人的域名

mynetworks = 127.0.0.0/8, 192.168.12.0/24 指定你所在的网络的网络地址,postfix系统根据其值来区别用户是远程的还是本地的

relay_domains = $mydestination 规定可以帮忙relayMX主机,默认为mydestination


Server2

[root@server2 postfix]# vim main.cf

myhostname = server2.163.com

mydomain = 163.com

inet_interfaces = all

mydestination = $myhostname, localhost.$mydomain, localhost, 163.com

mynetworks = 127.0.0.0/8, 192.168.20.0/24

ok!



阅读(1871) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~