Thứ Tư, 23 tháng 2, 2022

NTP Config - Cấu hình đồng bộ thời gian (network time protocol)


Mục đích: Để đồng bộ thời gian giữa các máy chủ trong cùng một mạng LAN (Ví dụ như khi cài Oracle RAC cũng yêu cầu 2 node phải đồng bộ thời gian), ta có thể dựng một máy chủ làm NTP Server. NTP server có thể chạy trên cùng máy chủ ứng dụng khác.
- Giao thức đồng bộ: NTP
- Port: TCP/UDP - 123
I. AIX
NTP Server:
- Add server to /etc/ntp.conf
root@ntpserver# vi /etc/ntp.conf
# commented out broadcast client
# Broadcast client
# Add
server 127.127.1.0

- Restart service:
root@ntpserver# stopsrc -s xntpd
root@ntpserver# startsrc -s xntpd
NOTE: If the server runs databases, use the -x flag to prevent the clock from changing in a negative direction. Enter the following:
root@ntpserver# startsrc -s xntpd -a "-x"

- Verify that you have a suitable NTP server. Enter:
root@ntpserver# lssrc -ls xntpd
NOTE: Sys peer should be 127.127.1.0.

NTP Client
Verify that you have a server suitable for synchronization. Enter:
root@ntpclient# ntpdate -d ip.address.of.server
The offset must be less than 1000 seconds for xntpd to synch. If the offset is greater than 1000 seconds, change the time manually on the client and run the ntpdate -d again.
If you get the message, "no server suitable for synchronization found", verify xntpd is running on the server (see above) and that no firewalls are blocking port 123.
Specify your xntp server in /etc/ntp.conf, enter:
root@ntpclient# vi /etc/ntp.conf
(Comment out the "broadcastclient" line and add server ip.address.of.server prefer.)
Leave the driftfile and tracefile at their defaults.
Start the xntpd daemon:
root@ntpclient# startsrc -s xntpd
(Use the -x flag if it is appropriate for your environment.)
Uncomment xntpd from /etc/rc.tcpip so it will start on a reboot.
root@ntpclient# vi /etc/rc.tcpip
Uncomment the following line:
start /usr/sbin/xntpd "$src_running"
If using the -x flag, add "-x" to the end of the line. You must include the quotes around the -x.
Verify that the client is synched.
root@ntpclient# lssrc -ls xntpd
NOTE: Sys peer should display the IP address or name of your xntp server. This process may take up to 12 minutes.

II. Centos:
NTP Server:
- Install ntp package:
root@ntpserver# yum -y install ntp

- Edit ntp.conf file:
root@ntpserver# vi /etc/ntp.conf
# line 19: add the network range you allow to receive requests:
restrict 10.0.0.0 mask 255.255.255.0 nomodify notrap
# remove online server
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
# Add local server for synchronization
server 127.127.1.0
fudge 127.127.1.0 stratum 10
tracefile /etc/ntp.trace

- Start ntp service:
root@ntpserver# /etc/rc.d/init.d/ntpd start
Starting ntpd:                                             [  OK  ]
root@ntpserver# chkconfig ntp on

- Check service:
root@ntpserver# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
=====================================================
*LOCAL(0)        .LOCL.          10 l   29   64   17    0.000    0.000   0.000

NTP Client:
- Install ntp package:
root@ntpclient# yum -y install ntp

- Edit ntp.conf file:
root@ntpclient# vi /etc/ntp.conf
# remove online server
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
# Add local server
server 10.0.0.2
tracefile /etc/ntp.trace

- Start ntp service:
root@ntpclient# /etc/rc.d/init.d/ntpd start
Starting ntpd:                                             [  OK  ]
root@ntpclient# chkconfig ntp on

- Check service:
root@ntpclient# ntpq -p

III. Solaris 11
NTP Server:
- Install ntp package
root@ntpserver# pkg install ntp

- Create ntp.conf file
root@ntpserver# cd /etc/inetd
root@ntpserver# cp ntp.server ntp.conf
root@ntpserver# chmod 744 ntp.conf

- Edit ntp.conf file
root@ntpserver# vi ntp.conf
# add the network range you allow to receive requests:
restrict 10.0.0.0 mask 255.255.255.0 nomodify notrap
# Add Local server for synchronization
server 127.127.1.0
fudge 127.127.1.0 stratum 10
tracefile /etc/ntp.trace

- Start service:
root@ntpserver# svcadm enable ntp

- Check service:

root@ntpserver# ntpq -p
 remote           refid      st t when poll reach   delay   offset  jitter
====================================================

*LOCAL(0)        .LOCL.          10 l   24   64  377    0.000    0.000   0.000

NTP Client:
- Install ntp package
root@ntpclient# pkg install ntp

- Create ntp.conf file
root@ntpclient# cd /etc/inetd
root@ntpclient# cp ntp.client ntp.conf
root@ntpclient# chmod 744 ntp.conf

- Edit ntp.conf file
root@ntpclient# vi ntp.conf
# Add local server
server 10.0.0.2
tracefile /etc/ntp.trace

- Start service:
root@ntpclientsvcadm enable ntp

- Check service:

root@ntpclient# ntpq -p
=============================
* KHOÁ HỌC ORACLE DATABASE A-Z ENTERPRISE trực tiếp từ tôi giúp bạn bước đầu trở thành những chuyên gia DBA, đủ kinh nghiệm đi thi chứng chỉ OA/OCP, đặc biệt là rất nhiều kinh nghiệm, bí kíp thực chiến trên các hệ thống Core tại VN chỉ sau 1 khoá học.
* CÁCH ĐĂNG KÝ: Gõ (.) hoặc để lại số điện thoại hoặc inbox https://m.me/tranvanbinh.vn hoặc Hotline/Zalo 090.29.12.888
* Chi tiết tham khảo:
https://bit.ly/oaz_w
=============================
KẾT NỐI VỚI CHUYÊN GIA TRẦN VĂN BÌNH:
📧 Mail: binhoracle@gmail.com
☎️ Mobile: 0902912888
⚡️ Skype: tranbinh48ca
👨 Facebook: https://www.facebook.com/BinhOracleMaster
👨 Inbox Messenger: https://m.me/101036604657441 (profile)
👨 Fanpage: https://www.facebook.com/tranvanbinh.vn
👨 Inbox Fanpage: https://m.me/tranvanbinh.vn
👨👩 Group FB: https://www.facebook.com/groups/DBAVietNam
👨 Website: https://www.tranvanbinh.vn
👨 Blogger: https://tranvanbinhmaster.blogspot.com
🎬 Youtube: http://bit.ly/ytb_binhoraclemaster
👨 Tiktok: https://www.tiktok.com/@binhoraclemaster?lang=vi
👨 Linkin: https://www.linkedin.com/in/binhoracle
👨 Twitter: https://twitter.com/binhoracle
👨 Địa chỉ: Tòa nhà Sun Square - 21 Lê Đức Thọ - Phường Mỹ Đình 1 - Quận Nam Từ Liêm - TP.Hà Nội

=============================
học oracle database, Tự học Oracle, Tài liệu Oracle 12c tiếng Việt, Hướng dẫn sử dụng Oracle Database, Oracle SQL cơ bản, Oracle SQL là gì, Khóa học Oracle Hà Nội, Học chứng chỉ Oracle ở đầu, Khóa học Oracle online,khóa học pl/sql, học dba, học dba ở việt nam, khóa học dba, khóa học dba sql, tài liệu học dba oracle, Khóa học Oracle online, học oracle sql, học oracle ở đâu tphcm, học oracle bắt đầu từ đâu, học oracle ở hà nội, oracle database tutorial, oracle database 12c, oracle database là gì, oracle database 11g, oracle download, oracle database 19c, oracle dba tutorial, oracle tunning, sql tunning , oracle 12c, oracle multitenant, Container Databases (CDB), Pluggable Databases (PDB), oracle cloud, oracle security, oracle fga, audit_trail, oracle dataguard, oracle goldengate, mview, oracle exadata, oracle oca, oracle ocp, oracle ocm , oracle weblogic, middleware, hoc solaris, hoc linux, hoc aix, unix, securecrt, xshell, mobaxterm, putty

ĐỌC NHIỀU

Trần Văn Bình - Oracle Database Master