wiki:centos_ntp_server
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
wiki:centos_ntp_server [2019/10/04 13:51] – walkeradmin | wiki:centos_ntp_server [2023/03/09 22:35] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 17: | Line 17: | ||
\\ | \\ | ||
In this example, I have three CentOS systems, and the first will be the NTP server, with the second two being NTP clients. I did this for a <color # | In this example, I have three CentOS systems, and the first will be the NTP server, with the second two being NTP clients. I did this for a <color # | ||
+ | \\ | ||
+ | \\ | ||
+ | If you have installed the OS from a MediKind .ISO (as opposed to using the CentOS minimal .ISO) then you will have to do the following: | ||
+ | < | ||
+ | 1. Create the CentOS-Base.repo in / | ||
+ | 2. Ensure you have access to the internet | ||
+ | 3. Ensure DNS is running (or you won't connect to any repos) | ||
+ | |||
+ | You will still have to perform steps 2 and 3 if you used the CentOS Minimal install. | ||
+ | </ | ||
\\ | \\ | ||
\\ | \\ | ||
Line 22: | Line 32: | ||
---- | ---- | ||
+ | If the OS was installed using a MediKind .iso, you may have to remove ChronyD: | ||
+ | |||
+ | systemctl stop chronyd | ||
+ | systemctl disable chronyd | ||
+ | |||
+ | Now install NTP: | ||
+ | |||
+ | yum install ntp | ||
+ | |||
+ | The NTP settings will have to be modified, you will need to edit the following file. | ||
+ | |||
+ | vim / | ||
+ | | ||
+ | Find the list of public servers: | ||
+ | < | ||
+ | # Use public servers from the pool.ntp.org project. | ||
+ | # Please consider joining the pool (http:// | ||
+ | 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 | ||
+ | </ | ||
+ | \\ | ||
+ | When the OS was installed, if hte correct regional settings were selected, this ntp list will be fine. You can find local servers to you using the url https:// | ||
+ | \\ | ||
+ | \\ | ||
+ | You can restrict the range of IPs that can ask for NTP services by using the following: | ||
+ | < | ||
+ | # Hosts on local network are less restricted. | ||
+ | restrict 10.43.30.0 mask 255.255.255.0 nomodify notrap | ||
+ | |||
+ | This will restrict NTP services to IP Addresses in the 10.43.30.x range | ||
+ | </ | ||
+ | Ensure that CentOS is using the correct timezone: | ||
+ | < | ||
+ | cd /etc | ||
+ | rm localtime | ||
+ | ls / | ||
+ | ln -s / | ||
+ | </ | ||
+ | Finally start and enable NTP services. | ||
+ | \\ | ||
+ | < | ||
+ | systemctl start ntpd | ||
+ | systemctl enable ntpd | ||
+ | </ | ||
+ | At this point, the server should have the correct time (if using UTC, depending on the time of year it could look 1 hour off). If the time is way out, ensure you have internet access, that the firewall is not blocking NTP and that your timezone is correct. | ||
+ | \\ | ||
+ | \\ | ||
+ | ==== NTP Clients ==== | ||
+ | |||
+ | ---- | ||
+ | If the OS was installed using a MediKind .iso, you may have to remove ChronyD: | ||
+ | |||
+ | systemctl stop chronyd | ||
+ | systemctl disable chronyd | ||
+ | |||
+ | Now install NTP: | ||
+ | |||
+ | yum install ntp | ||
+ | |||
+ | The NTP settings will have to be modified, you will need to edit the following file. | ||
+ | |||
+ | vim / | ||
+ | | ||
+ | Find the list of public servers: | ||
+ | < | ||
+ | # Use public servers from the pool.ntp.org project. | ||
+ | # Please consider joining the pool (http:// | ||
+ | server 10.43.30.11 iburst | ||
+ | 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 | ||
+ | </ | ||
+ | In the server list, we have added the following line, as the first server in the list: | ||
+ | \\ | ||
+ | server 10.43.30.11 iburst - This is the IP Address of the NTP server we previously configured. | ||
+ | \\ | ||
+ | When the OS was installed, if the correct regional settings were selected, this NTP list will be fine. You can find local servers to you using the url https:// | ||
+ | \\ | ||
+ | \\ | ||
+ | Ensure that CentOS is using the correct timezone: | ||
+ | < | ||
+ | cd /etc | ||
+ | rm localtime | ||
+ | ls / | ||
+ | ln -s / | ||
+ | </ | ||
+ | Finally start and enable NTP services. | ||
+ | \\ | ||
+ | < | ||
+ | systemctl start ntpd | ||
+ | systemctl enable ntpd | ||
+ | </ | ||
+ | Use the command line ' | ||
+ | \\ | ||
+ | < | ||
+ | # date | ||
+ | Fri Oct 4 13:45:46 UTC 2019 | ||
+ | </ | ||
+ | \\ | ||
+ | \\ | ||
wiki/centos_ntp_server.1570193489.txt.gz · Last modified: 2023/03/09 22:35 (external edit)