zoukankan      html  css  js  c++  java
  • NTP服务搭建

    1:实验环境

    前提条件:虚拟机环境,windows 客户端,关闭防火墙;linux 服务器关闭防火墙,关闭selinux。

    Cent OS :NTP服务器 IP: 192.168.80.134  /255.255.255.0

    windows 7 : 客户端   IP: 192.168.80.133  /255.255.255.0

    2:ntp服务安装

    ①一般自带有:

    1 [root@localhost ~]# rpm -qa | grep ntp
    2 ntp-4.2.6p5-1.el6.centos.x86_64
    3 fontpackages-filesystem-1.41-1.1.el6.noarch
    4 ntpdate-4.2.6p5-1.el6.centos.x86_64

    ②若没有,这安装

    ㈠rpm安装:

    rpm -ivh ntp-*.rpm

    卸载:

    rpm -e ntp-*.rpm

    ㈡yum安装

    yum -y install ntp.i*

    卸载:

    yum -y remove ntp.i*

    3:服务配置:

    ①: vi /etc/ntp.conf

    1 restrict 192.168.80.0 mask 255.255.255.0 nomodify notrap
    2 
    3 # Use public servers from the pool.ntp.org project.
    4 # Please consider joining the pool (http://www.pool.ntp.org/join.html).
    5 #server 0.centos.pool.ntp.org iburst
    6 #server 1.centos.pool.ntp.org iburst
    7 #server 2.centos.pool.ntp.org iburst
    8 #server 3.centos.pool.ntp.org iburst
    9 server  asia.pool.ntp.org
    1 /etc/rc.d/init.d/ntpd start
    1 chkconfig ntpd on 

    ②:更改时区:

     tzselect:

    执行tzselect命令-->选择Asia-->选择China-->选择east China - Beijing, Guangdong, Shanghai, etc-->然后输入1;

    执行TZ='Asia/Shanghai'; export TZ 并将这行命令添加到.profile中,然后退出并重新登录。

    参考:http://jingyan.baidu.com/article/fa4125acb7328628ac70920e.html

    ③手动更新:

    ntpdate asia.pool.ntp.org

    ④查看本机与上层ntp服务器同步情况:

    ntpq -p

    至此:ntp自身的时间同步正常,然后设置客户端

    ⑤更改windows 同步服务器的IP地址为搭建的ntp服务器IP,立即更新时间。

    最后:简单的搭建的NTP服务器,实现了基本的功能。

  • 相关阅读:
    STM32 USART整理说明(转)
    C++ 如何初始化静态类成员
    scp、sftp和ftps
    PostGIS介绍
    string.h和strings.h的区别
    linux编程中的段错误
    Linux中的man命令
    undefinded reference to 'pthread_create'问题
    多核编程框架
    与ComboBox有相似行为的下拉控件的实现
  • 原文地址:https://www.cnblogs.com/zker/p/4398642.html
Copyright © 2011-2022 走看看