Introduction
In this blog will I show how to setup a NTP server and perform NTP synchronizing on remote server.
Server Installation
yum install ntp ntpdate -y
Server Configuration
vi /etc/ntp.conf
...
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
...
The server IP is 192.168.1.240 and is located in 192.168.1.0/24 subnet.
Server Firewall
vi /etc/sysconfig/iptables
...
-A INPUT -m state --state NEW -m udp -p udp --dport 123 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 123 -j ACCEPT
...
Server Start
service ntpd restart; chkconfig ntpd on
Client Installation
yum install ntp ntpdate -y
Client Start
service ntpd restart; chkconfig ntpd on
Client Test
Query your NTP server, but NOT set time. If query return higher stratum than 16, just wait a little and then requery.
$ ntpdate -q 192.168.1.240
server 192.168.1.240, stratum 3, offset -0.000189, delay 0.02585
12 Aug 16:43:45 ntpdate[1700]: adjust time server 192.168.1.240 offset -0.000189 sec
Client Set NTP Server
$ sudo vi /etc/ntp.conf
...
server 192.168.1.240
#server 0.rhel.pool.ntp.org iburst
#server 1.rhel.pool.ntp.org iburst
#server 2.rhel.pool.ntp.org iburst
#server 3.rhel.pool.ntp.org iburst
...
And finally you need to restart ntpd service.
No comments:
Post a Comment