邮件服务器

本文详细介绍了如何在Linux系统中搭建NTP服务器并同步时间,包括限制当前网段主机同步时间的配置。接着,文章展示了设置ntp客户端进行时间同步的步骤,并通过计划任务自动更新时间。最后,文章深入讲解了邮件服务器的搭建,涉及postfix、dovecot和cyrus-sasl的安装配置,以及如何使用foxmail收发邮件。
摘要由CSDN通过智能技术生成

1.搭建ntp服务器,并查询状态

2.搭建ntp客户端,从上面的ntp服务器上同步时间

3.搭建ntp客户端,并设置使用key认证登录

安装软件:[root@localhost ~]# yum install ntp -y
重启服务[root@localhost ~]# systemctl restart ntpd
可使用如下命令来查看NTP服务器是否已经顺利更新了自己的时间
[root@localhost ~]# ntpstat 该命令可列出我们的NTP服务器是否已经与上层连接。
[root@localhost ~]# ntpstat
unsynchronised
polling server every 64 s
等一会儿再查看
[root@localhost ~]# ntpstat
synchronised to NTP server (203.107.6.88) at stratum 3
time correct to within 111 ms
polling server every 128 s
NTP服务器已经成功与上层建立连接。时间已经校正约111ms,每隔128s会主动去更新时间。
服务端(192.168.206.141):
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0

[root@localhost ~]# vim /etc/ntp.conf
restrict 192.168.206.0 mask 255.255.255.0 限制当前网段的主机可以同步时间
server 127.127.1.0 设置上层NTP服务器为自己
fudge 127.127.1.0 stratum 8 虚拟自己在第8层

[root@localhost ~]# systemctl restart ntpd
客户端(192.168.206.138):
[root@localhost ~]# ntpdate -q 192.168.206.141 查看上层服务器的状态
server 192.168.206.141, stratum 9, offset -0.002161, delay 0.02641
29 Mar 19:02:53 ntpdate[43576]: adjust time server 192.168.206.141 offset -0.002161 sec

[root@localhost ~]# ntpdate 192.168.206.141 更新时间
29 Mar 19:02:08 ntpdate[43567]: step time server 192.168.206.141 offset 32331.572864 sec

使用计划任务自动更新客户端的时间
编辑/etc/crontab文件

          • root /usr/sbin/ntpdate 192.168.206.141 > /dev/null 2>&1

标准输出(stdout):代码为1,使用>或>>;
标准错误输出(stderr):代码为2,使用2>或2>>。

2>&1 意思是把标准错误输出重定向到标准输出

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值