码迷,mamicode.com
首页 > 其他好文 > 详细

ntp服务搭建

时间:2018-11-12 12:03:59      阅读:165      评论:0      收藏:0      [点我收藏+]

标签:事件   ini   环境   art   init.d   服务搭建   apt   cat   权限   

1、系统环境

1.1 系统环境

    本文 测试环境为 Ubuntu 16.04 amd64

# lsb_release -a

 

2、ntp 服务器端

## 允许BIOS与系统时间同步
# hwclock -w

    

2.1 软件安装

# apt-get install ntp

    

2.2 防火墙设置

    若不需要,直接关闭 防火墙

# ufw disable

    

2.3 配置文件

# cat /etc/ntp.conf
# 系统时间与BIOS事件的偏差记录
driftfile /var/lib/ntp/ntp.drift

# 权限设置
restrict 127.0.0.1
restrict ::1

# 127.127.1.0 本机回环设备地址
server 127.127.1.0

    

2.4 服务

2.4.1 服务 开启/重启

# /etc/init.d/ntp [start | restart]

    

2.4.2 服务 检测

## 如果看到123端口,说明ntp服务成功启动
# netstat -tlunp | grep ntp?? 

## 查看 ntp服务 同步的状态
# ntpq -p

    

3、ntp 客户端

3.1 软件安装

# apt-get install ntpdate

    

3.2 时间同步

# ntpdate {ntp_server_ip}

ntp服务搭建

标签:事件   ini   环境   art   init.d   服务搭建   apt   cat   权限   

原文地址:http://blog.51cto.com/11495268/2315671

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!