1. DIY HOME SERVER - Local NTP Server - Prepare container
When creating a home lab server, it’s often usefull to have a Network Time Protocol server inside your local network. In cases where you have VLAN with no internet access, it’s good practice to have a local NTP server keeping al your IoT devices like for instance IP cameras in sync.
2. DIY HOME SERVER - Local NTP Server - Add VLAN NIC
For security and privacy reasons, you better put all your IoT devices and especially all IP cameras in a seperate VLAN, one that has no internet access. Believe me, a lot of IP cameras have security issues or even “phone home” from time to time.
Because my mainboard has multiple NIC, I can add one Network Interface connected to a seperate VLAN to the NTP Server LXC container and use that one to reach my IP cameras.
Use Network → Add to add a NIC to the container. Specify a fixed IP addres inside the IoT VLAN and don’t specify a Gateway.
3. DIY HOME SERVER - Local NTP Server - Installation
Start the newly created NTP Server Container.
Select the Console.
Log in as user root with the password set during the container creation.
apt update && apt upgrade -y
apt install chrony -y
Now let’s configure Chrony :
nano /etc/chrony/chrony.conf
Goto the end of the file and set all subnets you want to allow access to this NTP server.
allow xxx.xxx.yyy.0/24
allow xxx.xxx.zzz.0/24
Press Ctrl + O to save, confirm.
Press Ctrl + X to exit.
Now restart Chrony :
systemctl restart chrony
Job done. You now have a fully operational NTP server.
Now go and configure all possible LAN clients to use this NTP server by specifiing :
- the IP address of the NTP server (in the correct subnet)
- UDP port 123
When done, you can check if NTP clients succesfully connect to the new NTP server by entering the following command in the console :
chronyc clients