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!

ntpMerlin - NTP Daemon for AsusWRT Merlin

Discussion in 'Asuswrt-Merlin' started by Jack Yaz, Mar 25, 2019.

  1. Jack Yaz

    Jack Yaz Part of the Furniture

    Joined:
    Apr 20, 2017
    Messages:
    2,688
    v2.2.1
    Updated 2020-01-27

    Run an NTP server for your network. Graphs available for NTP accuracy on the Tools page of the WebUI.

    Inspired by kvic's project

    ntpMerlin is free to use under the GNU General Public License version 3 (GPL 3.0).

    This project is hosted on GitHub

    Love the script and want to support future development? Any and all donations gratefully received! PayPal donation

    Supported Models
    Models
    All modes supported by Asuswrt-Merlin. Models confirmed to work are below:
    • RT-AC66U_B1
    • RT-AC68U
    • RT-AC86U
    • RT-AC88U
    • RT-AX88U
    Firmware versions
    You must be running firmware no older than 384.XX Asuswrt-Merlin

    Installation
    Using your preferred SSH client/terminal, copy and paste the following command, then press Enter:
    Code:
    /usr/sbin/curl --retry 3 "https://raw.githubusercontent.com/jackyaz/ntpMerlin/master/ntpmerlin.sh" -o "/jffs/scripts/ntpmerlin" && chmod 0755 /jffs/scripts/ntpmerlin && /jffs/scripts/ntpmerlin install
    
    Usage
    To launch the ntpMerlin menu after installation, use:
    Code:
    ntpmerlin
    If this does not work, you will need to use the full path:
    Code:
    /jffs/scripts/ntpmerlin
    
    Updating
    Launch ntpmerlin and select option u
     
    Last edited: Jan 27, 2020 at 3:12 PM
  2. Jack Yaz

    Jack Yaz Part of the Furniture

    Joined:
    Apr 20, 2017
    Messages:
    2,688
    Screenshots:

    [​IMG]


    [​IMG]
     
    Last edited: Dec 28, 2019
    Vexira, luckyseven, Evictoria and 3 others like this.
  3. Butterfly Bones

    Butterfly Bones Very Senior Member

    Joined:
    Apr 10, 2017
    Messages:
    1,098
    Location:
    USA
    Thank you, I tired this on my AC86U about a year ago and had problems getting it to work. At the same time I was trying to setup syslog-ng and had more serious issues. I finally gave up on both.

    I just ran this script and it was so quick and painless I almost thought it did not work.

    Now the question is does it use the time server settings in the router? No reason to think otherwise, I just had too many attempts to contact servers in countries that I would rather not have connection attempts.

    This looks like another candidate for @thelonelycoder to add to amtm menu. :D
     
    JemTheWire and L&LD like this.
  4. EmeraldDeer

    EmeraldDeer Very Senior Member

    Joined:
    Dec 22, 2017
    Messages:
    552
    Location:
    Massachusetts
    No, ntpd uses the time server settings in /jffs/configs/ntp.conf. By default this is pool.ntp.org servers which use geolocation DNS. However, I have noticed inconsistent results. You may want to use more specific pool servers such as 0.us.pool.ntp.org.
     
    skeal, L&LD and Butterfly Bones like this.
  5. Butterfly Bones

    Butterfly Bones Very Senior Member

    Joined:
    Apr 10, 2017
    Messages:
    1,098
    Location:
    USA
    Ok, I added the four suggested on the NTP site for the us, 0-3 as you show. Now I am getting results in the graph, before that change it was not showing anything.
     
  6. cmkelley

    cmkelley Very Senior Member

    Joined:
    Aug 11, 2015
    Messages:
    1,027
    Location:
    Greater Los Angeles Area, California, USizicstania
    ACK!!! Jack, please use logger, not sed to write to syslog. Those of us that use syslog-ng almost as a rule have syslog.log symlinked to a file on a USB device. When you sed to it you destroy the symlink.
     
    Last edited: Mar 26, 2019
    Butterfly Bones likes this.
  7. Butterfly Bones

    Butterfly Bones Very Senior Member

    Joined:
    Apr 10, 2017
    Messages:
    1,098
    Location:
    USA
    That was my original problem a year back trying to setup syslog-ng, was the symlink being killed. This is too bad, I like this graph. :oops:
     
  8. cmkelley

    cmkelley Very Senior Member

    Joined:
    Aug 11, 2015
    Messages:
    1,027
    Location:
    Greater Los Angeles Area, California, USizicstania
    Misread the sed line, Jack is deleting something from the syslog, not writing to it. Same problem, please don't do that either Jack. :)
     
  9. JDB

    JDB Very Senior Member

    Joined:
    Aug 28, 2016
    Messages:
    963
    Just need to add --follow-symlink to the sed command


    Sent from my iPhone using Tapatalk
     
  10. cmkelley

    cmkelley Very Senior Member

    Joined:
    Aug 11, 2015
    Messages:
    1,027
    Location:
    Greater Los Angeles Area, California, USizicstania
    --follow-symlink isn't compiled into busybox's sed. Using that would require installing Entware's sed.
     
  11. Jack Yaz

    Jack Yaz Part of the Furniture

    Joined:
    Apr 20, 2017
    Messages:
    2,688
    Sadly dropping that line means a cron line being printed every 5 minutes. Syslog-ng users feel free to comment the line in the script for the time being - until I can find a way to keep everyone happy
     
    Butterfly Bones and L&LD like this.
  12. Jack Yaz

    Jack Yaz Part of the Furniture

    Joined:
    Apr 20, 2017
    Messages:
    2,688
    And on that note... I think I've got something

    @cmkelley could you confirm how/where you symlink the log files to?
     
  13. cmkelley

    cmkelley Very Senior Member

    Joined:
    Aug 11, 2015
    Messages:
    1,027
    Location:
    Greater Los Angeles Area, California, USizicstania
    /tmp/syslog.log -> /opt/var/log/messages

    /tmp/syslog.log-1 doesn't exist
     
    Jack Yaz likes this.
  14. cmkelley

    cmkelley Very Senior Member

    Joined:
    Aug 11, 2015
    Messages:
    1,027
    Location:
    Greater Los Angeles Area, California, USizicstania
    Also, slightly off-topic, but is there a way I can route all ntp traffic EXCEPT from one particular IP on my network to be routed to that same IP? I have a gps-driven time server on an RPi, so my ntp.conf file on the router just points to it (I take a perverse pleasure in seeing that my network time is accurate to ~10 usec). I think I read somewhere it's not a good idea to use a GPS timeserver completely stand-alone, it should point to some external time servers as well. Can't remember the logic behind that though.
     
  15. Jack Yaz

    Jack Yaz Part of the Furniture

    Joined:
    Apr 20, 2017
    Messages:
    2,688
    Yes, I think you can add -s ! IP to the dnat rule in the script

    (if not that, then ! -s IP)
     
  16. JDB

    JDB Very Senior Member

    Joined:
    Aug 28, 2016
    Messages:
    963
    Given this script now relies on entware anyway is that an issue


    Sent from my iPhone using Tapatalk
     
  17. cmkelley

    cmkelley Very Senior Member

    Joined:
    Aug 11, 2015
    Messages:
    1,027
    Location:
    Greater Los Angeles Area, California, USizicstania
    Entware's sed is not automatically installed with Entware. If we can get away with not requiring it, so much the better.
     
  18. Jack Yaz

    Jack Yaz Part of the Furniture

    Joined:
    Apr 20, 2017
    Messages:
    2,688
    My current idea shouldn't require any additional packages. I would script it to test now but its 6.30am and my wife and pets are still quietly asleep, so I'm reluctant to disturb them!

    I have to get up around 7 anyway to take the dog for a walk, so there should be time for a small update this morning
     
    QuikSilver and L&LD like this.
  19. JDB

    JDB Very Senior Member

    Joined:
    Aug 28, 2016
    Messages:
    963
    Guess it’s easy enough to sed to a tmp file and then cat it into the original - that would follow the symlink and is all that -i does anyway.


    Sent from my iPhone using Tapatalk
     
  20. ColH

    ColH Occasional Visitor

    Joined:
    Sep 12, 2012
    Messages:
    15
    Code:
     Checking ntpd...              dead.
     Starting ntpd...              failed.
    ntpq: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory
    
    Receive the above when running the script; what am I missing?