Hey guys, i know, not anoter NTP on Tomato thread! Ok ok, i just wanted to post a quick and simple tutorial to show how it can be done and some optional additions for finetuning. Please lets not get into a discussion again that Tomato´s internal clock gets out of sync quickly and a GPS attached by serialcable is a lot more precise. If you set Tomato to sync every 1-2 hours it is only off by very few seconds between that. In the latest betas Victek has updated Busybox to a new version which comes with a builtin NTP server and he already has integrated it into the Tomato WebUI. So if you want to use a very simple NTP server, look at that. If you want more options to customize it yourself, using a seperate NTPd binary can still be useful. Purpose? In some scenarions it can be useful, or required, to have the same time on all clients, even if that time is not 100% correct with the actual time. For example in retail sales: It is important that all computers that are acting as the sales/cash terminals have the same time as the computers in the backoffice area where employes for example look up receipts etc in the Datawarehouse system. Now in such a scenario it is a different question if you chose to run NTP on the router or another, actual, computer. That is up to you. I am just pointing out the possibilities here. I am using the precompiled binary by ringer004 he has posted here: http://www.linksysinfo.org/index.php?threads/at-last-an-ntp-server-daemon-for-tomato.31599/ (Alternatively you can install ntpd from Entware, should work just as well) Uploading the ntpd binary Download the zip and extract it. Upload the file "ntpd" from it to your router over (S)FTP, for example to /opt or /cifs (whatever extra storage you use). Then make it executable: Code: chmod +x /opt/ntpd Creating the config file Now create a config file that it will use later, here is a simple basic version: Code: # /opt/ntpd.conf # driftfile required to save learned time-adjustments for servers driftfile "/opt/ntpd_drift" # logfile logfile "/opt/ntpd.log" logconfig -allinfo -allevents -allstatistics -allstatus -clockinfo -clockevents -clockstatistics -clockstatus -clockall +syncinfo +syncevents +syncstatistics +syncstatus +syncall -sysinfo +sysevents -sysstatistics -sysstatus -sysall # interfaces broadcast 192.168.1.255 broadcastclient interface drop ipv6 interface listen 192.168.1.1 # ntp servers to get time from server 188.8.131.52 prefer true server 184.108.40.206 server 220.127.116.11 server 127.127.1.0 # default access settings restrict default kod nomodify notrap noquery nopeer restrict 127.0.0.1 mask 255.255.255.255 restrict 127.127.1.0 mask 255.255.255.255 restrict 192.168.1.1 mask 255.255.255.0 nomodify Change the following to match your own setup: - path for drift & log files (make sure the folders exist, the files will be created automatically) - adjust the broadcast and listening IP to whatever your router is - replace the ntp servers with a few of your own that are relatively close to you - adjust the restriction in the last line to match your network Save the file as "ntpd.conf" and upload it to your router too. Starting the daemon Thats it basically. Now you can start the server with: Code: /opt/ntpd -c ntpd.conf (if you put the file in the same folder, else add the path obviously) Testing If your client(s) are Windows based, you can test it the following way: Set your clients clock to a wrong time. Make sure the "Windows Time" service is running. From a command prompt type: Code: w32tm /config /syncfromflags:manual /manualpeerlist:192.168.1.1 w32tm /config /update (Replace the IP with your routers IP) Your clients clock should then adjust itself to the correct time (according to the set timezone). To have the daemon run at startup of the router, i chose to put it in the WANUP script (Administration, Scripts, WAN UP): Code: killall ntpd sleep 1 /opt/ntpd -c ntpd.conf Optional You can give out the adress of you NTP server by DHCP to all your clients. If you want to do that, add the following line to you DNSmasq custom config in the Tomato WebUI: Code: dhcp-option=br0,ntp-server,192.168.1.1 Now your DHCP server will inform your clients on br0 that there is a NTP server on that IP. Unfortunately, Windows & Mac clients do not request and make use of that information. They have to be told manually. But most Linux OS´s should request the NTP and use it. Now you could either set all of your clients manually to use your routers IP for timesyncingthrough the Time & Date options. Or you can redirect the default timeserver DNS to your router. Windows 7 (and i think Vista too) uses "time.windows.com" as the default NTP server. You can add the following additional line to your DNSmasq custom config in the Tomato WebUI: Code: address=/time.windows.com/192.168.1.1 That will redirect all queries to that DNS name to your router. It saves you configuring all your clients manually. Of course if you are using Group Policies/Active Directoy that is not needed. You can do the same if you have Apple Mac clients: Code: address=/time.apple.com/192.168.1.1 address=/time.europe.apple.com/192.168.1.1 address=/time.asia.apple.com/192.168.1.1 Alternatively you can redirect every NTP Port 123 packet to your router. That is a bit more elegant. You could use this line in Administration/Scripts/Firewall: Code: # redirect NTP packets to router iptables -t nat -I PREROUTING -p tcp --dport 123 -j DNAT --to 192.168.1.1 Note that this would redirect your whole network´s NTP requests to your router, regardless of what OS the client is using. Now when you enable "Internet time-syncing" on those clients, it will get the time from your router instead of somewhere else. Thats it. All very simple and nothing special at all. I hope this can be a useful post for some beginners who want to use a Tomato router in a small office network or something similar. Or just to play around with at home. If not, consider it just another pointless spam thread Any input is very much appreciated!