Tag Archives: lan

local time sync through LAN using ptpd on ubuntu.

Source from: http://www.theperfectarts.com/2009/11/how-to-change-timezone-on-linux-server/#.UtZ-ABXI9ok

You can change the time zone for your server by using following command.

root@admin[~]#date

Wed Nov 11 19:30:29 EST 2009

For example we are changing time zone  from EST to GMT.

root@admin[~]#ln -sf /usr/share/zoneinfo/GMT /etc/localtime

root@admin[~]#date

Using the above command make sure systems you want to sync have the same timezone before using ptpd.

 

Source from: http://dev.couchrausch.de/degenhard/setting-up-ptpd-in-a-local-lan/

This is a short tutorial on setting up the Precsision Time Protocol (PTP) in a local LAN to synchronize time between the conneted hosts.

PTP is in comparison to NTP designed for matching the timebase of local host regardless the actual real worlds time.
It measures the delay a messaege has to get from peer A to peer B and calulates the resulting offsets so A and B have the exact same timebase.
A video explaining very friendly how it works can be found here PTP Introduction.

We suppose that you are running two debian (or similar) hosts in a local LAN with subnet address 192.168.1.0.

First step is to disable the probably running NTP daemon.
sudo /etc/init.d/ntp stop
Then prevent it from starting again at boot time.
sudo update-rc.d -f ntp remove
Now get the ptpd package via apt-get:
sudo apt-get install ptpd

First you can test by starting ptpd on the commandline to see if all is working.
Choose the master and type:
ptpd -c -b eth0 -h -D

On the slaves use same command with the -g switch:
ptpd -c -g -b bond0 -h -D

It takes some seconds to start, but then you should see the slave starting to print stats.

To activate the daemon, so it starts at boot time edit the /etc/defaults/ptpd file.
Change
START_DAEMON=no to yes
and add the commandline switches to
PTPD_OPTS=”-b bond0 -h” for the master and
PTPD_OPTS=”-g -b bond0 -h” for the slaves.

that should be all you have to do.