LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Which lightweight Linux distro as NTP server and how to? (https://www.linuxquestions.org/questions/linux-newbie-8/which-lightweight-linux-distro-as-ntp-server-and-how-to-917735/)

Ready 12-08-2011 08:01 AM

Which lightweight Linux distro as NTP server and how to?
 
Hi,

I have a couple of Linux based computers/devices which need to be time synchronized. The only thing I have at my disposal are a couple of old PC's with about 256 Mb RAM.

Is it possible to set up that kind of machine to act as an NTP server? The Linux devices are on a dedicated subnet, and other (win based) PC's are on the main subnet. The machine would have two NIC's, connected to both subnets, using win based one for internet access, to synchronize with one of the online NTP servers or the domain controller. Linux devices would then synchronize with the machine.

Is that doable? And which distro should I choose? I only need it to be an NTP server, nothing more, it would just sit there, doing nothing else.

macemoneta 12-08-2011 09:38 AM

Take the old PCs and send the to a recycling center. In a couple of weeks, pick up a Raspberry Pi for $35; the power savings will pay for it in a few months (it draws less than 1W). Install Debian with NTP or Chrony.

TobiSGD 12-08-2011 11:21 AM

Quote:

Originally Posted by Ready (Post 4545130)
Is it possible to set up that kind of machine to act as an NTP server?

Yes.

Quote:

Is that doable?
Yes.

Quote:

And which distro should I choose?
For that purpose a minimal install (+ NTP of course)of any distro will be sufficient. I would go for Debian, easy to set up and maintain.

wpeckham 12-08-2011 12:00 PM

Second that motion
 
Debian minimal with NTP added and configured would be nearly optimal (No gui needed or installed).
TinyCore (actually multicore, same people) might do. Yoou would have to use the command-line tools to download and configure NTP, btu then that IS the best way. This option is faster, easier, and can run from CD or HD with only the home and configuration saved to disk. (as nearly hack-proof as you can get).
Puppy might also work, I have never set up a puppy NTP server.

What you want to do takes little resource and should work using nearly any distribution. A minimal distribution is a better choice to maintain adequate performance on the older hardware, but I cannot think of a distribution that does not support ntp.

TobiSGD 12-08-2011 12:13 PM

Quote:

Originally Posted by wpeckham (Post 4545289)
TinyCore (actually multicore, same people) might do. Yoou would have to use the command-line tools to download and configure NTP, btu then that IS the best way. This option is faster, easier, and can run from CD or HD with only the home and configuration saved to disk. (as nearly hack-proof as you can get).

You got me on that. I once used Slitaz to create a minimal live system, booting from network, that has done nothing except inventorying the hardware, scp'ed the results to a server and shut down. Stripped that down to a total size of 8MB, IIRC. Slitaz comes with the tool for doing something like that pre-installed, IIRC its name was tazlito.

But that is something for us geeks, I would think that Debian is the easier way to go.

theNbomr 12-08-2011 03:45 PM

All you need to support an NTP server is a kernel with drivers for your network. Microcore is about the smallest commonly available distro right now, and even it is overkill for supporting only a NTP server.

--- rod.

Ready 12-09-2011 06:46 AM

Thanx for the answers guys, much helpful.

I chose Damn Small Linux as I had it lying around, and it installs as Debian on hard drive (that's what it says at least).

I installed NTP and tried to sync the computer with my domain NTP server. It worked, but the problem was the time zone was set to EST so it was 6 (or 18) hours off. I had to use rm to delete localtime file, and then copy one of the files for Europe, since I'm on CET.

so I did

sudo ln -sf ../utc/share/zoneinfo/Europe/Madrid /etc/localtime

and the time was still 6 hours off, but the time zone was CET. I synced it with my ntp with sudo ntpdate and it was correct.

However, that is only in the terminal, the desktop is still 6 hours off. What am I missing? When I turn off the terminal, the clock on the desktop remains off. It's like root user's settings do not apply to dsl user.

EDIT: When I go to setup>date and time setup, it shows the correct time, it's only the desktop that shows the wrong time. When I restart the pc and check the date, tehe terminal reports correct date but EST, and the desktop is 12 hours off. Everything is wrong.

Ready 12-09-2011 07:57 AM

Dunno how or why, but after lot of fiddling, now it's all correct. Moving onto the next phase!

theNbomr 12-09-2011 10:05 AM

Quote:

Originally Posted by Ready (Post 4545813)
sudo ln -sf ../utc/share/zoneinfo/Europe/Madrid /etc/localtime

and the time was still 6 hours off, but the time zone was CET. I synced it with my ntp with sudo ntpdate and it was correct.

However, that is only in the terminal, the desktop is still 6 hours off.

Huh? Why do you need a desktop to run an NTP server?
--- rod.

corp769 12-09-2011 10:07 AM

Quote:

Originally Posted by theNbomr (Post 4545945)
Huh? Why do you need a desktop to run an NTP server?
--- rod.

+1 to that. If anything, you could use an older headless pentium 1 to run an NTP server.....

Ready 12-12-2011 12:36 AM

Quote:

Originally Posted by theNbomr (Post 4545945)
Huh? Why do you need a desktop to run an NTP server?
--- rod.

Well, I know just about nothing about Linux, so having a desktop environment helps me feel a bit safer LOL

Stupid, I know, and I haven't done anything in graphical environment except use the terminal, but still, I feel a bit more comfortable having a desktop.

I used an old Duron pc.

Ready 12-12-2011 06:32 AM

Problem again - I cannot set the statis IP address. That is, I can but it gets overridden on boot.

I tried this

http://www.linuxquestions.org/questi...config-206720/

and this

http://tech.stlsawall.com/remasterknoppix_dnsmasq
(Configur host information part)

and this
http://forum.almworks.com/lofiversio....php/t261.html

but still nothing. Every time pc boots, it always ends up getting the IP from DHCP. How can I fix that?

What would this do:
auto lo
iface lo inet loopback


?

theNbomr 12-12-2011 12:08 PM

Quote:

having a desktop environment helps me feel a bit safer
Okay, sort of like sleeping with the light on to keep the beasties of the dark at bay. Completely rational.
The IP configuration of network interfaces is done in various ways for different distros. I'm not familiar with the method used by DSL. Invariably, it will be done in a collection of scripts and config files somewhere in the /etc directory tree. You may be able to find it by running a command such as the following (as root):
Code:

grep -R -i eth0 /etc
This will probably turn up a short list of files that are involved in configuring the network, and if it isn't clear how to modify them, you should be able to ask a more specific question about it here.

--- rod.

Ready 12-13-2011 07:26 AM

Quote:

Originally Posted by theNbomr (Post 4548040)
Code:

grep -R -i eth0 /etc

returns invalid option --R

EDIT: Just added a reaservation on DHCP via MAC address and it works beautifully.

Sort of. THe moment I add another NIC, they atop working.

theNbomr 12-13-2011 10:06 AM

Okay, so your light distro probably doesn't have a grep that does recursive searches. Instead, you can use find (untested):
Code:

find /etc -exec "grep -i eth0" {} \; -print
But, I guess you've found it if you were able to configure the NIC. You should be able to bind each NIC to a configuration with its MAC.

Adding another NIC possibly changes the default designation of eth0 & eth1, eth2... Some distros handle this seamlessly, but in others you need to adjust your NIC naming to suit the distro. Was really hoping someone familiar with the DSL way could step up here.

--- rod.

Ready 12-14-2011 01:17 AM

Quote:

Originally Posted by theNbomr (Post 4548827)
Okay, so your light distro probably doesn't have a grep that does recursive searches. Instead, you can use find (untested):
Code:

find /etc -exec "grep -i eth0" {} \; -print
But, I guess you've found it if you were able to configure the NIC. You should be able to bind each NIC to a configuration with its MAC.

Adding another NIC possibly changes the default designation of eth0 & eth1, eth2... Some distros handle this seamlessly, but in others you need to adjust your NIC naming to suit the distro. Was really hoping someone familiar with the DSL way could step up here.

--- rod.

Hehe, it was that, thanx.

I fiddled with it and managed to get it working. NICs have proper addresses, time zone is correct and when I issue time sync command, it syncs with NTP properly.

Now, the final two questions:

- how do I set up the machine to sync every X minutes with NTP?
- how do I add time sync to boot

theNbomr 12-14-2011 09:47 AM

For help on configuring the NTP daemon, see the respective man page:
Code:

man ntpd
DSL almost certainly has a standard scheme for launching system services, most likely stemming from entries made in the /etc/init.d directory tree. I suggest that you follow whatever model is already used, and if necessary, craft a new script to launch the ntp daemon.

--- rod.


All times are GMT -5. The time now is 02:12 PM.