2013/07/24

Build NTP server on CentOS via yum

yum -y install ntp

mv /etc/ntp.conf /etc/ntp.conf.bak

vi /etc/ntp.conf

--past it
driftfile /var/lib/ntp/drift
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict -6 ::1
restrict 192.168.0.0 mask 255.255.255.0 nomodify
server tick.stdtime.gov.tw
server tock.stdtime.gov.tw
server time.stdtime.gov.tw
server clock.stdtime.gov.tw
server watch.stdtime.gov.tw
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
--


or edit

vi /etc/ntp.conf

####
#add
####

restrict 127.0.0.1
restrict -6 ::1
restrict 192.168.0.0 mask 255.255.255.0 nomodify

server tick.stdtime.gov.tw
server tock.stdtime.gov.tw
server time.stdtime.gov.tw
server clock.stdtime.gov.tw
server watch.stdtime.gov.tw

###
#qw
###

service ntp restart
chkconfig ntp on

##iptables
iptables -I INPUT -p udp --dport 123 -j ACCEPT
iptables -I OUTPUT -p udp --sport 123 -j ACCEPT

No comments: