On Linux Network Time Protocol service name can be any one of the following:
Tutorial details | |
---|---|
Difficulty | Easy (rss) |
Root privileges | Yes |
Requirements | None |
Time | 1m |
- ntpd (default on most distro)
- xntpd
- openntpd
After changes of the NTP configuration file such as ntp.conf, the NTP service needs to be restarted. The exact command depending on your Linux distribution.
Debian / Ubuntu Linux restart ntp service
Use any one of the following command on Debian or Ubuntu Linux for ntpd (older version):
$ sudo /etc/init.d/ntp restart
OR use service command:
$ sudo service ntp restart
If you are using Ubuntu Linux 16.04+ LTS/Debian 9.x+ systemd based distro, use the following command:
$ sudo systemctl restart ntp
To see the status of your ntp service run:
$ systemctl status ntp
Sample outputs:
* ntp.service - LSB: Start NTP daemon Loaded: loaded (/etc/init.d/ntp; bad; vendor preset: enabled) Active: active (running) since Mon 2017-10-30 08:57:22 UTC; 23h ago Docs: man:systemd-sysv-generator(8) Process: 13976 ExecStop=/etc/init.d/ntp stop (code=exited, status=0/SUCCESS) Process: 13988 ExecStart=/etc/init.d/ntp start (code=exited, status=0/SUCCESS) Tasks: 1 Memory: 2.7M CPU: 14.410s CGroup: /system.slice/ntp.service ??14005 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 114:120
CentOS /RHEL / Red Hat Enterprise Linux v4.x/5.x/6.x restart ntp service
Use any one of the following command on CentOS or REHL for ntpd::
$ sudo /etc/init.d/ntpd restart
OR use service command:
$ sudo service ntpd restart
If you are using RHEL/CentOS Linux version 7.x+ or latest version of Fedora Linux, use the following command:
$ sudo systemctl restart ntpd
Verify that ntpd restarted, type the following systemctl command:
$ systemctl status ntpd
Sample outputs from failed ntpd restart command:
* ntpd.service - Network Time Service Loaded: loaded (/usr/lib/systemd/system/ntpd.service; disabled; vendor preset: disabled) Active: failed (Result: exit-code) since Tue 2017-10-31 08:37:52 UTC; 3s ago Process: 6063 ExecStart=/usr/sbin/ntpd -u ntp:ntp $OPTIONS (code=exited, status=0/SUCCESS) Main PID: 6064 (code=exited, status=255) Oct 31 08:37:52 centos-7 ntpd[6064]: Listen and drop on 1 v6wildcard :: UDP 123 Oct 31 08:37:52 centos-7 ntpd[6064]: Listen normally on 2 lo 127.0.0.1 UDP 123 Oct 31 08:37:52 centos-7 ntpd[6064]: Listen normally on 3 eth0 10.98.222.3 UDP 123 Oct 31 08:37:52 centos-7 ntpd[6064]: Listen normally on 4 lo ::1 UDP 123 Oct 31 08:37:52 centos-7 ntpd[6064]: Listen normally on 5 eth0 fe80::216:3eff:fed0:e88a UDP 123 Oct 31 08:37:52 centos-7 ntpd[6064]: Listening on routing socket on fd #22 for interface updates Oct 31 08:37:52 centos-7 ntpd[6064]: 0.0.0.0 c016 06 restart Oct 31 08:37:52 centos-7 systemd[1]: ntpd.service: main process exited, code=exited, status=255/n/a Oct 31 08:37:52 centos-7 systemd[1]: Unit ntpd.service entered failed state. Oct 31 08:37:52 centos-7 systemd[1]: ntpd.service failed.
A note about OpenNTPD service
If you are using OpenNTPD on Linux, type the following command to restart openntpd on Linux:
$ sudo /etc/init.d/openntpd restart
OR use service command:
$ sudo service openntpd restart
🐧 1 comment so far... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
very good usefull