CentOS7 NTP server + keepalived

NTP安装

yum -y install ntp

systemctl enable ntpd

首先同步一次时间

ntpdate time.windows.com

ntp配置(Host1 Host2)

/etc/ntp.conf

server time.windows.com prefer
server 0.asia.pool.ntp.org
server 1.asia.pool.ntp.org
server 2.asia.pool.ntp.org

#记录上次的NTP server与上层NTP server连接接所花费的时间
driftfile /var/lib/ntp/drift

#设置默认策略为允许任何主机进行时间同步
restrict 0.0.0.0 mask 0.0.0.0 nomodify

#设置ntp日志的path
statsdir /var/log/ntp/

#设置ntp日志文件
logfile /var/log/ntp/ntp.log

mkdir /var/log/ntp/; touch /var/log/ntp/ntp.log; chown ntp:ntp /var/log/ntp/ntp.log

systemctl start ntpd

Keepalived安装

yum -y install Keepalived

host1配置

/etc/keepalived/keepalived.conf

global_defs {
        notification_email {
                [email protected]
        }

        notification_email_from [email protected]
        smtp_server 127.0.0.1
        smtp_connect_timeout 30
        router_id LVS_DEVEL
}

vrrp_instance VI_1 {
        state MASTER        ############ MASTER/BACKUP
        interface eno16777984
        virtual_router_id 51
        mcast_src_ip 172.16.0.2
        priority 150                  ########### MASTER权值要比BACKUP高
        advert_int 1

        authentication {
                auth_type PASS
                auth_pass GSksLAyTX9ylwG86U2Ez
        }

        virtual_ipaddress {
                172.16.0.10
        }

}

Host2配置

global_defs {
        notification_email {
                [email protected]
        }

        notification_email_from [email protected]
        smtp_server 127.0.0.1
        smtp_connect_timeout 30
        router_id LVS_DEVEL
}

vrrp_instance VI_1 {
        state BACKUP        ############ MASTER/BACKUP
        interface eno16777984
        virtual_router_id 51
        mcast_src_ip 172.16.0.3
        priority 150                  ########### MASTER权值要比BACKUP高
        advert_int 1

        authentication {
                auth_type PASS
                auth_pass GSksLAyTX9ylwG86U2Ez
        }

        virtual_ipaddress {
                172.16.0.10
        }

}

systemctl enable keepalived

systemctl start keepalived

1 windows客户端向NTP每10分钟同步一次时间

gpedit.msc打开组策略

1.1 启动windows NTP客户端

1.2 配置windows NTP客户端

1.3 Internet时间设置里指定时间服务器

点击立即更新

2 linux客户端向NTP每10分钟同步一次时间

2.1 安装NTP

yum -y install ntp

2.2 设置时间同步

执行下面的命令

echo -e "\n\n## sync time\n*/10 * * **    root    ntpdate 172.16.0.10 && hwclock-w" >> /etc/crontab

时间: 2024-12-19 07:43:23

CentOS7 NTP server + keepalived的相关文章

centos7 ntp server & samba

最近公司内部一个需求:必须 Linux建个 ntp server ,并且 Windows可以net time \\ip 访问. 摸索之后,开工: ########### ntp server ip a     # 本机IP 192.168.52.5 yum install -y ntp # 安装服务 ntpdate cn.pool.ntp.org # 先同步一次公网 # 参考:https://www.cnblogs.com/harrymore/p/9566229.htmlvim /etc/ntp

centos7 NTP server

NTP是网络时间协议(Network Time Protocol),它是用来同步网络中各个计算机的时间的协议 安装ntp包 yum install -y ntp 修改NTP的配置文件 vim /etc/ntp.conf driftfile /var/lib/ntp/drift   //服务器系统时间与上级服务器时间的偏差值记录 restrict default kod nomodify notrap nopeer noquery restrict 127.0.0.1  //允许本服务器一切的操作

CentOS7 搭建LVS+keepalived负载均衡

CentOS7 搭建LVS+keepalived负载均衡(一) 本文中只涉及一台负载均衡服务器,和两台真实服务器,主要是初步体验负载均衡:实际的环境中,lvs和keepalived一起用才是黄金搭档,下篇将继续讲述lvs+keepalived的搭建过程 一.本次搭建的系统架构图- 虚拟机:VirtualBox- virtaulbox host-only的IP地址:192.168.137.1- 所用系统:CentOS7- 真实web服务器(RS1):192.168.137.5- 真实web服务器(

Linu NTP Server

Linux NTP SERVER INSTALL 1.安装 yum install ntp -y 2.配置 grep -Ev '^$|^#' /etc/ntp.conf restrict default kod nomodify notrap nopeer noquery restrict -6 default kod nomodify notrap nopeer noquery restrict 131.107.13.100 //允许该NTP服务器进入 restrict 114.80.81.1

linux ntp server

UTC:协调世界时(英:Coordinated Universal Time ,法:Temps Universel Coordonné),又称世界统一时间,世界标准时间,国际协调时间.英文(CUT)和法文(TUC)的缩写不同,作为妥协,简称UTC.协调世界时是以原子时秒长为基础,在时刻上尽量接近于世界时的一种时间计量系统. NTP :network time protocol 软件时钟,1970/1/1 0:0:0 计算的总秒数 硬件时钟,bios时间 server主机的port  : UDP

【AD】【Server2008R2】 PDC NTP Client/NTP Server的设置 ...

上家公司有碰到过PDC主机时间异常导致客户端时间异常的问题,当时没有解决.最近正好看到,就想试试能否解决一下. 论坛搜索了,照着帖子中的都测试了,没有成功.网上也搜了很久,最后一篇文章给了我不少启发. http://gnaw0725.blog.51cto.com/156601/660266下面的内容是我经过反反复复的测试后得出的结论.与上述链接中的内容并不完全一致.有条件的你可以在虚拟机中测试,相信我的测试不会让你失望. 帖子中会反复出现的命令: w32tm 这个命令需要开启"Windows T

浅谈ntp server搭建

ntp时间服务器采用stratum分级架构来处理时间同步:举例说明:你搭建了一台ntp服务器,然后同步的server为stratum-1,你的ntp则为stratum-2,你的下级ntp则为tratum-3.依此类推,最多为15层. 1.ntp server安装: [[email protected] ~]# yum -y install ntp tzdata ntp相关文件说明: /etc/ntp.conf         #ntp server配置文件 /usr/sbin/ntpd     

ntp server 用法小结

今天公司要弄台NTP server作为同步时间用,故写一下用法小结 [[email protected] ~]# ntpq -p      remote           refid      st t when poll reach   delay   offset  jitter ==============================================================================*time2.isu.net.s .GPS.      

国内可用的NTP Server

NTP全称是Network Time Protocol,是用来让计算机之间实现时间同步的协议,而发布这种校对时间的服务器,就是NTP Server.一般来说客户端与服务器之间的时间误差在几十毫秒以内,当然,如果你的时间服务器在美国或者欧洲,误差可能稍大一些.在我们的日常生活中,能接触到NTP的也基本就是你的Windows系统和你的路由器系统,而且这两种系统对标准时间的精度要求不是很高,就算是不联网,不进行时间校正,只要大概精确到小时,是不会出现问题的. 国内的NTP Server基本都属于科研教