Wednesday, March 2, 2016

Building an NTP Server on NetBSD

 on  with No comments 
In ,  
In this post, I'll go over how I set up my NTP server using NetBSD 6.1.  There was no real technical reason why I chose NetBSD over any other possible operating system.   I've built and ran NTP servers on FreeBSD and various flavors of Linux in the past.  But there's two small and not really important reasons why I chose NetBSD this time around.  First, I've never really used it before and wanted to see it.  Since this is the uber-poratable OS that can run on everything including a toaster, it seems like a good tool to have in the arsenal.  Second, NetBSD can run with very minimal resources.  I set my NTP server's VM  up to run with 64MB of RAM.  And no matter how much memory you throw at your VM hosts, you'll always want more, right?  That's why I'm planning to use NetBSD as much as I can, and why most of my softphones run on Windows 2000.

So set up a bare bones VM.  64MB of RAM, 1 CPU core, no audio, no usb, etc.  The one thing to keep in mind is that this is BSD and there's no love for Hyper-V, so go with the legacy network adapter.  Mount the .iso and boot it up.  You can choose 3 to go with a kernel without ACPI and SMP, but I don't know what kind of savings you'd get vs. what incompatibilities you'll introduce so I just picked the default here.  As always, I probably got carried away with screenshots.  But too many is always better than too few, right?


Choose your language.  I work exclusively with English, but the menus should be pretty much in the same order if you pick a different language.



Choose your keyboard.  I just hit enter here, US-English appears to be the default.



This is going to be a fresh install, so go with option a here.



Your first chance to back out.  I guess this is a good thing if you're installing onto bare metal or reusing an existing VM.



The VM's HDD was detected and the installer doesn't really care if you didn't want to install on this disk.



You can select minimal installation here, but I'll choose custom just to show what other options are available. I won't be adding any additional software above the minimal default.



Here's the other options, should you want them.  Don't get excited when you see games.  These games may have been the bees knees in the 1980's, but it's a pretty lame collection by todays standards.  If you've never used a BSD system, you may have come across the "BSD Games" package that is available  on a number of Linux distributions.



After seeing the distribution sets (or after selecting minimal install if you went that route), you'll be asked about the settings that the installer auto detected.  It's been years since I've concerned myself with HDD geometry, so I'm just going to take the installer's word for it.



Tell it to use the entire disk.  We're not going to dual boot or anything else complicated with this setup.



Next, we want the bootcode (AKA boot loader in other operating systems) on the MBR of the HDD.  If you were dual booting with another OS, you'd put it at the beginning of the NetBSD partition and have the boot loader on the MBR of the primary HDD point to it when NetBSD is selected.



Here we can just say use existing partition sizes and the installer will set up a default layout. If you were setting up a workstation or a file server which hosts a lot of data you may want to use a customized setup.  For our purposes here, the defaults are fine.



Next, it'll show you the default partition layout.  Again, its fine for our purposes so just hit Partition sizes ok.



Give the disk a volume label if you want, the default is fine if you don't care.



Here the installer gives you one last chance to back out.  Choose yes to continue.



Partitions will be made and formatted.  This will take a couple minutes.



For our purposes, we want to keep the default of BIOS console (the screen and keyboard directly attached).  If this were a bare metal installation, going out the serial port to a terminal somewhere else may be of use.  Hitting enter here takes you down to x: Exit, and then hitting enter again proceeds.  Note that BIOS Console is already selected by default.



We're going to install from CD-ROM unless there's a really good reason to install from somewhere else. Perhaps your boot CD is old and you want to install a newer version? You can give the information to install that way instead.



Next, the selected software packages will be installed.  This will take a few minutes.



It'll tell you that the system is installed and that you'll be able to configure it now.  Not a necessary screen, but easy enough to proceed past.



Here, I'm selecting g: to enable sshd (so you can ssh into this system later), i: run ntpdate at boot which will go out to an external NTP server to set the date and time for the server itself, and h: enable ntpd.  After changing those from NO to YES, option d: allows you to set a root password for the system.  If you do not set one, you'll be able to log in with the root user with no password by default.  And finally, select a: configure network to make this server reachable.



It will show you all the interfaces that it finds, and you can configure them here.  Since there's only one, we have an easy choice here.



It'll go through a series of questions regarding the network settings you want.  Type them all in, hitting enter after each entry. 



Next, it'll move along to IPv6.  I have yet to start using IPv6 at home, so I declined.  Choose yes if you wish to enable IPv6 on your interface.



Finally, you'll confirm the options are all correct.  If you choose no, or choose configure network again from the previous menu, you'll go though the questions again with your previous entry as the default for each option.



Back the "Configure additional items as needed" menu, choose x to finish, and then exit your way out of the installer. Remove the .iso and reboot the VM.  The system will set it's own date and time from an external NTP server and make itself available to NTP clients on your local network.  The default settings are fine, but /etc/ntpd can be edited if they're not.


Share:

0 comments:

Post a Comment

Discuss this post!