Thursday, October 13, 2011

linux: setup ntp server

to setup an ntp server on your linux box
1. install ntp on box - i used rpm on my centos
2. edit /etc/ntp.conf to:
    a. comment restriction then allow network for client query
        #restrict default nomodify notrap
        restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

    b. setup source ntp server from which your ntp server will sync its time
        server 0.asia.pool.ntp.org

    my ntp.conf contains:
    restrict 127.0.0.1
    restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
    server 0.asia.pool.ntp.org
    server  127.127.1.0     # local clock
    fudge   127.127.1.0 stratum 10
    driftfile /var/lib/ntp/drift
    broadcastdelay  0.008
    keys            /etc/ntp/keys


3. add ntpd daemon for bootup
    chkconfig --add ntpd
4. unblock ntp udp 123 from your server firewall - i use iptables
    -A INPUT -m state --state NEW -m udp -p udp --dport 123 -j ACCEPT
5. test from a client pc - i use another linux box to test
    ntpdate <server ip>
    if you get "no server suitable for synchronization found" just wait for a couple of minutes before trying again

now, you try to stay on time o.O

No comments:

Post a Comment

SSH : No matching host key type found. Their offer: ssh-rsa,ssh-dss

Got this while connecting to my mikrotik router via ssh   Unable to negotiate with <ip address> port <ssh port>: no matching hos...