How to synchronize time between 2 WRT54G routers running on Openwrt?

August 16, 2006 at 9:32 pm Leave a comment

This short tutorial documents the process that I took to synchronize time between 2 WRT54G routers.

I needed this function because I wanted to send log files out of the different nodes at the same time. Well, we all know that WRT54G routers don’t have on-board clocks so it’s hard to sync. But anyway, this actually works for me cause it makes it easier for me to time my experiments and run my cron jobs when they all start from 0. This is a complete trial and error thingy that yielded the results I wanted, so follow at your own risk.

Ok, enough crap, I gotta run some experiments later, so here goes:

Let’s call the router that you want to sync your time TO as S (I was thinking of server).

Let’s call the router that you want to sync as C (client in this case).

On S, perform the following 2 steps:

  1. Go download and install the Openntpd package. I used the web interface on the Openwrt.
  2. The next step is to open up /etc/ntpd.conf file and do this:
    1. Comment out the ping server portion if you want to keep your time as 0.
    2. Add in this: listen on <the_ip_address_of_S>

Apparently, we have to do this, so that S can listen for any requests coming in. If not I will get this “Connection Refused” error message when C tries to sync with S’s time.

On C, do the following:

  1. Download ntpclient package.
  2. To synchronise time, type in command line: ntpclient -s -h <the_ip_address_of_S>

Okies, presto! Type date on both routers and they should yield the same time. Enough for you to run experiments for a day 🙂

I am planning to use a cron job to execute C’s second instructions. Will do a cron job tutorial for dummies when there’s time.

Advertisements

Entry filed under: Openwrt, Technology.

How to get Openwrt boxes to scp to each other in a mesh topology? From good to great… tHimerosa style.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


August 2006
M T W T F S S
« Jul   Sep »
 123456
78910111213
14151617181920
21222324252627
28293031  

Recent Posts

Blog Stats

  • 34,830 hits

%d bloggers like this: