NTP & Timezones
Epoch date
http://www.cyberciti.biz/faq/convert-epoch-seconds-to-the-current-time-date/
$ date -d @1412124403
Wed Oct 1 02:46:43 SAST 2014
Timezone on Debian
dpkg-reconfigure tzdata
ntpdate clock.redhat.com
cat /etc/timezone
ntpdate clock.redhat.com
date
TimeZone on RHEL
To see your current TZ
# cat /etc/sysconfig/clock
# vi /etc/sysconfig/clock
Change "Europe/London" to "Africa/Johannesburg"
(create a symbolic link)
# ln -sf /usr/share/zoneinfo/Africa/Johannesburg /etc/localtime
# lah /etc/localtime
# date
NTP
http://www.go2linux.org/how-to-set-the-date-and-time-in-linux
Set up an NTP server to be queried by LAN make sure ntpd is installed and set to start at boot in /etc/ntp.conf, set restrict 172.21.42.0 mask 255.255.255.0 nomodify notrap
Test by using ntpdate serveraddress Insert into cronjobs on server
ntpdate -u clock.redhat.com into /etc/cron.hourly/ntp on client(s)
ntpdate -s serveraddress (the -s will log to messages) in hourly cron
Troubleshooting
Check to see if there is a firewall or routing rule maybe blocking the sync:
[root@monitor ~]# telnet 0.pool.ntp.org 123
Trying 196.25.1.1... telnet: connect to address 196.25.1.1: Connection refused Check to see if the system is syncing - here is one that is not!
[root@monitor ~]# ntpq -p remote refid st t when poll reach delay offset jitter ============================================================================== sabela.saix.net .INIT. 16 u - 64 0 0.000 0.000 0.001 igubu.saix.net .RMOT. 16 u - 64 0 0.000 0.000 0.001 LOCAL(0) .LOCL. 10 l - 64 0 0.000 0.000 0.001 Here is a good server: T imezone & NT P [root@mailg8-1 ~]# ntpdate -u 0.pool.ntp.org 15 Jan 09:50:58 ntpdate[20839]: step time server 196.43.1.9 offset -101.421874 sec and a bad one... [root@monitor ~]# ntpdate 0.pool.ntp.org ch15 Jan 10:49:23 ntpdate[27052]: no server suitable for synchronization found