NTP的服务配置总结
2013-12-26 00:39
309 查看
NTP:时间同步服务 基于服务器/客户端模式
1.server: ip地址:192.168.10.254/242.client: ip地址:192.168.10.10/243.实验的目的:客户端的时间有时候会不准,每回都需要管理员手动的区更新时间,非常的繁琐,不便 于管理,但是局域网中的一台叫server的服务器的时间是准确的。因此我们想要局域网中的这台主机能够自动的在时间不准的情况下能同步这台服务器上的时间,那么如何实现呢?4.实验具体的做法: 1.使用ntp这个服务:首先NTP默认情况下在Linux中是开启的,也就是它默认情况下是在后台运行的。所以不需要安装ntp软件包。2.对ntp的配置文件进行修改:/etc/ntpd.conf 3.vim /etc/ntp.conf restrict default kod nomodify notrap nopeer noqueryrestrict 192.168.10.0 mask 255.255.255.0 nomodify notrap 关键的一行server192.168.146.225
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
第一行restrict、default定义默认访问规则,nomodify禁止远程主机修改本地服务器置,notrap拒绝 特殊的ntpdq捕获消息,noquery拒绝btodq/ntpdc查询(这里的查询是服务器本身状态查询)。 restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
这句是手动增加的,意思是从192.168.1.1-192.168.1.254的服务器都可以使用我们的NTP服务器来同步时间。server 192.168.146.225
这句也是手动增加的,指明局域网中作为NTP服务器的IP;配置文件的最后两行作用是当服务器与公用的时间服务器失去联系时以本地时间为客户端提供时间服务。
端口
ntp使用udp协议,记得开放其123端口。
启动NTPD为了使NTP服务可以在系统引导的时候自动启动,执行:
#chkconfig ntpd on
启动ntpd:
service ntpd start注意:ntpd启动后,客户机要等几分钟再与其进行时间同步,否则会提示“no server suitable for synchronization found”错误。
client需要做的事情: 1.确保能与服务器连同 2.确保ntp的服务是开启的 3.同步时间:ntpdate 192.168.10.254(服务器ip地址错误提示:zhe NTP socket is use,exting; 解析:这句话的意识就是说,当前系统中已经存在ntp运行了。解决方法:暂停ntp服务,然后重新开启即可1 service ntpd stop service ntpd restart2.如果不行的话就用绝对路径:/etc/rc.d、init.d/ntpd stop 然后再重新开启NTP服务即可。
estrict 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.1.0 mask 255.255.255.0 nomodify notrap
server 192.168.146.225
server 0.centos.pool.ntp.org server 1.centos.pool.ntp.org server 2.centos.pool.ntp.org
server 127.127.1.0 # local clock fudge 127.127.1.0 stratum 10estrict 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.1.0 mask 255.255.255.0 nomodify notrap
server 192.168.146.225
server 0.centos.pool.ntp.org server 1.centos.pool.ntp.org server 2.centos.pool.ntp.org
server 127.127.1.0 # local clock fudge 127.127.1添加一行:
1.server: ip地址:192.168.10.254/242.client: ip地址:192.168.10.10/243.实验的目的:客户端的时间有时候会不准,每回都需要管理员手动的区更新时间,非常的繁琐,不便 于管理,但是局域网中的一台叫server的服务器的时间是准确的。因此我们想要局域网中的这台主机能够自动的在时间不准的情况下能同步这台服务器上的时间,那么如何实现呢?4.实验具体的做法: 1.使用ntp这个服务:首先NTP默认情况下在Linux中是开启的,也就是它默认情况下是在后台运行的。所以不需要安装ntp软件包。2.对ntp的配置文件进行修改:/etc/ntpd.conf 3.vim /etc/ntp.conf restrict default kod nomodify notrap nopeer noqueryrestrict 192.168.10.0 mask 255.255.255.0 nomodify notrap 关键的一行server192.168.146.225
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
第一行restrict、default定义默认访问规则,nomodify禁止远程主机修改本地服务器置,notrap拒绝 特殊的ntpdq捕获消息,noquery拒绝btodq/ntpdc查询(这里的查询是服务器本身状态查询)。 restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
这句是手动增加的,意思是从192.168.1.1-192.168.1.254的服务器都可以使用我们的NTP服务器来同步时间。server 192.168.146.225
这句也是手动增加的,指明局域网中作为NTP服务器的IP;配置文件的最后两行作用是当服务器与公用的时间服务器失去联系时以本地时间为客户端提供时间服务。
端口
ntp使用udp协议,记得开放其123端口。
启动NTPD为了使NTP服务可以在系统引导的时候自动启动,执行:
#chkconfig ntpd on
启动ntpd:
service ntpd start注意:ntpd启动后,客户机要等几分钟再与其进行时间同步,否则会提示“no server suitable for synchronization found”错误。
client需要做的事情: 1.确保能与服务器连同 2.确保ntp的服务是开启的 3.同步时间:ntpdate 192.168.10.254(服务器ip地址错误提示:zhe NTP socket is use,exting; 解析:这句话的意识就是说,当前系统中已经存在ntp运行了。解决方法:暂停ntp服务,然后重新开启即可1 service ntpd stop service ntpd restart2.如果不行的话就用绝对路径:/etc/rc.d、init.d/ntpd stop 然后再重新开启NTP服务即可。
estrict 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.1.0 mask 255.255.255.0 nomodify notrap
server 192.168.146.225
server 0.centos.pool.ntp.org server 1.centos.pool.ntp.org server 2.centos.pool.ntp.org
server 127.127.1.0 # local clock fudge 127.127.1.0 stratum 10estrict 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.1.0 mask 255.255.255.0 nomodify notrap
server 192.168.146.225
server 0.centos.pool.ntp.org server 1.centos.pool.ntp.org server 2.centos.pool.ntp.org
server 127.127.1.0 # local clock fudge 127.127.1添加一行:
相关文章推荐
- 配置DNS服务-要点总结
- 总结之:CentOS 6.5 HTTPD服务的全面解读及配置详解(2) 推荐
- Linux的NTP配置总结
- linux时间同步ntp服务的安装与配置
- NFS网络文件共享服务的配置和排错总结
- Linux NTP服务配置
- 总结之:CentOS6.5 DNS服务BIND配置、正反向解析、主从及压力测试(3) 推荐
- 在电脑中配置NTP服务
- 配置NTP服务
- 北京Linux系统入门学习: NTP服务配置详解
- Linux NTP服务配置 for Oracle RAC
- Linux总结笔记6-配置Samba服务实现Linux和Windows之间文件共享
- 演示:理解并配置不同权限的用户、设置时间(NTP服务)
- datenode节点超时时间设置,Hadoop启动不正常,HDFS冗余数据块的自动删除,NameNode安全模式问题,ntp时间服务同步,机架感知配置
- linux下的ntp服务简单配置过程
- Linux NTP服务总结
- CISCO设备配置NTP服务
- 配置ntp服务
- 自动化服务配置管理平台之-Ansible总结
- w32Time服务(NTP)的一些配置