您好,欢迎访问这里是深圳市硕远科技有限公司!
戴尔服务器价格_IBM联想配置_浪潮代理-深圳市硕远科技有限公司
联系我们
戴尔服务器价格_IBM联想配置_浪潮代理-深圳市硕远科技有限公司
邮箱:2324898850@qq.com
电话:400-080-6079
地址:深圳市龙华区河背工业区108创业园A301
当前位置:主页 > 新闻动态 > 企业新闻 >

企业新闻

centos7 ntp服务器搭建(centos搭建ntp时间同步服务器

发布时间:2023-01-09 03:03:08浏览次数:

废话少说,直接上命令:亲测可用

centos最小化安装后登陆:

login as: root

root@192.168.205.132's password:

Last login: Thu Apr 25 13:33:52 2019

[root@localhost ~]# hostname -I 查看本机ip信息

192.168.205.132

[root@localhost ~]# yum install -y ntp 通过yum安装ntp服务

[root@localhost ~]# rpm -qa ntp 验证ntp服务安装情况

ntp-4.2.6p5-28.el7.centos.x86_64

[root@localhost ~]# vi /etc/ntp.conf 设置ntp配置文件

restrict 192.168.205.0 加上可以接收ntp的网段

server ntp1.aliyun.com iburst

server time.nist.gov iburst 设置本机需要同步的时间服务器,如果用本机时间,那么此处设置本机ip

[root@localhost ~]# systemctl start ntpd 启动ntp服务

[root@localhost ~]# netstat -lnuto|grep 123 查看端口开启情况

-bash: netstat: 未找到命令

[root@localhost ~]# yum -y install net-tools 找不到以上命令需要安装net-tools

[root@localhost ~]# ntpq -p 查看ntp同步情况

[root@localhost ~]# firewall-cmd --permanent --add-port=123/udp 把udp 123端口加到防火墙里

success

[root@localhost ~]# firewall-cmd --reload

success

完成即可作为时间同步服务器。

400-080-6079