9

I want to setup a standalone NTP server on Ubuntu.

The problem is all the tutorials i see on the internet are about how to make the server to synchronize with another time server on the internet and then broadcast the time in my network.

What I want is the server I'm setting up to use its own system clock and broadcast it to the network, and not having to synchronize with an internet time server before that. How can I achieve that?

Also, on another note, which command can I run with ntpd or ntpdc to check that my server and clients are running the daemon correctly?

2
  • 1
    See this for setting up an NTP server. Jun 25, 2014 at 15:39
  • This is very useful question for who want synchronize datetime in local isolated intranet, in-which an old PC may work perfectly as a time server for other network's machines.
    – SaidbakR
    May 5, 2017 at 12:59

2 Answers 2

8

You can comment out those pool servers list under /etc/ntp.conf and specificity your own server. Let me give the full step:

Server side

First, disable the ntpdate service:

sudo update-rc.d -f ntpdate remove

Install NTP

sudo apt-get install ntp

Open and edit the ntp configuration file:

/etc/ntp.conf

Comment out those pool servers and specifiy your own server address e.g:

server 192.168.20.1

Now, restart the ntp service

sudo service ntp restart

Clients side

Install NTP

sudo apt-get install ntp

And then edit the configuration file /etc/ntp.conf

Finally specify your own server address:

server 192.168.20.1

If you have a DNS entry for the NTP server you can use like:

server et.ntp.org

Restart

sudo service ntp restart

You need to see this for your last question:

How to check if NTPD updates Linux machine's time successfully

4
  • Hi, thanks for your answer, i did everything you listed and i also checked the post you linked. When i type ntpdate i get the following message: 25 Jun 15:49:17 ntpdate[2091]: no servers can be used, exiting That happens both in the server and in the client. In server IP i chose the server IP and not localhost... Is that correct? I can try and copy the ntp.conf file for you to see Jun 25, 2014 at 19:00
  • 1
    ntpdate cannot be used without arguments nor does it have a config file. If you want to use this to update, you have to state the ntp server in an argument, such as ntpdate ntp.server.com. you can include your ntp.conf on your answer.
    – Achu
    Jun 26, 2014 at 7:33
  • Hi again, i managed to make it with ntpdate and when i start the ntp client. The problem is it only sinchronizes once, at the startup of the client deamon. What i mean is the following: When i startup the client daemon if the client has different date than the server then it changes it (ie: synchronizes it) However, if some minutes later i purposely change the date in the client, then the client keeps the wrong date and doesnt synchronize. I captured traffic with tcpdump and saw that the client and server interchange messages, but the client for some reason doesnt update its time. help please Jun 27, 2014 at 18:23
  • @gonza1207, for the 1st error. ntpdate which the one that sync on network interface up, could have separate setup here /etc/default/ntpdate verify it. For 2nd one, could you test with sudo sudo ntpdate ntp.server.com only root can change time, see it does work.
    – user.dz
    Jul 8, 2016 at 16:49
1

This is an old question, but there is no answer here, so, I would provide an answer for other people, struggling with this problem, if you've already solved it.
You might want to use (on the server):

server 127.127.1.0
fudge 127.127.1.0 stratum 8

where stratum #number is some reasonably low number, which means, that the server can be trusted for the time information, that it provides.

1
  • And the short answer is that you absolutely do not want to do this. Either get time from upstream, or spend 100$ on a RPi with GPS hat and get your own shiny stratum 1 server.
    – vidarlo
    Nov 27, 2017 at 16:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .