A WGR614L as an NTP Time Server? Hmmm...

3 posts / 0 new
Last post
Drone
Drone's picture
A WGR614L as an NTP Time Server? Hmmm...

Hello All - I wonder if it would be possible to make an NTP time server out of the WGR614L. Does the WGR614L have a real-time-clock? If so, is it half-way decent (like within 10 seconds a day)? Does it have one or two serial UARTs like the Linksys WRT54GL? What about GPIO? There needs to be a way to get a reference into the box. What about the CPU crystal or resonator. Can it be replaced by a clock generator? What's the frequency?

Quite a while ago I looked at doing an NTP server like this, the target was my Linksys WRT54GL to which I added two "real" RS-232 ports, one as a console and the other to receive the 1pps reference. But there were issues: The WRT54GL's RTC was awful. I wouldn't trust it for any amount of hold-over time and I can imagine NTP having trouble with it at all times as well. Also, I couldn't find an NTP package for the distros available at the time, DD-WRT and OpenWrt if memory-serves. NTP is preferred but I could live with an OpenNTP package if it were available. I'll look at the current distros to see what's new with NTP. But moving forward is pretty much a waste of time unless I know at least about the RTC situation, serial ports and GPIO possibilities with the Netgear device. I don't own one of these boxes, they're not sold where I'm living. But I could have one sent from the U.S. if it looked promising.


Update
: According to Nachi's blog at (sorry my "Inster/Edit Link" button doesn't work):

http://www.myopenrouter.com/blog/entry/10062/WGR614L---Router-for-develo...

The WGR614L uses a MIPS-based processor (I don't know more than this about the processor so-far) and a Broadcom BCM5354 WiFi-Router-Ethernet Switch SOC. The BCM5354 has in addition to memory WiFi and Ethernet interfaces at least one USB2.0 port, 8-GPIO, JTAG, and at least one UART (Yay!) Now, if only the UART is physically accesible and can be made to function as a general purpose port and not just as a console port.

Unfortunately for the 8 GPIO pins, it looks like there are 8 LEDs on the front of the WGR614L. (If Netgear used all the GPIOs for the LEDs, that wouldn't be very Hacker-friendly would it?)

Maybe it's possble to hijack one or more of the GPIO pins and give up the corresponding LEDs? Hijack two GPIOs and make them an I2C master, then you can do almost anything including lite the hijacked LEDs through an I2C GPIO expander. Heck if the system RTC is missing or lousy one could put an I2C RTC in! I should look at that with my Linksys WRT54GL.

Update: It looks like there is at least one UART port accessible on the WGR614L; it is the console(?), so you probably don't want to give it up. This article at the link below describes the hardware and how to recover firmware via the console with a WIndows PC. The article can be confusing at fist as the author uses a serial to USB converter cable for console access. The USB end plugs into the PC. This converter cable is used as many PC's these days don't have a serial port. If you have a serial port I would think you can skip the converter cable parts. The actual firmware update takes place via TFTP but you need access to the console as well.

http://www.myopenrouter.com/article/10341/Recover-Your-WGR614L-Using-a-S...

What are all those other pins for near the console connection? Anyone figure that out yet? 

Best Regards, David

stevea
stevea's picture
I've implemented (or assisted

I've implemented (or assisted) NTP servers on x86 Linux twice. It is not trivial. It requires a modified Linux kernel and the use of a GPS unit to provide the accurate timebase to create a low accuracy strata 0 server. A GPS produces info which indicates the current second and ALSO (most important) a 1PPS (one pulse per second) electrical signal that is accurate to within about 1 nanosecond. The 1PPS has to create an interrupt to the CPU and then the kernel mods track the value against the local clock and keep/create stats that allow it to serve time data accurate only to around 1 microsecond or slightly better.

You *MIGHT* be able to buy a GPS(some $100 units have the 1PPS line) mod the kernel, add the 1PPS to a gpio type signal line, write the special interrupt handler, and port the userspace server programs. It is highly impractical IMO.

Also please note that 1 NTP server does no good at all. To get an accurate time, the highly complex NTP protocol requires clients to compare and take differnces between 3 servers.

I believe you really don't need an NTP server. I would suggest that instead of trying implement a simple NTP server, you should try to make the router into an NTP client to sync the router time accurately to the universe(dd-wrt does this I believe) and then use a simple protocol like port 13 "daytime" protocol to set times on your systems on the local LAN. You should be able to set system times to within ~50-100 milliseconds this way. [[maybe there is another simple protocol I'm not aware of - but NTP is a big deal to implement]].

Drone
Drone's picture
stevea,

stevea,

I am familiar with NTP. I do not agree with your opinion that NTP is a big deal to implement, I have implemented several NTP servers and found it quite easy to do. You do not need to have a GPS disciplined 1PPS reference. It is quite simple to implement an NTP server that references to other stratum-1 or 2 servers over the Internet alone and still provide time within 10's of milliseconds or significantly less.

That said, I have several GPS disciplined references with 10MHz, & 1PPS outputs. One of the references is home-brew. It is as good as commercial units when locked and costs less than $150 USD in parts. But at that price there's no long-term hold-over when un-locked.

To say that one NTP server is of no use at all as it does not keep accurate time is not true. It is not about accuracy, it is about trust. It is better to have at least one, better-yet two or more peers in order to greatly improve trust. A stand-alone stratum-1 server still has value as a timekeeper, but your trust is compromised as there are no peers to compare with. One might argue that without any peers, there is zero trust and therefore the server has no value. But in reality you know that is not the case - it all depends on how dependent your applications are on timekeeping. If I had a network that was absolutely dependent on timekeeping I would always use peers and stratum-1 reference the server. If I had a small office with twenty desktops and just wanted my desktops to reference a local time server several times a day instead of going outside for time-keeping, then I would be fine with a stand-alone server that was not stratum-1 referenced, just referenced over the Internet.

I do need an NTP server. The daytime service you mention (RFC-867) could be considered deprecated these days. Most machines on the LAN are Windows desktops (not my choice), they don't support daytime, but do support SNTP and NTP variously. In addition, on UNIX and UNIX-like systems I believe daytime is built into inetd, and these days most if not all services are removed from inetd.conf for security reasons.

In conclusion, a small low-cost Intrenret-only referenced NTP server has value in a small office, SOHO environment in my opinion. A hacked router running Linux or BSD is an ideal candidate. It is icing on the cake to be able to reference the device with 1PPS as I would like to do. In any case, a fairly stable system clock is required, and that's where these router boxes fall apart, at least that's what I found with the Linksys WRT54GL. NTP couldn't cope with the drifty system clock in any amount of hold-over. And that's not good. I hope the Netgear box is better.