OPNsense Forum

Archive => 18.7 Legacy Series => Topic started by: dwasifar on October 22, 2018, 06:23:46 pm

Title: NTP on DHCP
Post by: dwasifar on October 22, 2018, 06:23:46 pm
If I have NTP server and DHCP server both active, will OPNsense automatically tell DHCP clients to use its NTP service?  Or do I have to specify that manually by putting the OPNsense interface address in the NTP server section of DHCP configuration?
Title: Re: NTP on DHCP
Post by: guest19228 on October 24, 2018, 02:37:20 am
you have to specify the ntp servers. If you do not, your /var/dhcpd/etc/dhcpd.conf will look like this
Code: [Select]
option domain-name "domain.tld";
option ldap-server code 95 = text;
option arch code 93 = unsigned integer 16; # RFC4578
option pac-webui code 252 = text;

default-lease-time 7200;
max-lease-time 86400;
log-facility local7;
one-lease-per-client true;
deny duplicates;
ping-check true;
update-conflict-detection false;
authoritative;

subnet 192.168.5.0 netmask 255.255.255.0 {
  pool {
    range 192.168.5.100 192.168.5.250;
  }

  option routers 192.168.5.1;
  option domain-name-servers 192.168.5.1;
}
You see the option for the ntp servers is not in the file so the dhcp server will not provide it. And now lets specify ntp servers lease time domain searhc list and so on.
The resulting  /var/dhcpd/etc/dhcpd.conf now looks like that:
Code: [Select]
option domain-name "domain.tld";
option ldap-server code 95 = text;
option arch code 93 = unsigned integer 16; # RFC4578
option pac-webui code 252 = text;

default-lease-time 7200;
max-lease-time 86400;
log-facility local7;
one-lease-per-client true;
deny duplicates;
ping-check true;
update-conflict-detection false;
authoritative;

subnet 192.168.5.0 netmask 255.255.255.0 {
  pool {
    range 192.168.5.100 192.168.5.250;
  }

  option routers 192.168.5.1;
  option domain-search "somedomain.tld";
  option domain-name-servers 192.168.5.1;
  default-lease-time 300;
  max-lease-time 600;
  option ntp-servers 192.168.5.1,192.168.178.1;
}
You see the ntp server option is now included in the config file and so the dhcp server will provide them to the clients. If the clients will use that option depends on the client configuration.
Title: Re: NTP on DHCP
Post by: dwasifar on October 24, 2018, 06:07:18 pm
Thanks.  :)  Up and operating.