Wireless Ethernet Bridge -- No Current Time

Discussion in 'Tomato Firmware' started by digixmax, Jan 20, 2019.

  1. digixmax

    digixmax LI Guru Member

    In looking further into why my Wireless Ethernet Bridge (WEB) router (running FreshTomato 2019.1) cannot get the current time on Status->Overview page I discovered that my WEB router does not have a default route in its routing table and the two files ntp.conf and resolv.dnsmasq (which resolv.conf is symbolically linked to) are missing in its /etc directory. This is in spite of the fact I have configured Default Gateway and Static DNS entries in basic->Network as well as NTP entries in Basic->Time.

    So, I configured in Advanced->Routing the default route:
    Code:
    0.0.0.0 192.168.1.1 0.0.0.0 0 LAN
    
    and added the following lines in Admin->Scripts->Init
    Code:
    echo "nameserver 192.168.1.1" > /etc/resolv.dnsmasq
    echo "server 0.us.pool.ntp.org" >> /etc/ntp.conf
    echo "server 1.us.pool.ntp.org" >> /etc/ntp.conf
    echo "server 2.us.pool.ntp.org" >> /etc/ntp.conf
    
    But I found that I still have to do a "Save" back in Basic->Time after each reboot in order to get the current time on Status->Overview.

    What command can I add at the end of my Init Scripts to trigger an NTP query?
     
    Last edited: Jan 22, 2019
  2. Mr9v9

    Mr9v9 Serious Server Member

    Try something like:
    Code:
    ntpc pool.ntp.org
    Other than that usually in Linux it would be something like this in rc.local:
    Code:
    ( /etc/init.d/ntp stop
    until ping -nq -c3 1.1.1.1; do
       echo "Waiting for network..."
    done
    ntpdate -s time.nist.gov
    /etc/init.d/ntp start )&
    Another way would be to set timezone by the timerserver IP manually, but I don't think this works in this case:
    Code:
    sntp -s timeserverip or time.nist.gov
     
    digixmax likes this.
  3. digixmax

    digixmax LI Guru Member

    Thanks for the suggestions, but those commands you suggested don't seem to exist in Tomato, as I got error message "<cmd>: not found" when trying them using Tools->System Commands. I also tried "service ntpd restart" which yields a "Done." but still no Current Time.
     
  4. Mr9v9

    Mr9v9 Serious Server Member

    Really? I just tried my first command and I get:
    Code:
    Trying pool.ntp.org [23.131.160.7]:
     
    Time: Sun, 20 Jan 2019 11:34:39 -0700, no change was needed. 
    I am running the last Shibby release though.
     
  5. digixmax

    digixmax LI Guru Member

    I tried ntpc on two other routers (RT-N16), one running Shibby 132 AIO the other FreshTomato 2019.5 AIO: ntpc does indeed exist in the Shibby build but apparently not in the FreshTomato build!

    But on the router where ntpc does exist, the command timed out on me, unless I use a NTP server IP address instead of its DNS name.
     
    Last edited: Jan 20, 2019
  6. digixmax

    digixmax LI Guru Member

    OK, I think I found the answer: based on the info from this old post https://www.linksysinfo.org/index.p...and-line-via-ssh-or-telnet.26491/#post-124238, I added two command lines "service ntpc stop" and "service ntpc start" to my original Init Script, and the Current Time would show up after each boot/reboot.

    My complete Init Script to get Current Time now contains:
    Code:
    echo "nameserver 192.168.1.1" > /etc/resolv.dnsmasq
    service ntpc stop
    service ntpc start
    Be sure to add the default route in Advanced->Routing:
    Code:
    0.0.0.0 192.168.1.1 0.0.0.0 0 LAN
    Note: it takes ~1-2 min after boot up for the Current Time to get displayed.
     
    Last edited: Jan 21, 2019
    RBoy1 likes this.
  7. Magister

    Magister LI Guru Member

    Starting with Freshtomato 2018.5 you do not need to modify the etc/resolv file. The bug was fixed.
    I clear NVRAM, setup as wireless ethernet bridge (minimalist setup: disable wan/dhcp, set IP to 192.168.1.2, default gateway to 192.168.1.1, radio as ethernet bridge with the credential of the main router).
    Time is working because the resolv.conf is not overwritten/deleted by something.
     
    pedro311 likes this.
  8. digixmax

    digixmax LI Guru Member

    Thanks for taking interest and looking into this problem.

    I had also started with clear nvram and with the same minimalist configuration as you did (except I also had the WEB router set as "router" instead of "gateway" under Advanced->Routing, although as far as I can recall, using the "gateway" option didn't seem to make a difference in this case) but it did not work for me on 2018.5 or 2019.1-beta.

    What I found is /etc/resolv.conf is symbolically pointed to /etc/resolv.dnsmasq which itself is missing (see attached screencap image below), hence my script-line "echo "nameserver 192.168.1.1" > /etc/resolv.dnsmasq" as a workaround fix.

    This problem exists on all 3 router platforms running different build types that I have set up as WEB: WNR3500 (MiniIPv6), RT-N16 (AIO), R6300v2 (VPN).

    Which router model do you use as WEB without this problem?
     

    Attached Files:

    Last edited: Jan 21, 2019
  9. Magister

    Magister LI Guru Member

    I have an E3000 used for bridge, I kept the setting as gateway, my /etc/resolv.conf also is a link, but it exists and contains:

    # dns for wan:
    nameserver 192.168.1.1

    oh I see, in the basic config, under the Default Gateway set to 192.168.1.1, I also set the Static DNS to 192.168.1.1
     
  10. digixmax

    digixmax LI Guru Member

    I too have these two entries for Default Gateway and Static DNS in my setup.

    I also just again tried the "gateway" option -- it makes no difference.
     
  11. digixmax

    digixmax LI Guru Member

    I should add that this problem of no "Current Time' for WEB first manifested on Shibby multi-Wan builds. So it looks like the bug fix you observed with 2018.5 didn't get picked up in every build across all combinations of router models and build versions.
     
    Last edited: Jan 21, 2019
  12. synapse46

    synapse46 Serious Server Member

    I have an 868L setup as WEB and I set the NTP server to North America, found time was not getting set. Initially I did not have a DNS server set, I added the main router for DNS in the basic network settings and router as the WEB began showing the correct time. The WEB is using 2018.5 firmware.
     
  13. RBoy1

    RBoy1 Serious Server Member

    ignore....double post
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice