The server is set via a configuration file. The default config file is 
/etc/systemd/timesyncd.conf and it can be overridden by dropping files in 
/etc/systemd/timesyncd.conf.d/. 
There is a pool of free ntp servers available on https://www.ntppool.org/en/.

To test this fix you also need a DHCP server that returns NTP records.

With VMs, you can use dnsmasq to provide NTP records by changing the values in 
dnsmasq.conf
# Set the NTP time server addresses to 192.168.0.4 and 10.10.0.5
#dhcp-option=option:ntp-server,192.168.0.4,10.10.0.5

Or if you're using libvirt, edit the configuration with "virsh net-edit
default" (or the name of the network your VMs are attached to) then pass
the option directly to dnsmasq (cf
https://libvirt.org/formatnetwork.html for reference)

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to network-manager in Ubuntu.
https://bugs.launchpad.net/bugs/1933828

Title:
  NTP servers from DHCP are not propagated to timesyncd

Status in OEM Priority Project:
  New
Status in network-manager package in Ubuntu:
  New
Status in network-manager source package in Focal:
  New

Bug description:
  Network manager gets NTP servers from DHCP but do not update timesyncd to use 
it which keeps using ntp.ubuntu.com.
   
  This is a problem on private networks which do not have access to public 
internet. On this type of network the configuration of timesyncd must be 
updated manually instead of inheriting the conf from the dhcp servers.

  This can be integrated with a NM dispatcher script such as below:

  etc/NetworkManager/dispatcher.d/10-update-timesyncd for example:

  ==8<=====8<=====8<=====8<=====8<==
  #! /usr/bin/bash

  [ -n "$CONNECTION_UUID" ] || exit

  INTERFACE=$1
  ACTION=$2

  case $ACTION in
      up | dhcp4-change | dhcp6-change)
          [ -n "$DHCP4_NTP_SERVERS" ] || exit
          mkdir -p /etc/systemd/timesyncd.conf.d/
          cat<<EOF > /etc/systemd/timesyncd.conf.d/$CONNECTION_UUID.conf
  [Time]
  NTP=$DHCP4_NTP_SERVERS
  RootDistanceMaxSec=15
  EOF
          systemctl restart systemd-timesyncd
         ;;
      down)
          rm -f /etc/systemd/timesyncd.conf.d/$CONNECTION_UUID.conf
          systemctl restart systemd-timesyncd
          ;;
  esac
  ==8<=====8<=====8<=====8<=====8<==

  ProblemType: Bug
  DistroRelease: Ubuntu 21.10
  Package: network-manager 1.30.0-1ubuntu3
  ProcVersionSignature: Ubuntu 5.11.0-18.19+21.10.1-generic 5.11.17
  Uname: Linux 5.11.0-18-generic x86_64
  NonfreeKernelModules: zfs zunicode zavl icp zcommon znvpair
  ApportVersion: 2.20.11-0ubuntu67
  Architecture: amd64
  CasperMD5CheckResult: unknown
  CurrentDesktop: ubuntu:GNOME
  Date: Mon Jun 28 14:08:52 2021
  InstallationDate: Installed on 2020-05-31 (393 days ago)
  InstallationMedia: Ubuntu 20.10 "Groovy Gorilla" - Alpha amd64 (20200527)
  RebootRequiredPkgs:
   linux-image-5.11.0-20-generic
   linux-base
  SourcePackage: network-manager
  UpgradeStatus: No upgrade log present (probably fresh install)
  nmcli-nm:
   RUNNING  VERSION  STATE      STARTUP  CONNECTIVITY  NETWORKING  WIFI-HW  
WIFI      WWAN-HW  WWAN    
   running  1.30.0   connected  started  full          enabled     enabled  
disabled  enabled  enabled

To manage notifications about this bug go to:
https://bugs.launchpad.net/oem-priority/+bug/1933828/+subscriptions


-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to