CentOS Build NTP server

Source: Internet
Author: User

Environment:

1. NTP server: ip:192.168.4.197

2. NTP Client: ip:192.168.4.196

My Server System version 6.7 (service side) and 6.4


Installation:

1, after the new server set up the network,/etc/sysconfig/network-scripts/network card location in this directory. The name of the general network adapter is Ifcfg-eth0 (now the default name of the CENTOS7 later version of the NIC has been changed)

The NIC configuration information is as follows:

Device=eth0

Hwaddr=xx:xx:xx:xx:xx:xx #mac地址

Type=ethernet #网卡类型

uuid=dca6a6d8-0136-205ae2bf7262

Onboot=yes #开机启动

Nm_controlled=yes

Bootproto=static #静态IP

ipaddr=192.168.4.196 #IP

netmask=255.255.255.0 #子网掩码

gateway=192.168.4.254 #网关

dns=8.8.8.8 #dns


There's a place here that needs to be specifically explained, DNS. You may have configured the DNS information here, and you also restarted the Network Service, service network Restart but you ping www.google.com prompt unknow host www.google.com. You may need to modify this file vi/etc/resolv.conf

Write in File:

NameServer 8.8.8.8

So your network should be all right.

After the network configuration is complete, start installing the NTP service

Yum-y Install NTP ntpdate

To modify a configuration file:

Make a backup first:

Cp/etc/ntp.conf/etc/ntp.conf.bak

Then modify:

Vi/etc/ntp.conf

What this file needs to be modified:

Find the following two lines, this default is only allow native query, you can add these two lines # comment out


Restrict 127.0.0.1

Restrict-6:: 1

Then add the following so that the meaning is to allow 1.0 network segments to check the checksum time, but not to modify the parameters of the server, and do not provide trap time login.

Restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap


There is also an upstream time server information, you can change according to their own needs can be changed. Of course, the premise is to be able to access the upstream time server.

Server 0.centos.pool.ntp.org Iburst

Server 1.centos.pool.ntp.org Iburst

Server 2.centos.pool.ntp.org Iburst

Server 3.centos.pool.ntp.org Iburst


The installation configuration is complete and the NTP service is started.

Service NTPD Start

You can also daemon boot ntpd

/ETC/INIT.D/NTPD start


Client Configuration

Yum-y Install NTP

Configure periodic synchronization

Crontab-e

Add a row to synchronize with the time synchronization server at 6 points per day

* * * * */usr/sbin/ntpdate ntp-server IP >>/usr/local/logs/crontab/ntpdate.log


Attention:

NTP Server listening port is UDP 123, then need to open the local firewall to run Client Access 123 port,

Vi/etc/sysconfig/iptables

Add the following rules:

-A input-m state--state new-m udp-p UDP--dport 123-j ACCEPT

Of course you can also shut down the firewall directly.

This configuration is complete, and you can use the following command on the client

Ntpdate Time server IP address #ntpdate 192.168.4.197

APR 10:44:05 ntpdate[2245]: Adjust time server 192.168.4.197 offset 0.133572 sec


This article is from the "very strong ant" blog, make sure to keep this source http://leozhang2016.blog.51cto.com/9419901/1763693

CentOS Build NTP server

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.