8.2配置基础的电子邮件系统

1.设置服务器主机名称,需要保证服务器主机名称与发信域名保持一致。

[root@dsrw ~]# vim /etc/hostname
[root@dsrw ~]# hostname
dsrw.com
[root@dsrw ~]# hostnamectl set-hostname mail.dsrw.com
[root@dsrw ~]# hostname
mail.dsrw.com

2.配置防火墙

[root@dsrw ~]# iptables -F
[root@dsrw ~]# iptables-save
# Generated by xtables-save v1.8.2 on Fri Dec 23 12:20:48 2022
*filter
[root@dsrw ~]# firewall-cmd --permanent --zone=public --add-service=dns
success
[root@dsrw ~]# firewall-cmd --reload 
success

3.配置电子邮件系统域名接解析DNS主配置文件

[root@dsrw ~]#yum  install  bind-chroot
[root@dsrw ~]#vim /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";
        secroots-file   "/var/named/data/named.secroots";
        recursing-file  "/var/named/data/named.recursing";
        allow-query     { any; };

4.配置电子邮件系统域名接解析DNS区域配置文件

[root@dsrw ~]# vim /etc/named.rfc1912.zones
zone "dsrw.com" IN {
         type master;
         file "dsrw.com.zone";
         allow-update { none;};
};

zone "10.168.192.in-addr.arpa" IN {
        type master;
        file "192.168.10.arpa";
        allow-update { none;};
};

5.配置电子邮件系统域名接解析DNS数据配置文件

[root@dsrw ~]# cp -a /var/named/named.localhost /var/named/dsrw.com.zone
[root@dsrw ~]# cp -a /var/named/named.named.loopback /var/named/192.168.10.arpa 
[root@dsrw ~]# vim /var/named/dsrw.com.zone
$TTL 1D
$TTL 1D
@       IN SOA  dsrw.com. root.dsrw.com. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        NS      ns.dsrw.com.
ns    IN A 192.168.10.2
www  IN A 192.168.10.2
@     IN MX 10 mail.dsrw.com.
mail   IN A 192.168.10.2


[root@dsrw ~]# vim /var/named/192.168.10.arpa
$TTL 1D
@       IN SOA  dsrw.com. root.dsrw.com. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        NS      ns.dsrw.com.
ns      A       192.168.10.2
2       PTR     ns.dsrw.com.
2       PTR     www.dsrw.com.
2       PTR     mail.dsrw.com.

6.重新启动DNS服务

[root@dsrw ~]# systemctl restart named
[root@dsrw ~]# systemctl enable named

7.设置服务器DNS地址为本机地址,重新激活网卡

[root@dsrw ~]# nmtui
[root@dsrw ~]# nmcli connection up ens160
连接已成功激活(D-Bus 活动路径:/org/freedesktop/NetworkManager/ActiveConnection/10)
图片[1]-8.2配置基础的电子邮件系统-大赛人网
图8-1 设置DNS地址

8.测试

[root@dsrw ~]# ping -c 4 mail.dsrw.com
PING mail.dsrw.com(mail.dsrw.com (fe80::8782:14ae:73c2:4971%ens160)) 56 data bytes
64 bytes from mail.dsrw.com (fe80::8782:14ae:73c2:4971%ens160): icmp_seq=1 ttl=64 time=0.489 ms
64 bytes from mail.dsrw.com (fe80::8782:14ae:73c2:4971%ens160): icmp_seq=2 ttl=64 time=0.059 ms
64 bytes from mail.dsrw.com (fe80::8782:14ae:73c2:4971%ens160): icmp_seq=3 ttl=64 time=0.062 ms
64 bytes from mail.dsrw.com (fe80::8782:14ae:73c2:4971%ens160): icmp_seq=4 ttl=64 time=0.072 ms
[root@dsrw ~]# nslookup mail.dsrw.com
Server:		192.168.10.2
Address:	192.168.10.2#53

Name:	mail.dsrw.com
Address: 192.168.10.2

[root@dsrw ~]# nslookup mail.dsrw.com
Server:		192.168.10.2
Address:	192.168.10.2#53

Name:	mail.dsrw.com
Address: 192.168.10.2
© 版权声明
THE END
喜欢就支持一下吧
点赞11 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称

    请登录后查看评论内容