Since Techfeng has blocked most of the NTP Server for security reason, we need to choose appropriate NTP Server.
At present, the useable NTP Server is only provided by Google, which address is time1-4.google.com
- CentOS/RedHat:
yum install -y ntpdate
ntpdate time1.google.com
- Permanently(CentOS 6/RedHat 6/Debian/Ubuntu):
1. install the "ntp" via package manger
2. edit "/etc/ntp.conf"
3. replace the "0-3.centos.pool.ntp.org" or other NTP server with "time1-4.google.com" line by line.
4. enable the autostart for ntpd (CentOS 6/RedHat 6: chkconfig ntpd on; service ntpd start
Debian/Ubuntu: systemctl enable ntpd; systemctl restart ntpd
)
- Permanently(CentOS 7/RedHat 7):
1. edit "/etc/chrony.conf"
2. replace the "0-3.centos.pool.ntp.org" or other NTP server with "time1-4.google.com" line by line.
3. exec the command "systemctl enable chronyd; systemctl restart chronyd; chronyc sources -v
" to check sync status.
4. reboot the OS and check again with "date -R
"
PS. If your server is allocated with IPv6 but it's unusable, please change to IPv4 prefer (add or modify /etc/gai.conf to uncomment the line "precedence ::ffff:0:0/96 100").
- Debian/Ubuntu:
apt-get update
apt-get install ntpdate
systemctl disable ntp.service
systemctl stop ntp.service
ntpdate time1.google.com
Then we has finished time synchronization.