NTP时间同步服务器搭建
轉載:http://blog.s135.com/post/281/
?
一、搭建時間同步服務器
1、編譯安裝ntp?server
cd?ntp-4.2.6
./configure --prefix=/usr/local/ntp?--enable-all-clocks --enable-parse-clocks
make && make install
注:如以上下載地址無法訪問,請從ntp官方下載網頁(http://www.ntp.org/downloads.html)尋找下載地址。
?
2、修改ntp.conf配置文件
vi /etc/ntp.conf
①、第一種配置:允許任何IP的客戶機都可以進行時間同步
將“restrict default kod nomodify notrap nopeer noquery”這行修改成:
restrict default nomodify
配置文件示例:/etc/ntp.conf
?
②、第二種配置:只允許192.168.18.***網段的客戶機進行時間同步
在restrict default nomodify notrap noquery(表示默認拒絕所有IP的時間同步)之后增加一行:
restrict 192.168.18.0 mask 255.255.255.0 nomodify
配置文件示例:/etc/ntp.conf
?
3、以守護進程啟動ntpd
/usr/local/ntp/bin/ntpd -c /etc/ntp.conf -p /tmp/ntpd.pid
4、ntpd啟動后,客戶機要等幾分鐘再與其進行時間同步,否則會提示“no server suitable for synchronization found”錯誤。
?
二、配置時間同步客戶機
vi /var/spool/cron/root
增加一行,在每天的5點13分、9點13分、14點13分、19點13分與時間同步服務器進行同步
13 5,9,14,19 * * * /usr/sbin/ntpdate 192.168.18.2
備注:如果客戶機沒有ntpdate,可以下載ntpdate.tar.gz到/usr/sbin/目錄,然后解壓:
轉載于:https://www.cnblogs.com/hangshi/p/3677903.html
總結
以上是生活随笔為你收集整理的NTP时间同步服务器搭建的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 办健康证要多少钱啊?
- 下一篇: 一个好的便携式挖树机要多少钱?