1.ntp源码
ntp-4.2.6p5.tar.gz
2.编译:很顺利无问题
./configure --host=arm-xilinx-linux-gnueabi CC=arm-xilinx-linux-gnueabi-gcc --prefix=$PWD/install
make;make install
3.拷贝下载文件到开发板
4.设置zynq开发板的IP和网关
ifconfig eth0 192.168.1.209//ip
route add default gw 192.168.1.1//网关
ping 180.97.33.108//连接百度验证
5.查找ntp服务器
ping ntp.sjtu.edu.cn //上海交通大学网络中心NTP服务器地址 119.28.206.193
ping s2m.time.edu.cn //北京大学 202.112.7.13,》》》》授时不成功《《《《
6.授时连接
./ntpdate 202.112.7.13 //此时直接运行会出错如下,ping是通的
Error resolving 202.112.7.13: Servname not supported for ai_socktype (-8)
1 Jan 00:37:30 ntpdate[766]: Can't find host 202.112.7.13: Servname not supported for ai_socktype (-8)
1 Jan 00:37:30 ntpdate[766]: no servers can be used, exiting
ping 202.112.7.13
PING 202.112.7.13 (202.112.7.13): 56 data bytes
64 bytes from 202.112.7.13: seq=0 ttl=236 time=40.456 ms
64 bytes from 202.112.7.13: seq=1 ttl=236 time=39.819 ms
64 bytes from 202.112.7.13: seq=2 ttl=236 time=39.752 ms
解决方法:
在etc/servers文件中增加两行,如没有此文件可以自行新建:
ntp 123/tcp
ntp 123/udp
7.授时成功
./ntpdate -u 119.28.206.193
12 Nov 06:09:33 ntpdate[806]: adjust time server 119.28.206.193 offset 0.000091 sec
date
Mon Nov 12 06:09:40 UTC 2018