Public NTP servers on the Internet should already be configured to accept inbound NTP traffic. Normally by default all outbound traffic is allowed so this should not be a problem. Firewall Rulesīy default NTP uses UDP port 123, so if you are connecting over the Internet to an external NTP server ensure that outbound UDP 123 traffic is allowed out to the NTP server specified in your configuration. It is generally recommended that you synchronize with a time source higher in the hierarchy, for instance synchronizing time against a stratum 1 server will be considered more reliable than using a stratum 4 server. There are plenty of publicly available stratum 1 servers available on the Internet for use. Stratum 2 servers then get their time from the stratum 1 servers, while stratum 3 servers synchronize with stratum 2 sources.Įssentially stratum n+1 will synchronize against stratum n, the highest limit is 15, while 16 refers to a device that is not synchronized. Stratum 1 are the computers that synchronize with the stratum 0 sources, these are highly accurate NTP servers. Stratum 0 are the highly exact time sources such as atomic clocks or GPS clocks, these are our reference time devices. NTP servers work based on a layered hierarchy referred to as stratum, starting at stratum 0. The date command can be used to view system time, however in CentOS 7 this has generally been superseded by the timedatectl command, discussed later. The hwclock command can also be used to display the current time of the hardware clock as shown below. This configuration is defined by ‘rtcsync’ in /etc/nf
HOW TO CHANGE TIMEZONE LINUX CENTOS 7 UPDATE
In CentOS 7 by default chronyd will update the hardware clock with NTP every 11 minutes, in previous versions of the OS this was only done at shutdown/reboot. We can also reverse the process and synchronize the system clock to the hardware clock. We can manually synchronize the hardware clock to the system clock if required, this would generally only be required if there was no NTP server available. The system clock runs in the kernel and after getting its initial time from the hardware clock it will then synchronize with an NTP server to become up to date. As the Linux system boots up it will read time from the hardware clock, this initial time is then passed to the system clock. The hardware clock is physically present and continues to run from battery power even if the system is not plugged into a power source, this is how the time stays in place when there is no power available. Your Linux system will generally have two clocks, a hardware clock/real time clock (RTC) and a system clock. Understanding the Hardware and System Clocks
HOW TO CHANGE TIMEZONE LINUX CENTOS 7 HOW TO
Studying for your RHCE certification? Checkout our RHCE video course over at Udemy which is 20% off when you use the code ROOTUSER.īefore we get into the details on how to configure NTP here is some basic information on how NTP works. Here we are concerned with configuring NTP clients rather than an NTP server. In this version chronyd is installed by default, however we will still cover the older ntpd for completeness as this is still widely used. Note: These examples are based on the CentOS 7 operating system so steps may vary slightly for other Linux distributions. We only want to use one of these at a time however, having both running at once is not a good idea and may cause conflicts. Here we are going to cover how to configure chronyd or ntpd in Linux to connect to an NTP server and keep time in sync. It is therefore important to ensure that system time is synchronized with an external source so that it can be kept accurately up to date, this is done with the network time protocol (NTP). There are many different services such as Kerberos that depend on the time of a Linux system being accurate in order to function correctly.