Oracle linux server ��������� ntp

Linux NTP Configuration

This article provides an introduction to Network Time Protocol (NTP) configuration on Linux, with specific reference to the information needed for the RHCE EX300 certification exam.

Remember, the exams are hands-on, so it doesn’t matter which method you use to achieve the result, so long as the end product is correct.

Installation

The NTP service is installed from a Yum repository using the following command.

Turn on the NTP service and make sure it starts automatically on reboot.

The NTP service is configured using the «/etc/ntp.conf» file. Configuration changes have to be followed by a restart of the NTP service.

Firewall

There are no specific firewall settings necessary for NTP clients, since they are simply accessing the NTP server, but an NTP server must have the UDP port 123 open. This can be achieved by adding the following entry to the type of firewall script described here.

SELinux

There are no SELinux requirements for NTP.

Configure NTP Clients

Installing and starting the NTP service is enough to keep the system time synchronized provided the machine has access to the internet. By default, the «/etc/ntp.conf» file lists the following servers from the pool.ntp.org project.

If you prefer to use an NTP server on your local network, you can change these entries to point to the local server instead.

The optional «iburst» parameter tells the NTP service to speed up the initial time synchronization.

Remember to restart the service.

Configure NTP Servers

The setup of the NTP server is actually the same as the client. The NTP server should have access to some external NTP servers, for example the default servers from the pool.ntp.org project, to make sure it stays in sync. This means it needs access to the internet.

By default the NTP service only allows unrestricted access from «localhost». To allow other machines in the network to synchronize with this server you need to open up query access to your network. This is done by adding a «restrict» entry into the «/etc/ntp.conf» file. The file contains an example entry you can adjust to suit your requirements.

After restarting the NTP service, the server will be enabled as an NTP server on your network, allowing clients without access to the internet to keep their time synchronized.

ntpdate

The » ntpdate -q » command allows you to query a specific NTP server. Using this from another machine on your network allows you to test the NTP server is configured correctly and accessible.

Читайте также:  Установка sata драйверов при установке windows

The » ntpdate [-u] » command can be used to perform a one-off update of the system time on the local machine.

The «-u» option tells the command to use an unprivileged port. Without it you may get the following error.

Security

As mentioned previously, there are no specific security requirements for NTP clients.

Access to NTP servers is controlled using the «restrict» entries in the «/etc/ntp.conf» file and the Linux firewall.

Oracle RAC and NTP

This section is not related to the RHCE exam, but it is relevant to Oracle DBAs.

When you are using Oracle RAC you have to make a decision whether to configure NTP, or make sure it is not configured so the Oracle Cluster Time Synchronization Service (ctssd) can synchronize the times of the RAC nodes. To deconfigure NTP, do the following.

If you wish to use NTP, you must add the «-x» option into the following line in the «/etc/sysconfig/ntpd» file.

Источник

How to force a NTP sync with the NTP server(s) on Oracle Linux or Oracle VM (Doc ID 2094959.1)

Last updated on JUNE 22, 2020

Applies to:

This document briefly outlines how one can force a ntp (Network Time Protocol) sync with the ntp servers defined in the /etc/ntp.conf configuration file.

This will not work if there are no ntp servers defined in the /etc/ntp.conf, this can be verified using :

This document is useful when the date gets reset e.g. by a hardware maintenance such as a motherboard replacement.

Solution

To view full details, sign in with your My Oracle Support account.

Don’t have a My Oracle Support account? Click to get started!

In this Document

Goal
Solution

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.

Oracle offers a comprehensive and fully integrated stack of cloud applications and platform services. For more information about Oracle (NYSE:ORCL), visit oracle.com. пїЅ Oracle | Contact and Chat | Support | Communities | Connect with us | | | | Legal Notices | Terms of Use

Источник

Установка и настройка NTP-клиента в Linux

В статье рассмотрим настройку NTP клиента.

Установка временной зоны

Для начала смотрим какая у нас установлена временная зона. Для этого используем команду date.

Если временная зона установлена неправильно, то устанавливаем правильную временную зону. Для этого создаем симлинк на файл /etc/localtime с соответствующей временной зоны из каталога /usr/share/zoneinfo/. Например для Москвы.

Настройка синхронизации NTP-клиента с NTP-сервером

Устанавливаем пакет ntp

Для синхронизации локальной клиентской машины на Linux с NTP-сервером требуется отредактировать файл /etc/ntp.conf. В следующем примере указывается несколько серверов времени, что полезно на случай недоступности одного из них. Или можете прописать другие внешние сервера, например pool.ntp.org

iburst: данный параметр повышает точность синхронизации, вместо одного пакета отправляется восемь. Когда сервер не отвечает, пакеты отправляются каждые 16 секунд, когда отвечает – каждые 2 секунды.

Далее нужно указать в файле конфигурации ваш NTP-сервер, который мы настроили в предыдущей статье. Если у вас в сети нет своего ntp сервера, то этот параметр указывать не нужно.

prefer: если указана данная опция, заданный сервер считается предпочтительным перед остальными, но если ответ этого сервера будет значительно отличаться от ответов остальных серверов, он будет игнорироваться. Вместо 192.168.1.1 укажите ip адрес вашего сервера

Читайте также:  Qemu клиент для windows

Запуск службы NTP

После изменения ntp.conf и задания необходимых параметров запустите службу (демон) NTP. В зависимости от настроек, она может работать и как сервер, и как клиент.

и добавьте его в автозагрузку

для проверки времени наберите команду

Проверка состояния NTP

Проверить состояние NTP можно при помощи команды ntpq. Если вы получите ошибку отказа в соединении, значит, сервер времени не отвечает, не запущена служба NTP на клиенте или закрыт порт.

remote – имя или адрес сервера времени. Перед ним указан служебный символ, в данном случае «*», что означает используемый сервер. «+» означает, что сервер пригоден для обновления, «-» — что непригоден, «x» — сервер недоступен;
refid – вышестоящий в иерархии Stratum сервер;
st – уровень сервера в иерархии Stratum;
t – тип соединения (u – unicast, одиночное соединение, b – broadcast, широковещательное соединение, l – локальные часы);
when – время, прошедшее с момента последнего ответа;
poll – период опроса в секундах;
reach – состояние доступности (при представлении в двоичном виде 1 означает успешную попытку, 0 – сбой. После 8 успешных попыток устанавливается значение 377);
delay – время двойного оборота пакета;
offset – текущее смещение времени относительно сервера;
jitter – среднеквадратичное отклонение времени.

Значение jitter должно быть низким, если это не так, проверьте смещение относительно часов в файле погрешности (driftfile). Если оно слишком велико, может потребоваться смена NTP-сервера. Следующая команда вручную синхронизирует время с NTP-сервером:

Ручная синхронизация времени

Для опроса NTP-сервера и установки даты и времени в ручную используется команда ntpdate. Обычно это требуется только один раз.

Для начала отключите ntp службу

Запустите синхронизацию указав сервер с которого нужно синхронизировать время

Запустите службу ntp

После такой первоначальной синхронизации NTP-клиент будет регулярно опрашивать NTP-сервер для обеспечения соответствия локального времени точному времени.

Если вы нашли ошибку, пожалуйста, выделите фрагмент текста и нажмите Ctrl+Enter.

Источник

How to Install NTP in RHEL 8

Having an accurate system time on a Linux server is very important because of several system components such as Cron and Anacron, backup scripts and much more work based on time. Accurate timekeeping can be achieved using the Network Time Protocol (NTP) protocol.

NTP is an old, widely known and cross-platform protocol designed to synchronize the clocks of computers over a network. It commonly synchronizes a computer to Internet time servers or other sources, such as a radio or satellite receiver or telephone modem service. It can also be used as a time source/server for client systems.

In RHEL Linux 8, the ntp package is no longer supported and it is implemented by the chronyd (a daemon that runs in user-space) which is provided in the chrony package.

chrony works both as an NTP server and as an NTP client, which is used to synchronize the system clock with NTP servers, and can be used to synchronize the system clock with a reference clock (e.g a GPS receiver).

It is also used to synchronize the system clock with a manual time input, and as an NTPv4 server or peer to provide a time service to other computers in the network.

In this article, we will show you how to install and configure the NTP server and client using chrony package in RHEL 8 Linux distribution.

Test Environment:

How to Install Chrony in RHEL 8

To install the chrony suite, use the following DNF package manager as follows. This command will install a dependency called timedatex.

Читайте также:  Windows audio software download

Install Chrony in RHEL 8

The chrony suite consists of chronyd, and chronyc, a command line utility which is used to change various operating parameters and to monitor its performance whilst it is running.

Now start the chronyd service, enable it to auto start at system boot and verify the running status using the following systemctl commands.

Start Chonyd in RHEL 8

How to Configure NTP Server Using Chrony in RHEL 8

In this section, we will show how to set up your RHEL 8 server a master NTP time server. Open the /etc/chrony.conf configuration file using any of your favorite text-based editor.

Then look for the allow configuration directive and uncomment it and set its value to the network or subnet address from which the clients are allowed to connect.

Save the file and close it. Then restart the chronyd service configuration to apply the recent changes.

Next, open access to the NTP service in firewalld configuration to allows for incoming NTP requests from clients.

How to Configure NTP Client Using Chrony in RHEL 8

This section shows how to configure chrony as a direct NTP client in our CentOS 7 server. Start by installing the chrony package using the following yum command.

Install Chrony in CentOS 7

Once installed, you can start, enable and verify the chronyd service status using the following systemctl commands.

Next, you need to configure the system as a direct client of the NTP server. Open the /etc/chrony.conf configuration file with a text-base editor.

To configure a system as an NTP client, it needs to know which NTP servers it should ask for the current time. You can specify the servers using the server or pool directive.

So comment out the default NTP servers specified as the value of the server directive, and set your RHEL 8 server’s address instead.

Configure NTP Client on CentOS 7

Save the changes in the file and close it. Then restart the chronyd service configurations for the recent changes to take effect.

Now run the following command to show the current time sources (NTP server) that chronyd is accessing, which should be your NTP server address.

Check Time Sources on NTP Client

On the server, run the following command to display information about NTP clients assessing the NTP server.

Check NTP Clients Accessing the NTP Servers

For more information on how to use the chronyc utility, run the following command.

That’s all! In this article, we have shown how to install and configure an NTP server in RHEL 8 using chrony suite. We also showed how to configure an NTP client on CentOS 7.

If you have any questions about this article, use the comment form below to ask any questions or queries.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

We are thankful for your never ending support.

Источник

Оцените статью