Category - LINUX

Creating NTP Server for Oracle RAC Setup on VrtualBox

NTP (Network Time Protocol) server Setup on Virtual-Box for Oracle RAC database

NTP servers are required to Synch Time between server and Clients.
We will be configuring NTP Server and NTP Client with below setup

NTP SERVER 
OEL 7 Installed in Virtual-Box
ntpsource.ace2oracle.lab
192.168.56.201

NTP Client 1 
Oracle RAC server OEL7- Node 1 –Installed on VirtualBox
racnoden1.ace2oracle.lab
IP 192.168.56.101

NTP Client 2
Oracle RAC server OEL7- Node 2 –Installed on VirtualBox
racnoden2.ace2oracle.lab
IP 192.168.56.102

Prerequisites

=> Check Firewall Status b/w Server and Client .It should be off

systemctl stop firewalld.service
systemctl disable firewalld.service

[root@ntpsource named]# systemctl stop firewalld
[root@ntpsource named]# firewall-cmd --state
not running
[root@ntpsource named]#
[root@ntpsource named]#
[root@ntpsource named]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)

Jun 06 05:54:29 ntpsource.ace2oracle.lab systemd[1]: Starting firewalld - dynamic firewall daemon...
Jun 06 05:54:30 ntpsource.ace2oracle.lab systemd[1]: Started firewalld - dynamic firewall daemon.
Jun 06 05:54:30 ntpsource.ace2oracle.lab firewalld[801]: WARNING: AllowZoneDrifting is enabled.
This is considered an insecure configuration option. It will be removed in a future release....ling it now.
Jun 06 06:05:23 ntpsource.ace2oracle.lab systemd[1]: Stopping firewalld - dynamic firewall daemon...
Jun 06 06:05:24 ntpsource.ace2oracle.lab systemd[1]: Stopped firewalld - dynamic firewall daemon.
Hint: Some lines were ellipsized, use -l to show in full.
[root@ntpsource named]#

=> Check nslookup of NTP server .It should be resolved from NTP Client

[root@ntpsource named]# nslookup 192.168.56.201
201.56.168.192.in-addr.arpa    name = ntpsource.ace2oracle.lab.

[root@ntpsource named]# nslookup ntpsource.ace2oracle.lab
Server:        192.168.56.200
Address:    192.168.56.200#53

Name:    ntpsource.ace2oracle.lab
Address: 192.168.56.201

[root@ntpsource named]#

=> Consistent Internet Connection Required to Synch with  X.distribution_name.pool.ntp.org

Ping google to verify

ping www.google.com
PING www.google.com (172.217.166.228) 56(84) bytes of data.
64 bytes from del03s14-in-f4.1e100.net (172.217.166.228): icmp_seq=1 ttl=119 time=12.4 m

Installing and Configuring NTP SERVER

=> Install NTP rpm on Server

[ntp_user@ntpsource ~]$ su -
Password:
Last login: Mon Jun  6 05:55:51 EDT 2022 on pts/0
[root@ntpsource ~]#  yum install ntp

[root@ntpsource ntp]# rpm -aq |grep ntp
ntp-4.2.6p5-29.0.1.el7_8.2.x86_64

=> Start ntp service

[root@ntpsource ~]# service ntpd start
Redirecting to /bin/systemctl start ntpd.service

=> Configure for Autostart
[root@ntpsource ~]# chkconfig ntpd on
Note: Forwarding request to 'systemctl enable ntpd.service'.
Created symlink from /etc/systemd/system/multi-user.target.wants/ntpd.service to /usr/lib/systemd/system/ntpd.service.

=> Restart Ntp service
[root@ntpsource ~]# service ntpd restart
Redirecting to /bin/systemctl restart ntpd.service
[root@ntpsource ~]#

=> Configure NTP-pool details in /etc/ntp.conf file  –For India (Modify as below)
[root@ntpsource ~]#
[root@ntpsource ~]# cp /etc/ntp.conf /etc/ntp.conf_06-June-2022

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 0.in.pool.ntp.org iburst

=> Modify below lines in file  to restrict use of NTP server
# Hosts on local network are less restricted.
restrict 192.168.56.0 mask 255.255.255.0 nomodify notrap


=> NTPD should be running on NTP server

[root@ntpsource ~]# systemctl status ntpd
 ntpd.service - Network Time Service
   Loaded: loaded (/usr/lib/systemd/system/ntpd.service; disabled; vendor preset: disabled)
   Active: active (running) since Sat 2022-06-11 00:28:12 IST; 2s ago
  Process: 4154 ExecStart=/usr/sbin/ntpd -u ntp:ntp $OPTIONS (code=exited, status=0/SUCCESS)
Main PID: 4156 (ntpd)
   CGroup: /system.slice/ntpd.service
           └─4156 /usr/sbin/ntpd -u ntp:ntp -g

Jun 11 00:28:12 ntpsource.ace2oracle.lab ntpd[4156]: Listen normally on 3 enp0s3 192.168.56.201 UDP 123
Jun 11 00:28:12 ntpsource.ace2oracle.lab ntpd[4156]: Listen normally on 4 enp0s8 192.168.1.40 UDP 123
Jun 11 00:28:12 ntpsource.ace2oracle.lab ntpd[4156]: Listen normally on 5 lo ::1 UDP 123
Jun 11 00:28:12 ntpsource.ace2oracle.lab ntpd[4156]: Listen normally on 6 enp0s3 fe80::42ff:bb94:5bf1:5b5a UDP 123
Jun 11 00:28:12 ntpsource.ace2oracle.lab ntpd[4156]: Listen normally on 7 enp0s8 fe80::233b:d5a2:a7ca:e073 UDP 123
Jun 11 00:28:12 ntpsource.ace2oracle.lab ntpd[4156]: Listen normally on 8 enp0s8 2402:e280:231a:63c:6046:b33f:90f7:6c15 UDP 123
Jun 11 00:28:12 ntpsource.ace2oracle.lab ntpd[4156]: Listening on routing socket on fd #25 for interface updates
Jun 11 00:28:13 ntpsource.ace2oracle.lab ntpd[4156]: 0.0.0.0 c016 06 restart
Jun 11 00:28:13 ntpsource.ace2oracle.lab ntpd[4156]: 0.0.0.0 c012 02 freq_set kernel 0.000 PPM
Jun 11 00:28:13 ntpsource.ace2oracle.lab ntpd[4156]: 0.0.0.0 c011 01 freq_not_set
[root@ntpsource ~]#
[root@ntpsource ~]# 

=> Check Sych status on NTP SERVER as below
[ntp_user@ntpsource ~]$ ntpstat
synchronised to NTP server (143.244.134.227) at stratum 4
   time correct to within 100 ms
   polling server every 64 s
[ntp_user@ntpsource ~]$ 

=> Check DATE on NTP server using date command

[ntp_user@ntpsource ~]$ date
Mon Jun  6 08:01:08 EDT 2022
[ntp_user@ntpsource ~]$ 

Installing and Configuring NTP Client (racnoden1.ace2oracle.lab)

Install ntp rpm on client machine

[root@racnoden1 ~]# yum install ntp
Installed:
  ntp.x86_64 0:4.2.6p5-29.0.5.el7_8.2
....
Complete!
[root@racnoden1 ~]#

Configure /etc/ntp.conf on NTP Client Machine

Modify below line in file /etc/ntp.conf as per screenshot.

server ntpsource.ace2oracle.lab prefer iburst




Restart NTP

[root@racnoden1 ~]# service ntpd restart
Redirecting to /bin/systemctl restart ntpd.service
[root@racnoden1 ~]#
[root@racnoden1 ~]# service ntpd status
Redirecting to /bin/systemctl status ntpd.service
ntpd.service - Network Time Service
   Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2022-06-11 00:23:01 IST; 3s ago
...
[root@racnoden1 ~]# 

Auto Restart Configuration

[root@racnoden1 ~]# chkconfig ntpd on
Note: Forwarding request to 'systemctl enable ntpd.service'.
[root@racnoden1 ~]# 

Check NTP Synch status as ntpstat command

[root@racnoden1 ~]# service ntpd restart
Redirecting to /bin/systemctl restart ntpd.service
[root@racnoden1 ~]# 

[root@racnoden1 ~]# ntpstat
synchronised to NTP server (192.168.56.201) at stratum 4
   time correct to within 1419 ms
   polling server every 64 s
[root@racnoden1 ~]# 

Verify NTP server details as below

[root@racnoden1 ~]# ntpdate -q ntpsource.ace2oracle.lab
server 192.168.56.201, stratum 3, offset 0.292766, delay 0.02591
11 Jun 00:36:39 ntpdate[30039]: adjust time server 192.168.56.201 offset 0.292766 sec
[root@racnoden1 ~]#
[root@racnoden1 ~]# 

Specific Setting for ORACLE RAC related to NTP

As we are using RAC Setup so we have to amend below file and take start of NTP service.
Add OPTIONS="-x -u ntp:ntp -p /var/run/ntpd.pid" in /etc/sysconfig/ntpd

[root@racnoden1 ~]# cat /etc/sysconfig/ntpd
# Command line options for ntpd
OPTIONS="-g"
OPTIONS="-x -u ntp:ntp -p /var/run/ntpd.pid"
[root@racnoden1 ~]# 

Restart NTP

[root@ace2oraclen1 ~]# service ntpd restart
Redirecting to /bin/systemctl restart ntpd.service

We need to configure same steps on NODE-2 NTP Client as well.