文章目录
赛题
2.3.2、系统基础环境配置
· 配置lnxserver3 的服务器DNS为“8.8.8.8”;“172.0.10.122”
2.3.6、配置企业内网用邮件服务器(Postfix + Dovecot)
· 安装Postfix组件;
· 安装Dovecot 组件;
· 配置user01, user02允许同服务器发送邮件;
· 添加邮件MX记录用于邮件服务器;配置DNS组件;
· 邮件发送本地进行测试;
1.安装服务
root@lnxserver3:~# apt install -y postfix dovecot-pop3d bind9 dnsutils
安装postfix的时候,工作模式根据个人需要选择,这里我选择了Internet site。接着会提示设置域名,这里就填本地邮件服务的域名,我的是lnxserver3.skillslinux.org。如果暂时还没设置邮件域名,也可以先使用默认值,后期可以修改/etc/mailname这个文件来修改邮件域名
2.配置dns
复制模板文件
root@lnxserver3:~# cd /etc/bind
root@lnxserver3:/etc/bind# cp -a db.local db.skillslinux.org
编辑正向文件
root@lnxserver3:/etc/bind# vim db.skillslinux.org
;
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA skillslinux.org. root.skillslinux.org. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS skillslinux.org.
@ IN A 172.0.10.122
@ IN MX 10 lnxserver3
lnxserver3 IN A 172.0.10.122
root@lnxserver3:/etc/bind# vim /etc/bind/named.conf.default-zones
在文件中追加以下内容
zone "skillslinux.org" {
type master;
file "/etc/bind/db.skillslinux.org";
};
添加dns解析
root@lnxserver3:/etc/bind# echo nameserver 172.0.10.122 >> /etc/resolv.conf
重启服务
root@lnxserver3:~# systemctl restart bind9
测试
root@lnxserver3:/etc/bind# nslookup lnxserver3.skillslinux.org
Server: 172.0.10.122
Address: 172.0.10.122#53
Name: lnxserver3.skillslinux.org
Address: 172.0.10.122
3.创建用户
root@lnxserver3:/etc/bind# usermod -d /home/user01 user01
root@lnxserver3:/etc/bind# usermod -d /home/user02 user02
root@lnxserver3:/home# cd /home
root@lnxserver3:/home# mkdir user01 user02
root@lnxserver3:/home# chown user01:user01 user01
root@lnxserver3:/home# chown user02:user02 user02
4.命令发送接收测试
root@lnxserver3:~# cd /var/mail/
root@lnxserver3:/var/mail# echo "This is test." |mail -s 'test' user02
root@lnxserver3:/var/mail# cat user02
From root@lnxserver3.skillslinux.org Sun Feb 19 22:08:18 2023
Return-path: <root@lnxserver3.skillslinux.org>
Envelope-to: user02@lnxserver3.skillslinux.org
Delivery-date: Sun, 19 Feb 2023 22:08:18 -0500
Received: from root by lnxserver3.skillslinux.org with local (Exim 4.92)
(envelope-from <root@lnxserver3.skillslinux.org>)
id 1pTwXK-0000Ks-Ct
for user02@lnxserver3.skillslinux.org; Sun, 19 Feb 2023 22:08:18 -0500
Subject: test
To: <user02@lnxserver3.skillslinux.org>
X-Mailer: mail (GNU Mailutils 3.5)
Message-Id: <E1pTwXK-0000Ks-Ct@lnxserver3.skillslinux.org>
From: root@lnxserver3.skillslinux.org
Date: Sun, 19 Feb 2023 22:08:18 -0500
This is test.
root@lnxserver3:/var/mail#