WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: NTP-Server DHCP-OPTION  (Read 1874 times)

Offline gharig

  • Newbie
  • *
  • Posts: 24
NTP-Server DHCP-OPTION
« on: December 07, 2022, 04: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

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: NTP-Server DHCP-OPTION
« Reply #1 on: December 08, 2022, 02:28:59 AM »
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.
The only barriers that can stop you are the ones you create yourself.

Offline gharig

  • Newbie
  • *
  • Posts: 24
Re: NTP-Server DHCP-OPTION
« Reply #2 on: December 10, 2022, 01:49:09 PM »
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