1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Dismiss Notice

Welcome To SNBForums

SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.

If you'd like to post a question, simply register and have at it!

While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!

[SOLVED] Time synchronization problem

Discussion in 'Asuswrt-Merlin' started by FalconB, Dec 14, 2019.

  1. FalconB

    FalconB Regular Contributor

    Joined:
    Apr 20, 2017
    Messages:
    95
    Hi all!

    Don't know if it's related to the new FW-release but after upgrading to 384.14 on my AC68U I have difficulties with the time synchronization which breaks TLS among other things. Surfing still works but services relying on time sync will not. After reboot or restart (power off/on), checking the date through the command 'date' yields:
    Code:
    Sat May  5 05:07:35 UTC 2018
    By manually typing the command:
    Code:
    /usr/sbin/ntp -t -S /sbin/ntpd_synced -p <ntp-server>
    (where <ntp-server> is the address of the choosen ntp-server) results in the time beeing set and everything needing time sync comes to life. I have tried to add the command to firewall-start script and services-start script in /jffs/scripts, but I does not have any effect, the date is still May 5 2018 after the router has booted. Any advice on what could be the problem?

    I am currently using the following scripts: amtm, diversion with pixelserv-tls, yazfi and uiDivstats.
     
  2. Vexira

    Vexira Very Senior Member

    Joined:
    Jan 20, 2017
    Messages:
    1,911
    Location:
    Australia
    have you given thought to running the jack yaz ntp server.
     
  3. sbsnb

    sbsnb Senior Member

    Joined:
    Aug 9, 2017
    Messages:
    278
    Are you using some sort of encrypted DNS and a hostname as your time server?
     
  4. FalconB

    FalconB Regular Contributor

    Joined:
    Apr 20, 2017
    Messages:
    95
    No I haven't. I haven't seen the need for that, yet. Could be something to look into after I get the router's normal NTP to work though.
    No, not that I know of. Haven't changed the ntp-server in the router gui since forever (several fw-versions back). The strange thing is when I do a ntp time update from the command line it kicks in instantly. Since the router seem to fail setting the time, I tried to put the manual command in one of the scripts in /jffs/scripts, but it dosen't seem to take effect, even though the rest of the commands in the script work. I'm kinda lost here...
     
  5. dave14305

    dave14305 Very Senior Member

    Joined:
    May 19, 2018
    Messages:
    1,767
    Location:
    USA
    Is the router able to successfully do an nslookup of your selected ntp server names from the command line? What WAN DNS servers do you use?
     
  6. FalconB

    FalconB Regular Contributor

    Joined:
    Apr 20, 2017
    Messages:
    95
    Currently I'm not allowed to reboot the router or disrupt internet services by my family ( :oops: ) so I can't tell if I can do a nslookup when the time is not set. However, I know that I can access the internet even though time is off. So that would imply that dns is working.

    Also, when going to the Administration->System tab there is a yellow text stating that time isn't synced when the router has booted up. It also says that my locale is wrong (can't remember the exact words). After entering the ntp command at the command prompt, that text dissapears.

    My DNS settings are attached in image.
     

    Attached Files:

    royarcher likes this.
  7. dave14305

    dave14305 Very Senior Member

    Joined:
    May 19, 2018
    Messages:
    1,767
    Location:
    USA
    I’m going to guess that on Tools /Other settings page that “Wan: Use local caching DNS server as system resolver (default: No)” is set to Yes. Change it to No now and watch after the next reboot.
     
  8. FalconB

    FalconB Regular Contributor

    Joined:
    Apr 20, 2017
    Messages:
    95
    Well, actually it is not :(. Will do some more testing and rebooting tomorrow and see what I can come up with. Thanks for your help though!
     

    Attached Files:

  9. dave14305

    dave14305 Very Senior Member

    Joined:
    May 19, 2018
    Messages:
    1,767
    Location:
    USA
    Just run this now and post the output to clarify which dns server it uses and what ntp server you use.
    Code:
    nslookup $(nvram get ntp_server0)
    nslookup $(nvram get ntp_server1)
     
  10. FalconB

    FalconB Regular Contributor

    Joined:
    Apr 20, 2017
    Messages:
    95
    Code:
    [email protected]:/jffs/scripts# nslookup $(nvram get ntp_server0)
    Server:    1.1.1.1
    Address 1: 1.1.1.1 one.one.one.one
    
    Name:      ntp.se
    Address 1: 2a01:3f7::1 ntp.se
    Address 2: 194.58.200.20 ntp.se
    
    [email protected]:/jffs/scripts# nslookup $(nvram get ntp_server1)
    BusyBox v1.25.1 (2019-12-13 19:39:26 EST) multi-call binary.
    
    Usage: nslookup [HOST] [SERVER]
    
    Query the nameserver for the IP address of the given HOST
    optionally using a specified DNS server
    My ntp-values i nvram:
    Code:
    [email protected]:/jffs/scripts# nvram show | grep ntp
    ntpd_server_redir=0
    ntp_server0=ntp.se
    ntp_server1=
    rc_support=mssid 2.4G 5G update usbX2 switchctrl manual_stb pwrctrl WIFI_LOGO nandflash meoVoda movistarTriple app reboot_schedule ipv6 ipv6pt PARENTAL2 dnsfilter ntpd dnspriv dnspriv dualwan pptpd openvpnd utf8_ssid printer modem webdav rrsut cloudsync media appnet timemachine hdspindown diskutility nfsd dnssec dblog email bwdpi snmp tor HTTPS letsencrypt ssh vpnc repeater psta wl6 optimize_xbox wifi_tog_btn user_low_rssi bcmfa tcode usericon stainfo cloudcheck realip netool cfg_sync amas bcmwifi eula proxysta
    ntp_ready=1
    ntpd_enable=0
    size: 52269 bytes (13267 left)
    
     
  11. dave14305

    dave14305 Very Senior Member

    Joined:
    May 19, 2018
    Messages:
    1,767
    Location:
    USA
    You’re not a fan of secondary DNS or NTP servers. ;)
     
    royarcher and FalconB like this.
  12. FalconB

    FalconB Regular Contributor

    Joined:
    Apr 20, 2017
    Messages:
    95
    :p Haha! Well, I haven't seen the need for it yet. But I guess in the long run, a secondary server would be benficial.
     
    heysoundude, royarcher and dave14305 like this.
  13. easyriider

    easyriider Occasional Visitor

    Joined:
    Sep 28, 2014
    Messages:
    35
    Location:
    EU
    A few weeks ago on 384.14b I changed the NTP server to time.cloudflare.com, but after a reboot there was also no time sync. I changed it back to pool.ntp.org and the time was synced as normal right after the reboot.
     
  14. FalconB

    FalconB Regular Contributor

    Joined:
    Apr 20, 2017
    Messages:
    95
    Ok. Will try that later and see if it makes any difference. It shouldn't make a difference since the user is allowed (and rightfully so) to enter his/hers preferred ntp server. But I'll give it a try tomorrow and see what happens. Thanx for the tip!
     
    Last edited: Dec 14, 2019
  15. Chrisgtl

    Chrisgtl Regular Contributor

    Joined:
    Sep 4, 2018
    Messages:
    72
    I believe I had something similar a couple firmware upgrades ago.

    My NTP would not update by rebooting my 86U alone. I had to completely power down the router and power back up. Since then it has been fine.
     
  16. FalconB

    FalconB Regular Contributor

    Joined:
    Apr 20, 2017
    Messages:
    95
    These are the entries in the syslog regarding NTP. Router starttime is:
    Code:
    May  5 07:05:02 syslogd started: BusyBox v1.25.1
    Syslog entries:
    Code:
    May  5 07:05:18 rc_service: udhcpc 552:notify_rc stop_ntpd
    May  5 07:05:18 rc_service: udhcpc 552:notify_rc start_ntpd
    May  5 07:05:18 rc_service: waitting "stop_ntpd" via udhcpc ...
    
    May  5 07:05:19 custom_script: Running /jffs/scripts/service-event (args: stop ntpd)
    
    May  5 07:05:21 rc_service: waitting "stop_ntpd" via udhcpc ...
    
    May  5 07:05:21 rc_service: waitting "stop_ntpd" via udhcpc ...
    
    May  5 07:05:33 rc_service: skip the event: start_ntpd.
    
    May  5 07:05:38 ntpd: Stopped ntpd
    
    May  5 07:07:04 amtm disk-check: NTP timeout (100s) reached, date is router default
    
    Dec 14 09:37:02 ntpd: Initial clock set
    
    The last line is presumably when I set the ntp manually.
     
  17. FalconB

    FalconB Regular Contributor

    Joined:
    Apr 20, 2017
    Messages:
    95
    I've tried that with no luck. Neither a reboot or restart (power off/on) solves it :(.
     
  18. dave14305

    dave14305 Very Senior Member

    Joined:
    May 19, 2018
    Messages:
    1,767
    Location:
    USA
    When you run the ntp command manually, are you using the hostname ntp.se or an IP address? You call it “address” in your original post, so just checking.
     
  19. FalconB

    FalconB Regular Contributor

    Joined:
    Apr 20, 2017
    Messages:
    95
    I'm using the hostname. I think I tried the ip address also. Either sets the time.
     
  20. dave14305

    dave14305 Very Senior Member

    Joined:
    May 19, 2018
    Messages:
    1,767
    Location:
    USA
    Try running this now to see if the anycast ntp server responds consistently:
    Code:
    ntp -w -p ntp.se