Friday, November 30, 2012

How to configure the NTP in AIX and LINUX servers?

How to configure the NTP in AIX and LINUX ?

A) STEPS


 For RHEL pls follow the below steps:


1. stop the NTP service
#service ntpd stop

2. Make a copy of the file /etc/ntp.conf
#cp /etc/ntp.conf /etc/ntp.conf_bak

3. Edit the file /etc/ntp.conf with the following entries:
    server <IP_address of the NTP server>
server <IP_address of the NTP server>
        driftfile /var/lib/ntp/drift 

4. Create the /var/lib/ntp directory if it’s not exist and ensure /var/lib/ntp has correct ownership and      permissions
           #mkdir /var/lib/ntp
          ( dwxr-xr-x 2 ntp ntp 4096 Mar  2 11:09  )

5. Create the file /var/lib/ntp/drift with the following entry:
         0.0

6. After creating the drift file, ensure that it has the right ownership and permissions:
        -rw-r--r-- 1 ntp ntp 6 Mar  2 11:09 drift

7.  After restarting the ntpd service, ensure that spurious messages in the /var/log/messages file are no longer reported:
           can't open /etc/ntp.drift.TEMP: Permission denied

8. Bounce NTP service.
    # service ntpd restart 

9. Status checking
   # ntpq
   ntpq> peers

10. Make sure the ntp starts automatically start at the boot time 
   # chkconfig ntpd on 



For AIX please follow the below steps:


1. Stop the ntp services
#stopsrc –s xntpd

2. Sync the time with ntp, login as root, type
      #ntpdate  <ip_address of the NTP server>

3. Make a copy of the file /etc/ntp.conf
#cp /etc/ntp.conf /etc/ntp.conf_bak

4. Edit file /etc/ntp.conf and append
    server <ip_address of the NTP server>
    driftfile /var/lib/ntp/drift  
    tracefile /etc/ntp.trace

5. Create the /var/lib/ntp directory and ensure /var/lib/ntp has correct ownership and permissions
           #mkdir /var/lib/ntp
( dwxr-xr-x 2 ntp ntp 4096 Mar  2 11:09  )

6. Create the file /var/lib/ntp/drift with the following entry:
         0.0

7. After creating the drift file, ensure that it has the right ownership and permissions:
-rw-r--r-- 1 ntp ntp 6 Mar  2 11:09 drift  

8. Start the NTP sercice
#startsrc –s xntpd

9. Take backup and uncomment xntpd from /etc/rc.tcpip. so it will start on a reboot.
#cp –p /etc/rc.tcpip /etc/rc.tcpip_bak 
        #vi /etc/rc.tcpip
        Uncomment the following line
Start /usr/sbin/xntpd “$src-running”  

10. Verify that the server is synched.
       #lssrc -ls xntpd

B) VALIDATION:


ntpdate –q <ntpserver> should not show the time difference more than 1 sec.

C) ROLLBACK


Replace all the configuration files that you have modified with the backup copies taken at the time of implementation .