简单配置PostFix服务器

简单配置PostFix服务器
安装包:

[root@rhel6-1 named]# yum install postfix telnet

[root@rhel6-1 named]# yum install bind bind-chroot

配置 DNS 服务器

[root@rhel6-1 named]# vi /etc/named.conf

options {

listen-on port 53 {  any; };

listen-on-v6 port 53 { ::1; };

directory       "/var/named";

dump-file       "/var/named/data/cache_dump.db";

statistics-file "/var/named/data/named_stats.txt";

memstatistics-file "/var/named/data/named_mem_stats.txt";

allow-query     {  any;  };

recursion yes;

dnssec-enable yes;

dnssec-validation yes;

dnssec-lookaside auto;

/* Path to ISC DLV key */

bindkeys-file "/etc/named.iscdlv.key";

};

logging {

channel default_debug {

file "data/named.run";

severity dynamic;

};

};

zone "." IN {

type hint;

file "named.ca";

};

include "/etc/named.rfc1912.zones";

[root@rhel6-1 named]# vi /etc/named.rfc1912.zones

添加

zone "testmail.com" IN {

type master;

file "named.testmail.com";

allow-update { none; };

};

[root@rhel6-1 named]# cp /var/named/named.localhost /var/named/chroot/var/named/named.testmail.com

[root@rhel6-1 named]# cat /var/named/chroot/var/named/named.testmail.com 

$TTL 1D

@       IN SOA  @       root (

0       ; serial

1D      ; refresh

1H      ; retry

1W      ; expire

3H )    ; minimum

NS      @

A       127.0.0.1

AAAA    ::1

mail.testmail.com.      IN      A       192.168.1.11

testmail.com.    MX     10      mail.testmail.com.

[root@rhel6-1 named]# service named restart

Stopping named: .  [  OK  ]

Starting named:                                            [  OK  ]

修改 postfix 的配置文件

[root@rhel6-1 named]# vi /etc/postfix/main.cf

修改以下参数

myhostname = mail.testmail.com

mydomain = testmail.com

myorigin = $mydomain

inet_interfaces = all

inet_protocols = all

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

mynetworks = 192.168.1.0/24, 127.0.0.0/8

relay_domains = $mydestination

[root@rhel6-1 ~]# service postfix restart

Shutting down postfix:                                     [  OK  ]

Starting postfix:                                          [  OK  ]

[root@rhel6-1 ~]# useradd test001

[root@rhel6-1 ~]# useradd test002

发送邮件

[root@rhel6-1 named]# telnet 192.168.1.11 25

Trying 192.168.1.11...

Connected to 192.168.1.11.

Escape character is '^]'.

220 mail.testmail.com ESMTP Postfix

mail from:test001@testmail.com

250 2.1.0 Ok

rcpt to:test002@testmail.com

250 2.1.5 Ok

data

354 End data with <CR><LF>.<CR><LF>

hello test002!!!

.

250 2.0.0 Ok: queued as 12623A0059

quit   

221 2.0.0 Bye

Connection closed by foreign host.

接收邮件

[root@rhel6-1 named]# su - test002

[test002@rhel6-1 ~]$ mail

Heirloom Mail version 12.4 7/29/08.  Type ? for help.

"/var/spool/mail/test002": 2 messages 1 new

1 test001@rhel6-1.doma  Mon Oct 13 02:53  15/517   

>N  2 test001@testmail.com  Mon Oct 13 05:37  14/507   

& r

undisclosed-recipients:; contains invalid character ':'

To: test001@testmail.comtest001@testmail.com wrote:

> hello test002!!!

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值