T086ѧϰ�� | վ��ѧԺ | �����ĵ� | ���� | Ъ���� | IP��ַ��ѯ | �������� | ���ջ��� | �����ֵ� | ���ù��� | ������Ϣ��ѯ

Linux��ʱ��ͬ��ntpd�������÷�������

�� ����ʱ�䣺2013-11-17 | ���壺�� �� С��
[����]ntp���뻥�����ϵ�ʱ�ӱ���ͬ��,���ұ���Ҳ��һ̨NTP������,����Ϊ�����������ṩУ��ʱ������...�����޸����ɺ�����root�û���������ntpd����:service ntpd restart����...ÿ��ntpd����ʱ�����Զ����Ӹù��ʱ�׼ʱ��...
�ٶ�ʱ�ӷ�����IP��ַΪ��192.168.0.1
�����������ã�
1:/etc/ntp.conf�ļ�����Ϊ��
server 127.127.1.0 minpoll 4
fudge 127.127.1.0 stratum 1
restrict 127.0.0.1
restrict 192.168.0.0 mask 255.255.255.0 nomodify notrap
driftfile /var/lib/ntp/drift

2: /etc/ntp/ntpserversӦ�ÿ�
3: /etc/ntp/step-tickersӦ����Ϊ 127.127.1.0 
�����޸����ɺ�����root�û���������ntpd����:service ntpd restart����
�ͻ������ã�
1:/etc/ntp.conf�ļ�����Ϊ��
server 192.168.0.1
fudge 127.127.1.0 stratum 2
restrict 127.0.0.1
driftfile /var/lib/ntp/drift
restrict 192.168.0.1 mask 255.255.255.255
2. /etc/ntp/ntpservers �ļ������ÿ�
3. /etc/ntp/step-tickers�ļ�������Ϊʱ�ӷ�����IP��ַ 192.168.0.1
�����޸����ɺ�����root�û���������ntpd����:service ntpd restart����
�û����������������������鿴ntpd����״̬��
1 ntpq -p
2 ntpstat

linux��ntpd��װ���ñʼ�
����: ntp���뻥�����ϵ�ʱ�ӱ���ͬ��,���ұ���Ҳ��һ̨NTP������,����Ϊ�����������ṩУ��ʱ������
��װ: redhat�Դ�
�����ļ�: /etc/ntp.conf
��:�ҵ������ļ�
#restrict default ignore
restrict 127.0.0.1
restrict 192.168.3.20
restrict 192.168.0.0 mask 255.255.255.0
restrict 192.168.2.0 mask 255.255.255.0
restrict 192.168.4.0 mask 255.255.255.0
server 210.72.145.44  prefer        #National Time Service Center
server 195.13.1.153
server 194.137.39.67
server  127.127.1.0      # local clock
restrict 210.72.145.44
restrict 195.13.1.153
restrict 194.137.39.67
driftfile /var/lib/ntp/drift
��:�������ò���˵��
#����restrictȨ�޿����﷨Ϊ��
#����restrict IP mask netmask_IP parameter
#�������� IP ������������ַ��Ҳ������ default ��default ������ 0.0.0.0 ����
#�������� paramter ����
#������ignore�����ر����е� NTP ��������
#������nomodify����ʾ Client �˲��ܸ��� Server �˵�ʱ��������������
#����������������Client ����Ȼ����͸�� Server ������������Уʱ��
#������notrust ���� Client ����ͨ����֤�������� Client ��Դ������Ϊ����������
#������noquery �����ṩ Client �˵�ʱ����ѯ
#�������� paramter ��ȫû���趨���Ǿͱ�ʾ�� IP (������) ��û���κ����ƣ���
#  ���趨�ϲ�������Ҫ�� server�����������趨���﷨Ϊ��
#����server [IP|FQDN] [prefer]
#����Server �����ӵľ��������ϲ� Time Server ���������� Server ����
#������������ perfer �Ļ����DZ�ʾ���ǵ� NTP ������Ҫ�Ըò���������Ϊ
#����ʱ��У���Ķ�Ӧ�����⣬Ϊ�˽�������ʱ�������Ĵ����ӳٶ�����



��FreeBSDʹ��ntpdͬ��ʱ��
��������֪��ntpd��һ���ں�̨���п���ʹ��Զ��ʱ���������Ľ��̣������������ķ�����ʱ��׼ȷ������Ӱ��ϵͳ��������
���������޸�/etc/rc.conf����ntpd_enable="YES"������һ�С�Ȼ��vi /etc/ntp.conf
���ӣ�
server 210.72.145.44 prefer
server 159.226.154.47
server 127.127.1.0
fudge 127.127.0.1 stratum 5
restrict default ignore
restrict 127.0.0.0 mask 255.0.0.0
restrict 192.168.0.0 mask 255.255.255.0 noquery nopeer notrust
restrict 210.72.145.44 noquery
restrict 159.226.154.47 noquery
driftfile /var/db/ntpd.drift
��������server 210.72.145.44 prefer��server 159.226.154.47��restrict 210.72.145.44 noquery��restrict 159.226.154.47 noquery���Ըij�����������������׼ȷ��ʱ����������
���������ڷ�����������ntpd���̾ͻ��Զ��ں�̨���У�����ϵͳͬ��ʱ�䣬����192.168.0������������һ̨ʱ����������


���ְ취
��һ�����Դ�ʱ��������time.nist.govͬ����
��crontab�м��룺
00 0 1 * * root rdate -s time.nist.gov
�ڶ����Լ�����ʱ��������<span id="more" -81"="">
1��. # rpm -ivh ntp-4.1.2-4.EL3.1.i386.rpm
2��. # vi /etc/ntp.conf
ע��һ��
restrict default ignore
����һ��
restrict 192.168.10.0 mask 255.255.255.0 notrust nomodify notrap
3��. # vi /etc/ntp/step-tickers
����һ��
pool.ntp.org
����ÿ��ntpd����ʱ�����Զ����Ӹù��ʱ�׼ʱ����������
4��. # service ntpd start
5��. # netstat -an |grep 123
ȷ���ö˿���udp��ʽ����
ʱ���ͻ�������(192.168.10.2)
1��. # ntpdate 192.168.10.1
Ӧ����ʾͬ���ɹ�
2��. # crond -e
����
0-59/10 * * * * /usr/sbin/ntpdate 192.168.10.1
��ʾÿ��10����ͬ��һ��ʱ��
  • ת����ע����Դ��ITѧϰ�� ��ַ��http://www.t086.com/ �����������Ƽ�������
  • �ر������� ��վ�������ر�������ֹת�ص�ר�������������¿�������ת�أ���������ע��������ԭʼ���ߡ����°�Ȩ������ԭʼ�������С����ڱ���վת�����µĸ��˺���վ�����DZ�ʾ������л�⡣������վת�ص������а�Ȩ��������ϵ���ǣ����ǻᾡ�����Ը�����
  • ��
  • ��
  • ��
  • ��
  • ��
  • ��
  • ��
  • ��
  • ��
������ѯ Health Check Gulangyu
© 2017 T086ѧϰ�� - T086.com(ԭitlearner.com)
RunTime:7.31ms QueryTime:7