centos7: 搭建ntp时钟服务器

骑猪看日落 2022-05-15 10:28 350阅读 0赞
  1. ntp-server:
  2. $ sudo yum install ntp
  3. $ cat /etc/ntp.conf
  4. # For more information about this file, see the man pages
  5. # ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).
  6. driftfile /var/lib/ntp/drift
  7. # Permit time synchronization with our time source, but do not
  8. # permit the source to query or modify the service on this system.
  9. restrict default nomodify notrap nopeer noquery
  10. # Permit all access over the loopback interface. This could
  11. # be tightened as well, but to do so would effect some of
  12. # the administrative functions.
  13. restrict 127.0.0.1
  14. restrict ::1
  15. # Hosts on local network are less restricted.
  16. #restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
  17. restrict 20.20.20.0 mask 255.255.255.0 nomodify notrap
  18. server 20.20.20.21
  19. # Use public servers from the pool.ntp.org project.
  20. # Please consider joining the pool (http://www.pool.ntp.org/join.html).
  21. server 0.cn.pool.ntp.org
  22. server 1.cn.pool.ntp.org
  23. server 2.cn.pool.ntp.org
  24. server 3.cn.pool.ntp.org
  25. #broadcast 192.168.1.255 autokey # broadcast server
  26. #broadcastclient # broadcast client
  27. #broadcast 224.0.1.1 autokey # multicast server
  28. #multicastclient 224.0.1.1 # multicast client
  29. #manycastserver 239.255.254.254 # manycast server
  30. #manycastclient 239.255.254.254 autokey # manycast client
  31. # Enable public key cryptography.
  32. #crypto
  33. includefile /etc/ntp/crypto/pw
  34. # Key file containing the keys and key identifiers used when operating
  35. # with symmetric key cryptography.
  36. keys /etc/ntp/keys
  37. # Specify the key identifiers which are trusted.
  38. #trustedkey 4 8 42
  39. # Specify the key identifier to use with the ntpdc utility.
  40. #requestkey 8
  41. # Specify the key identifier to use with the ntpq utility.
  42. #controlkey 8
  43. # Enable writing of statistics records.
  44. #statistics clockstats cryptostats loopstats peerstats
  45. # Disable the monitoring facility to prevent amplification attacks using ntpdc
  46. # monlist command when default restrict does not include the noquery flag. See
  47. # CVE-2013-5211 for more details.
  48. # Note: Monitoring will not be disabled with the limited restriction flag.
  49. disable monitor
  50. $ sudo systemctl start ntpd
  51. $ date
  52. ntp-client:
  53. $ sudo ntpdate ntp-server-ip
  54. $ date

参考文档:https://blog.csdn.net/qq_34889607/article/details/81503730

发表评论

表情:
评论列表 (有 0 条评论,350人围观)

还没有评论,来说两句吧...

相关阅读

    相关 ubuntuNTP服务器

    由于公司架构需求部分服务器走内部网络,这部分服务器均无外部网络,导致存在一个问题就是时间无法进行同步,于是网上找了下资料可以通过搭建ntp服务器来解决这问题,也相对简单,废话少