NTP installation
Yum-y Install NTP
Systemctl Enable NTPD
Synchronize one time first
Ntpdate time.windows.com
NTP configuration (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
#Record the time it took for the last NTP server to connect to the upper NTP server
driftfile /var/lib/ntp/drift
#Set the default policy to allow any host to synchronize time
restrict 0.0.0.0 mask 0.0.0.0 nomodify
#Set the path of the ntp log
statsdir /var/log/ntp/
#Set ntp log file
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 Installation
Yum-y Install keepalived
HOST1 Configuration
/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 weight is higher than BACKUP
advert_int 1
authentication {
auth_type PASS
auth_pass GSksLAyTX9ylwG86U2Ez
}
virtual_ipaddress {
172.16.0.10
}
}
HOST2 Configuration
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 weight is higher than BACKUP
advert_int 1
authentication {
auth_type PASS
auth_pass GSksLAyTX9ylwG86U2Ez
}
virtual_ipaddress {
172.16.0.10
}
}
Systemctl Enable keepalived
Systemctl Start keepalived
1 windowsClient toNtpevery10minute synchronization Time
Gpedit.msc Open Group Policy
1.1StartWindows NTPClient
1.2ConfigurationWindows NTPClient
1.3 Internetspecify time server in time settings
Click Update Now
2 LinuxClient toNtpevery10minute synchronization Time2.1installationNtp
Yum-y Install NTP
2.2set up time synchronization
Execute the following command
Echo-e "\n\n## Sync TIME\N*/10 * * * * * root ntpdate 172.16.0.10 && hwclock-w" >>/etc/crontab
CentOS7 NTP Server + keepalived