linux 时间同步ntp问题,客户端如何同步时间?

客户端机器输入ntpdate xx.xx.xx.xxx(ip)后显示:
!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!

The ntpdate program is deprecated and should not be used any more. To
quote the upstream ntp developers:

"The functionality ntpdate offered is now provided by the ntpd daemon
itself. If you call ntpd with the command line option -q it will
retrieve the current time and set it accordingly."

Please check the Network Time Protocol (NTP) daemon man page and
http://support.ntp.org/bin/view/Dev/DeprecatingNtpdate
for further information.
。。。。。。

解决方案:
在linux 上配置NTP 时间同步,具休操作步骤,整理如下:
1. 安装软件包(在服务端和客户端):
yum install ntp
2. 服务器端配置
例如:
首先,服务端设定IP地址为:192.168.146.110
修改ntp配置文件
vim /etc/ntp.conf
server 0.redhat.pool.ntp.org //设定上级服务器
restrict 192.168.146.0 mask 255.255.255.0 nomodify //设定哪些client机器可以和ntp server进行同步
//启动NTP服务前,手动校正一次时间
ntpdate 0.redhat.pool.ntp.org
service ntpd restart
chkconfig ntpd on
//查看ntp服务状态
netstat -ln | grep 123
ntpstat
3.客户端配置:
ntpdate 192.168.146.110 //与NTP server 同步时间
或者定期同步
crontab -e
*/5 * * * * /usr/sbin/ntpdate -u 192.168.146.110 //每五分钟同步一次
重启crond服务/etc/init.d/crond restart
ntpq -p //查看同步状态
温馨提示:内容为网友见解,仅供参考
第1个回答  2014-03-04
让ntpd开机启动,会自动联网同步时间的。追问

如果我想手动同步时间怎么做呢?

追答

https://wiki.archlinux.org/index.php/Network_Time_Protocol_daemon_%28%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87%29

连手册都不会看的人我还是洗洗睡了

本回答被提问者采纳
第2个回答  2014-03-04
sudo ntpdate cn.pool.ntp.org输入这条命令同步时间 如果ntpdate无效 说明没有安装追问

应该安装了,我输入rpm -qa ntp后
ntp-4.2.4p8-1.3.28

追答

rpm只有你有rpm包才能安装

第3个回答  2014-03-04
为什么不问问神奇的archwiki呢?
第4个回答  2014-03-04
可以同步到一个ntp服务器上去啊追问

为什么我输入命令后会出现 !!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!?是我ntp版本问题吗?我的是ntp-4.2.4p8-1.3.28,兄弟能截个图看看你的环境吗

追答

不是吧

貌似缺参数,它也不知道你要做什么

相似回答