diff --git a/sources/tech/RHCE/Part 10 - Setting Up 'NTP (Network Time Protocol) Server' in RHEL or CentOS 7.md b/sources/tech/RHCE/Part 10 - Setting Up 'NTP (Network Time Protocol) Server' in RHEL or CentOS 7.md deleted file mode 100644 index b7c268f14b..0000000000 --- a/sources/tech/RHCE/Part 10 - Setting Up 'NTP (Network Time Protocol) Server' in RHEL or CentOS 7.md +++ /dev/null @@ -1,131 +0,0 @@ -ictlyh Translating -Part 10: Setting Up “NTP (Network Time Protocol) Server” in RHEL/CentOS 7 -================================================================================ -Network Time Protocol – NTP- is a protocol which runs over port 123 UDP at Transport Layer and allows computers to synchronize time over networks for an accurate time. While time is passing by, computers internal clocks tend to drift which can lead to inconsistent time issues, especially on servers and clients logs files or if you want to replicate servers resources or databases. - -![NTP Server Install in CentOS](http://www.tecmint.com/wp-content/uploads/2014/09/NTP-Server-Install-in-CentOS.png) - -NTP Server Installation in CentOS and RHEL 7 - -#### Requirements: #### - -- [CentOS 7 Installation Procedure][1] -- [RHEL 7 Installation Procedure][2] - -#### Additional Requirements: #### - -- [Register and Enbale RHEL 7 Subscription for Updates][3] -- [Configure Static IP Address on CentOS/Rhel 7][4] -- [Disable and Remove Unwanted Services in CentOS/RHEL 7][5] - -This tutorial will demonstrate how you can install and configure NTP server on CentOS/RHEL 7 and automatically synchronize time with the closest geographically peers available for your server location by using NTP Public Pool Time Servers list. - -#### Step 1: Install and configure NTP daemon #### - -1. NTP server package is provided by default from official CentOS /RHEL 7 repositories and can be installed by issuing the following command. - - # yum install ntp - -![Install NTP in CentOS](http://www.tecmint.com/wp-content/uploads/2014/09/Install-NTP-in-CentOS.png) - -Install NTP Server - -2. After the server is installed, first go to official [NTP Public Pool Time Servers][6], choose your Continent area where the server physically is located, then search for your Country location and a list of NTP servers should appear. - -![NTP Pool Server](http://www.tecmint.com/wp-content/uploads/2014/09/NTP-Pool-Server.png) - -NTP Pool Server - -3. Then open NTP daemon main configuration file for editing, comment the default list of Public Servers from pool.ntp.org project and replace it with the list provided for your country like in the screenshot below. - -![Configure NTP Server in CentOS](http://www.tecmint.com/wp-content/uploads/2014/09/Configure-NTP-Server.png) - -Configure NTP Server - -4. Further, you need to allow clients from your networks to synchronize time with this server. To accomplish this, add the following line to NTP configuration file, where restrict statement controls, what network is allowed to query and sync time – replace network IPs accordingly. - - restrict 192.168.1.0 netmask 255.255.255.0 nomodify notrap - -The nomodify notrap statements suggest that your clients are not allowed to configure the server or be used as peers for time sync. - -5. If you need additional information for troubleshooting in case there are problems with your NTP daemon add a log file statement which will record all NTP server issues into one dedicated log file. - - logfile /var/log/ntp.log - -![Enable NTP Logs in CentOS](http://www.tecmint.com/wp-content/uploads/2014/09/Enable-NTP-Log.png) - -Enable NTP Logs - -6. After you have edited the file with all configuration explained above save and close ntp.conf file. Your final configuration should look like in the screenshot below. - -![NTP Server Configuration in CentOS](http://www.tecmint.com/wp-content/uploads/2014/09/NTP-Server-Configuration.png) - -NTP Server Configuration - -### Step 2: Add Firewall Rules and Start NTP Daemon ### - -7. NTP service uses UDP port 123 on OSI transport layer (layer 4). It is designed particularly to resist the effects of variable latency (jitter). To open this port on RHEL/CentOS 7 run the following commands against Firewalld service. - - # firewall-cmd --add-service=ntp --permanent - # firewall-cmd --reload - -![Open NTP Port in Firewall](http://www.tecmint.com/wp-content/uploads/2014/09/Open-NTP-Port.png) - -Open NTP Port in Firewall - -8. After you have opened Firewall port 123, start NTP server and make sure you enable it system-wide. Use the following commands to manage the service. - - # systemctl start ntpd - # systemctl enable ntpd - # systemctl status ntpd - -![Start NTP Service](http://www.tecmint.com/wp-content/uploads/2014/09/Start-NTP-Service.png) - -Start NTP Service - -### Step 3: Verify Server Time Sync ### - -9. After NTP daemon has been started, wait a few minutes for the server to synchronize time with its pool list servers, then run the following commands to verify NTP peers synchronization status and your system time. - - # ntpq -p - # date -R - -![Verify NTP Server Time](http://www.tecmint.com/wp-content/uploads/2014/09/Verify-NTP-Time-Sync.png) - -Verify NTP Time Sync - -10. If you want to query and synchronize against a pool of your choice use ntpdate command, followed by the server or servers addresses, as suggested in the following command line example. - - # ntpdate -q 0.ro.pool.ntp.org 1.ro.pool.ntp.org - -![Synchronize NTP Time](http://www.tecmint.com/wp-content/uploads/2014/09/Synchronize-NTP-Time.png) - -Synchronize NTP Time - -### Step 4: Setup Windows NTP Client ### - -11. If your windows machine is not a part of a Domain Controller you can configure Windows to synchronize time with your NTP server by going to Time from the right side of Taskbar -> Change Date and Time Settings -> Internet Time tab -> Change Settings -> Check Synchronize with an Internet time server -> put your server’s IP or FQDN on Server filed -> Update now -> OK. - -![Synchronize Windows Time with NTP](http://www.tecmint.com/wp-content/uploads/2014/09/Synchronize-Windows-Time-with-NTP.png) - -Synchronize Windows Time with NTP - -That’s all! Setting up a local NTP Server on your network ensures that all your servers and clients have the same time set in case of an Internet connectivity failure and they all are synchronized with each other. - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/install-ntp-server-in-centos/ - -作者:[Matei Cezar][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/cezarmatei/ -[1]:http://www.tecmint.com/centos-7-installation/ -[2]:http://www.tecmint.com/redhat-enterprise-linux-7-installation/ -[3]:http://www.tecmint.com/enable-redhat-subscription-reposiories-and-updates-for-rhel-7/ -[4]:http://www.tecmint.com/configure-network-interface-in-rhel-centos-7-0/ -[5]:http://www.tecmint.com/remove-unwanted-services-in-centos-7/ -[6]:http://www.pool.ntp.org/en/ \ No newline at end of file diff --git a/translated/tech/RHCE/Part 10 - Setting Up 'NTP (Network Time Protocol) Server' in RHEL or CentOS 7.md b/translated/tech/RHCE/Part 10 - Setting Up 'NTP (Network Time Protocol) Server' in RHEL or CentOS 7.md new file mode 100644 index 0000000000..54c4330ae2 --- /dev/null +++ b/translated/tech/RHCE/Part 10 - Setting Up 'NTP (Network Time Protocol) Server' in RHEL or CentOS 7.md @@ -0,0 +1,130 @@ +第 10 部分:在 RHEL/CentOS 7 中设置 “NTP(网络时间协议) 服务器” +================================================================================ +网络时间协议 - NTP - 是运行在传输层 123 号端口允许计算机通过网络同步准确时间的协议。随着时间的流逝,计算机内部时间会出现漂移,这会导致时间不一致问题,尤其是对于服务器和客户端日志文件,或者你想要备份服务器资源或数据库。 + +![在 CentOS 上安装 NTP 服务器](http://www.tecmint.com/wp-content/uploads/2014/09/NTP-Server-Install-in-CentOS.png) + +在 CentOS 和 RHEL 7 上安装 NTP 服务器 + +#### 要求: #### + +- [CentOS 7 安装过程][1] +- [RHEL 安装过程][2] + +#### 额外要求: #### + +- [注册并启用 RHEL 7 更新订阅][3] +- [在 CentOS/RHCE 7 上配置静态 IP][4] +- [在 CentOS/RHEL 7 上停用并移除不需要的服务][5] + +这篇指南会告诉你如何在 CentOS/RHCE 7 上安装和配置 NTP 服务器,并使用 NTP 公共时间服务器池列表中和你服务器地理位置最近的可用节点中同步时间。 + +#### 步骤一:安装和配置 NTP 守护进程 #### + +1. 官方 CentOS /RHEL 7 库默认提供 NTP 服务器安装包,可以通过使用下面的命令安装。 + + # yum install ntp + +![在 CentOS 上安装 NTP 服务器](http://www.tecmint.com/wp-content/uploads/2014/09/Install-NTP-in-CentOS.png) + +安装 NTP 服务器 + +2. 安装完服务器之后,首先到官方 [NTP 公共时间服务器池][6],选择你服务器物理位置所在的洲,然后搜索你的国家位置,然后会出现 NTP 服务器列表。 + +![NTP 服务器池](http://www.tecmint.com/wp-content/uploads/2014/09/NTP-Pool-Server.png) + +NTP 服务器池 + +3. 然后打开编辑 NTP 守护进程主要配置文件,从 pool.ntp.org 中注释掉默认的公共服务器列表并用类似下面截图提供给你国家的列表替换。 + +![在 CentOS 中配置 NTP 服务器](http://www.tecmint.com/wp-content/uploads/2014/09/Configure-NTP-Server.png) + +配置 NTP 服务器 + +4. 下一步,你需要允许客户端从你的网络中和这台服务器同步时间。为了做到这点,添加下面一行到 NTP 配置文件,其中限制语句控制允许哪些网络查询和同步时间 - 根据需要替换网络 IP。 + + restrict 192.168.1.0 netmask 255.255.255.0 nomodify notrap + +nomodify notrap 语句意味着不允许你的客户端配置服务器或者作为同步时间的节点。 + +5. 如果你需要额外的信息用于错误处理,以防你的 NTP 守护进程出现问题,添加一个 logfile 语句,用于记录所有 NTP 服务器问题到一个指定的日志文件。 + + logfile /var/log/ntp.log + +![在 CentOS 中启用 NTP 日志](http://www.tecmint.com/wp-content/uploads/2014/09/Enable-NTP-Log.png) + +启用 NTP 日志 + +6. 你编辑完所有上面解释的配置并保存关闭 ntp.conf 文件后,你最终的配置看起来像下面的截图。 + +![CentOS 中 NTP 服务器的配置](http://www.tecmint.com/wp-content/uploads/2014/09/NTP-Server-Configuration.png) + +NTP 服务器配置 + +### 步骤二:添加防火墙规则并启动 NTP 守护进程 ### + +7. NTP 服务在传输层(第四层)使用 123 号 UDP 端口。它是针对限制可变延迟的影响特别设计的。要在 RHEL/CentOS 7 中开放这个端口,可以对 Firewalld 服务使用下面的命令。 + + # firewall-cmd --add-service=ntp --permanent + # firewall-cmd --reload + +![在 Firewall 中开放 NTP 端口](http://www.tecmint.com/wp-content/uploads/2014/09/Open-NTP-Port.png) + +在 Firewall 中开放 NTP 端口 + +8. 你在防火墙中开放了 123 号端口之后,启动 NTP 服务器并确保系统范围内可用。用下面的命令管理服务。 + + # systemctl start ntpd + # systemctl enable ntpd + # systemctl status ntpd + +![启动 NTP 服务](http://www.tecmint.com/wp-content/uploads/2014/09/Start-NTP-Service.png) + +启动 NTP 服务 + +### 步骤三:验证服务器时间同步 ### + +9. 启动了 NTP 守护进程后,用几分钟等服务器和它的服务器池列表同步时间,然后运行下面的命令验证 NTP 节点同步状态和你的系统时间。 + + # ntpq -p + # date -R + +![验证 NTP 服务器时间](http://www.tecmint.com/wp-content/uploads/2014/09/Verify-NTP-Time-Sync.png) + +验证 NTP 时间同步 + +10. 如果你想查询或者和你选择的服务器池同步,你可以使用 ntpdate 命令,后面跟服务器名或服务器地址,类似下面建议的命令行事例。 + + # ntpdate -q 0.ro.pool.ntp.org 1.ro.pool.ntp.org + +![同步 NTP 同步](http://www.tecmint.com/wp-content/uploads/2014/09/Synchronize-NTP-Time.png) + +同步 NTP 时间 + +### 步骤四:设置 Windows NTP 客户端 ### + +11. 如果你的 windows 机器不是域名控制器的一部分,你可以配置 Windows 和你的 NTP服务器同步时间。在任务栏右边 -> 时间 -> 更改日期和时间设置 -> 网络时间标签 -> 更改设置 -> 和一个网络时间服务器检查同步 -> 在 Server 空格输入服务器 IP 或 FQDN -> 马上更新 -> OK。 + +![和 NTP 同步 Windows 时间](http://www.tecmint.com/wp-content/uploads/2014/09/Synchronize-Windows-Time-with-NTP.png) + +和 NTP 同步 Windows 时间 + +就是这些。在你的网络中配置一个本地 NTP 服务器能确保你所有的服务器和客户端有相同的时间设置,以防出现网络连接失败,并且它们彼此都相互同步。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/install-ntp-server-in-centos/ + +作者:[Matei Cezar][a] +译者:[ictlyh](http://motouxiaogui.cn/blog) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/cezarmatei/ +[1]:http://www.tecmint.com/centos-7-installation/ +[2]:http://www.tecmint.com/redhat-enterprise-linux-7-installation/ +[3]:http://www.tecmint.com/enable-redhat-subscription-reposiories-and-updates-for-rhel-7/ +[4]:http://www.tecmint.com/configure-network-interface-in-rhel-centos-7-0/ +[5]:http://www.tecmint.com/remove-unwanted-services-in-centos-7/ +[6]:http://www.pool.ntp.org/en/ \ No newline at end of file