Configuring the Oracle Cloud
Infrastructure NTPServer for an Instance
Oracle Cloud Infrastructure offers a fully managed, secure, and highly available NTP server that
you can use to set the date and time of your Compute and Database instances from within your
virtual cloud network (VCN). This topic describes how to configure Compute instances to use
thisNTP server.
You can also choose to configure your instance to use a public NTP server or use FastConnectto
leverage an on-premises NTP server.
Oracle Linux 6.x
Use the following steps to configure your Oracle Linux 6.x instances to use the Oracle Cloud
Infrastructure NTP server.
1. Configure IPtables to allow connections to the Oracle Cloud Infrastructure NTP server, using the
following commands:
sudo iptables -I BareMetalInstanceServices 8 -d 169.254.169.254/32 -p
udp -m udp --dport 123 -m comment --comment "Allow access to OCI local
NTP service" -j ACCEPT
sudo service iptables save
2. Install the NTP service with the following command:
sudo yum install ntp
3. Set the date of your instance with the following command:
sudo ntpdate 169.254.169.254
4. Configure the instance to use the Oracle Cloud Infrastructure NTP server for iburst. To configure,
modify the /etc/ntp.conf file as follows:
a. In the server section, comment out the lines specifying the RHEL servers:
b. #server 0.rhel.pool.ntp.org iburst
c. #server 1.rhel.pool.ntp.org iburst
d. #server 2.rhel.pool.ntp.org iburst
#server 3.rhel.pool.ntp.org iburst
b. Add an entry for the Oracle Cloud Infrastructure NTP server:
server 169.254.169.254 iburst
5. The modified server section now contains the following:
6. # Please consider joining the pool (http://www.pool.ntp.org/join.html).
7. #server 0.rhel.pool.ntp.org iburst
8. #server 1.rhel.pool.ntp.org iburst
9. #server 2.rhel.pool.ntp.org iburst
10. #server 3.rhel.pool.ntp.org iburst
11. server 169.254.169.254 iburst
5. Set the NTP service to launch automatically when the instance boots with the following
command:
sudo chkconfig ntpd on
6. Start the NTP service with the following command:
sudo /etc/init.d/ntpd start
7. Confirm that the NTP service is configured correctly with the following command:
ntpq -p
The output will be similar to the following:
remote refid st t when poll reach delay offset
jitter
======================================================================
========
169.254.169.254 192.168.32.3 2 u 2 64 1 0.338 0.278
0.187
Oracle Linux 7.x
Use the following steps to configure your Oracle Linux 7.x instances to use the Oracle Cloud
Infrastructure NTP server.
1. Run commands in this section as root with the following command:
sudo su -
2. Install the NTP service with the following command:
yum -y install ntp
3. Change the firewall rules to allow inbound and outbound traffic with the Oracle Cloud
Infrastructure NTP server, at 169.254.169.254, on UDP port 123 with the following command:
awk -v n=13 -v s=' <passthrough ipv="ipv4">-A OUTPUT -d
169.254.169.254/32 -p udp -m udp --dport 123 -m comment --comment
"Allow access to OCI local NTP service" -j ACCEPT </passthrough>' 'NR
== n {print s} {print}' /etc/firewalld/direct.xml > tmp && mv tmp
/etc/firewalld/direct.xml
At the prompt:
mv: overwrite ‘/etc/firewalld/direct.xml’?
enter y
4. Restart the firewall with the following command:
service firewalld restart
5. Set the date of your instance with the following command:
ntpdate 169.254.169.254
6. Configure the instance to use the Oracle Cloud Infrastructure NTP server for iburst. To configure,
modify the /etc/ntp.conf file as follows:
a. In the server section comment out the lines specifying the RHEL servers:
b. #server 0.rhel.pool.ntp.org iburst
c. #server 1.rhel.pool.ntp.org iburst
d. #server 2.rhel.pool.ntp.org iburst
#server 3.rhel.pool.ntp.org iburst
b. Add an entry for the Oracle Cloud Infrastructure NTP server:
server 169.254.169.254 iburst
7. The modified server section should now contain the following:
8. # Please consider joining the pool (http://www.pool.ntp.org/join.html).
9. #server 0.rhel.pool.ntp.org iburst
10. #server 1.rhel.pool.ntp.org iburst
11. #server 2.rhel.pool.ntp.org iburst
12. #server 3.rhel.pool.ntp.org iburst
13. server 169.254.169.254 iburst
7. Start and enable the NTP service with the following commands:
8. systemctl start ntpd
systemctl enable ntpd
You also need disable the chrony NTP client to ensure that the NTP service starts automatically
after a reboot, using the following commands:
systemctl stop chronyd
systemctl disable chronyd
8. Confirm that the NTP service is configured correctly with the following command:
ntpq -p
The output will be similar to the following:
remote refid st t when poll reach delay offset
jitter
======================================================================
========
169.254.169.254 192.168.32.3 2 u 2 64 1 0.338 0.278
0.187