I am using STM32MP1 based two devices which runs on Yocto platform(Kernel version 4.19.9). Among them one has two network interfaces (wlan0, wlan1) where wlan0 is used for connecting with internet servers & wlan1 will be acting as host network for another device to connect with this. I am using ntpd
(version: ntpd 4.2.8p13@1.3847) for Time Synchronization. I had a common ntp.conf
for both devices.
driftfile /var/lib/ntp/drift
server 127.127.1.0
fudge 127.127.1.0 stratum 14
restrict default
Also DHCP client configuration also same for both devices.
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, host-name,
netbios-name-servers, netbios-scope;
I neither had the specific servers mentioned in the ntp.conf
file nor did my device’s DHCP client explicitly request ntp-servers
. However, my primary device (which has two network interfaces) can still synchronize with the time servers provided by my Wi-Fi router.
But my secondary device can’t get time sync understandably it can’t reach time servers directly. The issue is the primary device is not acting as NTP server (on wlan1) for the secondary device to get timesync. I have used udhcpd
on primary device for the secondary device to connect, below is the udhcpd.conf
used,
start 192.168.10.100
end 192.168.10.200
interface wlan1
option subnet 255.255.255.0
option router 192.168.10.1
option lease 43200
option dns 192.168.10.1
option domain local
So I changed the ntp.conf
files as below
#Primary device should act as an NTP client on wlan0 and as an NTP server on wlan1.
driftfile /var/lib/ntp/drift
server 127.127.1.0
fudge 127.127.1.0 stratum 14
interface listen all
restrict 192.168.10.0 mask 255.255.255.0 nomodify notrap
#Secondary device should act as NTP client only listen to primary device
driftfile /var/lib/ntp/drift
server 192.168.10.1 iburst minpoll 3 maxpoll 6
server 127.127.1.0
fudge 127.127.1.0 stratum 14
restrict 192.168.10.1
But still my secondary device’s time is not getting synced? what is the problem how to overcome this?
And I captured netstat output for both devices which seems to be Ok.
Primary device
root@stm32mp1-disco:~# netstat -tuln | grep 123
udp 0 0 192.168.10.1:123 0.0.0.0:*
udp 0 0 192.168.0.127:123 0.0.0.0:*
udp 0 0 127.0.0.1:123 0.0.0.0:*
udp 0 0 0.0.0.0:123 0.0.0.0:*
udp 0 0 fe80::a2cd:f3ff:fe38:2d7b:123 :::*
udp 0 0 fe80::a2cd:f3ff:fe38:2d7b:123 :::*
udp 0 0 ::1:123 :::*
udp 0 0 :::123 :::*
Secondary device
root@stm32mp1-disco:~# netstat -tuln | grep 123
udp 0 0 192.168.10.100:123 0.0.0.0:*
udp 0 0 127.0.0.1:123 0.0.0.0:*
udp 0 0 0.0.0.0:123 0.0.0.0:*
udp 0 0 fe80::a2cd:f3ff:fe35:a045:123 :::*
udp 0 0 ::1:123 :::*
udp 0 0 :::123 :::*
Please help me to overcome this.