Tiny Core Linux

Tiny Core Base => Corepure64 => Topic started by: gharig on December 07, 2022, 01:32:22 PM

Title: NTP-Server DHCP-OPTION
Post by: gharig on December 07, 2022, 01:32:22 PM
Hello Everyone,

So I would like to know what Tinycore does when it receives a dhcp-option #42 (ntp-server)?

I see that Tinycore will make update or add an entry in the [/proc/net/route] file, setting the Gateway for an eth* when it receives a dhcp-option #3 (router).

I have set up a small test environment, with 3 Tinycore machines running on a private network, "air gapped", I believe is the term that is being used today.  I have tc-corepure64 running on all three machines.  The first is a Virtual Machine, running in Hyper-V on Windows10 acting as the DHCP server running Dnsmasq. The other two are Winsystems C-407 (intel multicore E3800) PC104 mini computers.  I'm in a very slow process to try and have my PC-104 computers netboot.  While reading about what Dnsmasq can do I see that there are these dhcp option that can be sent to the dhcp client. And one of those options is #42 (ntp-server). As I mentioned before that this is an air-gapped system no internet connection, but I will have a NTP server running so machines can have the correct time.  I also see that there is a boot code "settime"  that calls a script settime.sh which calls getTime.sh which looks up the npt server in a file [/etc/sysconfig/ntpserver] .  It would be nice if Tinycore when receiving a dhcp-option #42 would place the ip address in the [/etc/sysconfig/ntpserver] file.   I know I can manually set this, but that is not the point of what I'm asking.  Also it would be nice to know what happens with all the dhcp-options that can be sent or where I can look to figure it out.

Thanks
gharig
Title: Re: NTP-Server DHCP-OPTION
Post by: curaga on December 07, 2022, 11:28:59 PM
The handling of those options all happens in a script. /usr/share/udhcp/default.script IIRC. What you're asking for is definitely a custom setup though, it's quite rare to use those DHCP options, so it would not be good in the base. I'm also not sure if udhcpc passes that through.

Backup restore probably happens too late, so edits to that script should be remastered.
Title: Re: NTP-Server DHCP-OPTION
Post by: gharig on December 10, 2022, 10:49:09 AM
Hi curaga,

Thanks for the reply.  I definitely do not want to use a custom setup, that would detract from future upgrades to the OS.  My small brain, saw that the dhcp option #42  allowed me to tell the client about ntp-server, so the client would know where to go to so it could set the time, especially on a private "air-gapped" network.  And during a pxe boot, having the dhcp server give out info about the time server seemed like a great idea. But I see that there is a much better way, when I wasn't looking you guys sneaked in a boot code to set the npt-server to something of my choosing, and that boot code is nptserver=xxxxx. And that will work perfectly.


Thanks
gharig