linux ntp ntpdate 同步时间
来源:互联网 发布:ubuntu安装qq2016 编辑:程序博客网 时间:2024/06/06 09:49
ntp同步时间实验
服务端IP
一.登录server端
1.首先配置ntpd服务
vi /etc/ntp.conf
配置文件中一般有restrict default语句,#掉后选择,以下2种的一种
restrict default nomodify notrap noquery
restrict default ignore
#与上级服务端连续性同步时间,prefer表示优先,如无可不设置
server 上级ntp服务器IP或者域名
#当之前设置了restrict default ignore的情况下,可以设置哪些客户可以ntpdate到本机
restrict 192.168.1.88 mask 255.255.255.255 nomodify notrap
#其余为可选设置,以默认值即可
2.开启ntpd服务
service ntpd start
chkconfig ntpd on
二.登录客户端
此时有2种办法,一种是客户端使用ntpdate + crontab的组合,另一种是客户端也开启ntpd服务
1.第一种办法ntpdate + crontab
1)#先确保网络通
ping 192.168.1.101
2)#使用ntpdate同步一次时间,查看是否有正确回显
ntpdate 192.168.1.101
#如为以下报错,一般是因为服务端才开启,需要等5分钟左右就好了
[root@test ~]# ntpdate 192.168.1.101
#如显示以下信息表示成功
[root@test ~]# ntpdate 192.168.1.101
3)#这样就可以将ntpdate命令放入crontab中,定期执行
crontab -e
添加一条,如
*
保存即可
这里可能碰见的其他问题:
服务端开启了防火墙,没有允许ntpd的端口123被访问
执行 service iptables stop
2.第二种方法ntpd
1)#先确保网络通
ping 192.168.1.101
2)#使用ntpdate同步一次时间,查看是否有正确回显
ntpdate 192.168.1.101
3)#设置ntpd服务
vi /etc/ntp.conf
方法同上,但注意将设置的上级ntp server端需要设置为
server 192.168.1.101 prefer
#设置开启服务后自动同步上级ntp server时间
vi /etc/ntp/step-tickers
192.168.1.101
4)#开启ntpd服务
service ntpd start
chkconfig ntpd on
————————————————————————————————————————————————
其他注意事项:
1.如需做时间调整,也需要暂停ntpd服务后,调整,调整之后再开启ntpd服务
2.查看ntp服务状态信息的命令
ntpq -p
ntpstat
ntptrace 192.168.1.101
3.检查ntp端口是否正常开启(服务是否开启)
netstat -tunl | grep 123
4.查看防火墙状态
service iptables status
- linux ntp ntpdate 同步时间
- linux ntp ntpdate 同步时间
- linux中时间服务器同步问题:ntpdate[5426]: the NTP socket is in use, exiting
- ntpdate linux时间同步命令
- Linux下ntpdate时间同步
- Linux使用ntpdate时间同步
- linux 时间同步、ntpd、ntpdate
- linux时间同步,ntpd、ntpdate
- linux时间同步,ntpd、ntpdate
- Linux下ntpdate时间同步
- linux ntpdate同步网络时间
- linux时间同步,ntpd、ntpdate
- linux时间同步,ntpd、ntpdate
- linux时间同步,ntpd、ntpdate
- Linux下ntpdate时间同步
- linux时间同步,ntpd、ntpdate
- linux时间同步,ntpd、ntpdate
- linux时间同步,ntpd、ntpdate
- 本土邮件服务器品牌的特色及发展趋势
- maven build 的时候,卡死在Downloading metadata的解决方法
- Linux学习6_Linux下载文件命令wget用法介绍
- springMVC(8) springMVC注解优化
- SpringMVC中使用Interceptor拦截器
- linux ntp ntpdate 同步时间
- Java通过一系列工具打包成不需要JDK支持的exe文件
- 注意Java陷阱
- Codeforces Round #318 [RussianCodeCup Thanks-Round] (Div. 2)(574A,574B)
- [Phonegap+Sencha Touch] 移动开发4 Cordova/Phonegap应用调试方法汇总
- JavaScript 函数调用
- 630-850nm雪崩管apd列表
- github-july-寻找和为定值的多个数
- jedisPool中的jedis实例被还回后是否会断开和redis服务端的socket连接