首页 > 编程知识 正文

CentOS ntp log_deploy NTP time server under CentOS synchronize environment records

时间:2023-05-05 07:54:46 阅读:63818 作者:10

1) the server side deploys

and installs the required software packages

.

the

server side synchronizes the time manually once by itself.

54 ntpdate[10781]: the NTP socket is in use,

executing or online synchronization using aliyun's time server

root@Test~# ntpdate NTP2.aliyun.com

root@Test~#ntpdate ntp1.aliyun.com edit

the NTP master configuration file, add an NTP server (for servers in mainland China) and synchronize BIOS time.

For servers located in IDC rooms in mainland China, the default ntp server of CentOS/can not be accessed. Therefore, it is necessary to set up its own ntp server in mainland China;

for servers located in IDC rooms outside mainland China, it is possible to use the default ntp server of CentOS/(but be sure to check to ensure that it is accessible);

modify it as follows:

login root@Test~login # cp/etc/ntp.conf/etc/ntp.conf.bak

login root@Test~login # vim/etc/ntp.conf login

default nomodify notrap noquery

login login login login login login login login login login login login

127.0.0.1

login 192.168.0.0 mask 255.255.0.0 nomodify #only clients on the 192.168.0.0 segment are allowed to synchronize time. If clients of any IP are allowed to synchronize time, modify it to "restful default nomodify"

server ntp1.aliyun.com

server NTP2.aliyun.com

server time1.aliyun.com

server time2.aliyun.com

server time synchronization A.nist.gov

server time synchronization B.NIST. gov

server 127.127.1.0 # local clock

fudge 127.127.1.0 stratum 10

driftfile /var/lib/ntp/drift

broadcastdelay 0.008

keys /etc/ntp/keys

[root@test ~]# service ntpd start

Starting ntpd: [ OK ]

[root@test ~]# netstat -tulnp| grep ntp

udp 0 0 182.48.115.233: 123 0.0.0.0:* 10023/ntpd

udp 0 0 127.0.0.1: 123 0.0.0.0:* 10023/ntpd

udp 0 0 0.0.0.0: 123 0.0.0.0:* 10023/ntpd

udp 0 0 fe80::5054:ff:feab: db19:123 :::* 10023/ntpd

udp 0 0 ::1:123 :::* 10023/ntpd

udp 0 0 :::123 :::* 10023/ntpd

settings boot-up self-

boot root@Test~#/sbin/chkconfig level=2345 ntpd on

view existing connected clients

root@Test~#Watch ntpq p

you can set a time for regular online synchronization

root@Test~#crontab l

#server time synchronization

0 * **/usr/sbin/ntpdate ntp1.aliyun.com;/Sbin/hwclock w

2) client configuration (remember to turn off the ntpd service on the client machine, otherwise, when using nepdate, the error "ntpdate updated 14431 updated: the NTP socket is in use, exiting"; Or if the ntpd service is turned on, the error will not be reported by using ntpdate "u IP.") The

command line manually performs a verification on whether it is available:

verify root@Test2~verify #ntpdate 182.148.15.33 #182.148.15.33 is the ip address of the above ntp server

21 Jun 16:45:35 ntpdate[2323]: Adjust time server 182.148.15.33 offset 0.319548 sec

configurationautomatic synchronization

root@Test2~#crontab l

#server time synchronization

*/5 * * * */usr/sbin/ntpdate 182.148.15.33;/sbin/hwclock -w

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。