What is NTP/SNTP Protocols, How NTP works

What is NTP/SNTP Protocols, How NTP works

The Network Time Protocol is a Networking Protocol which is used to synchronize time for nodes in a Network. NTP is one of the oldest protocol in the TCP/IP stack which is still in use. NTP is intended to synchronize all participating computers to within a few milliseconds of Coordinated Universal Time (UTC).
The protocol is usually described in terms of a client-server model, but can as easily be used in peer-to-peer relationships where both peers consider the other to be a potential time source.

How NTP works

NTP works on IP port – 123 and to run NTP we first install NTP daemon (ntpd) on both Time Provider(server) and Time Consumer(client)

The NTP client initiates a time-request exchange with the NTP server. As a result of this exchange, the client is able to calculate the link delay and its local offset, and adjust its local clock to match the clock at the server’s computer. As a rule, six exchanges over a period of about five to 10 minutes are required to initially set the clock.

Once synchronized, the client updates the clock about once every 10 minutes, which prevents the time drift from happening. In Other words ,large adjustment are made quickly and small adjustment are made over a period of time.

NTP Stratum


NTP uses the concept of stratum to define the hierarchy of NTP servers. At top of the hierarchy are Stratum 1 which gets their time from Atomic clocks which tells exact time at the moment.

Similarly Stratum 2 time providers get their time from Stratum 1 time provider and Stratum 3 from Stratum 2. And these stratum can go upto 256 layers.

There are many Stratum 2 servers available on the public internet which we can use for couple of PC. But if you have large number of PC’s in the network it is wise to create a local stratum (maybe 2-3) which get its time from Stratum 2 time provider and PC’s in your local network can get time from its local Stratum.

Some important terms related to NTP

Stepping: When time difference between consumer and provider is large then time adjust are made more quickly ~1min.

Slewing: When time difference is very less ~128ms the ntp will adjust time gradually around every 17 minutes

Insane Time: If time difference between consumer and provider is more than 17 min, then ntpd treats that time to be insane.

Drift: Your clock will drift due to fluctuations in the frequency oscillating the quartz crystal on your motherboard. A fluctuation of just 0.001% (0.00001, or 10 PPM) means losing or gaining about 1 second per day.

Latency: The time delay between when data is sent on a network to when it is received. Latency can make it difficult to synchronize processes over a network, especially when the latency is variable. The latency is added to the time it got from server to get the exact time.

Jitter: It is a measurement of the variance in latency on the network. If the latency on the network is constant, there is no jitter.

Configuring NTP

Here we will see how to configure a system to use NTP

#installing NTP on linux machine
yum install ntp
apt-get install ntp

Now we will edit the server for NTP. Open the file /etc/ntp.conf

And edit the server info as [server server_address]

you can get list of server from https://www.pool.ntp.org/en/. From the website choose the server closest to your geographical location.

Remembered, previously we talked about Insane Time (where system and server time difference is more than 17min), to prevent such situation we run below command to update the system time (close to actual time) to eliminate insane time issue

ntpdate server_address

#you can use google public ntp server 
#sometimes you need to run it more than once
ntpdate time.google.com

Note : Before running the above command make sure to turn of ntpd by [ntpd off] and start after executing above command [ntpd on].

Monitor time synchronization : ntpq -p , ntptrace
Log File of NTP :  /var/log/ntp.log

How is SNTP different from NTP ?

Simple Network Time Protocol (SNTP) is a simplified, client-only version of NTP. SNTP can receive only
the time from NTP servers; it cannot be used to provide time services to other systems.

SNTP typically provides time within 100 milliseconds of the accurate time, but it does not provide the complex
filtering and statistical mechanisms of NTP. In addition, SNTP does not authenticate traffic, although you
can configure extended access lists to provide some protection. An SNTP client is more vulnerable to servers
that have unexpected behavior than an NTP client, and should be used only in situations where strong
authentication is not required.

So that all to get the basics of NTP protocol if you are more interested to dig in, do visit Cisco NTP

What is GIT and GitHub | The Ultimate Difference


Many people who have just started to work in a collaborative environment encounter with the term Git and most of the time they are not able to differentiate between Git and GitHub. Here in this post we learn about Git and GitHub and see how are they related to each other. Also, Git was created by Linus Torvalds (the mastermind behind Linux) and is written in C#.


First, we will understand what is GIT :

Git is a piece of software which increases our efficiency while writing the code. Git is a Version Control System: manages the changes in your code with time, other VCS tools being – Apache Subversion, CVS, Mercurial. It also provides collaboration between different members of the team.

The directory which contains your code and its dependencies is called a Repo (repository). In Git we have 2 different repos

  1. Local Repo: modified by an individual developer and resides in the local PC of developer
  2. Central Repo: acts as the main repo and resides on a server, all developers make changes to the local repo and push it to the central repo.
Workstations are local PC of Developers, Repository is the local repo of developers and on top we have central repo.

Some feature of Git :

  • Distributed Version Control System
  • Git uses SSH to connect to the central repo
  • In the local repo, there is a folder named [.Git] which contains info about your local repo
  • Many developers can work on a single project at a time
  • We always have a backup of code in local repos, in case the central repo fails

Click here to know about Git Commands

What is GitHub :

GitHub is nothing but a company that allows you to host your central repo on the Internet. You can even create a central repo in your local network but it can’t be accessed over the internet.

GitHub.com has created a user-friendly design and easy to manage the central repo, but at its core its just a central repo on the internet.

On GitHub, you can create a repository for every project you are working on. GitHub offers you unlimited public central repo(can be seen by anyone on the internet) and private central repo with a limitation of max 3 developers working on the project.

It’s always a good idea to create a readme file in your repo as it helps an unknown person to get a brief idea about your project. And people who have added their ssh key to the central repo server can modify the code.

So, in a nutshell, Git is a piece of software which helps to manage our code and GitHub.com is a website which allows us to use a feature of Git which is central repo.

Anatomy Of Internet Of Things : Hardware & Services

internet of things green linked image

Internet of Things is a buzzword these days in the IT sector. With all new devices and services introduced everyday and big players of IT industry like Google and Apple launching there IOT devices, it looks like its going to be a big breakthrough in the world.

internet of things green linked image

Though many people are aware of the concept of Internet of Things but certainly they don’t have enough knowledge regarding the hardware and software used.

Here at Weock we have dissected the concept of IOT in a way so that all the scattered pieces in the mind of our audience are joined together.

The Hardware Squad

The hardware squad make up the visible section of your project. It consists of all the sensor, boards and communications devices.

A. IOT Devices

These devices make up the mainframe of you IOT project

1. Embedded System Boards

The embedded system boards are the brain of your project in which your program will run. You might even have one of these boards with you

  • Arduino
  • Raspberry Pi
  • Intel Galileo
  • Gadgeteer
  • Beaglebone
  • Cubieboard
  • Electric Imp
raspberry pi iot
Raspberry Pi

2. Wearables

These are the devices which can be worn on your body and they will collect data and give information. If you are not a hardware freak then you can buy one of these wearables and start writing programs.

  • Google Glass
  • Samsung Gear 2
  • Pebble Watch
  • Misfit Shine
  • Android Wear
samsung galaxy gear 2
Samsung Galaxy Gear 2

B. Sensors and Actuators

Sensors and Actuators are the devices which collect data and act on the environment.

(we will be explaining each of these devices very soon)


1. Sensors

Sensors collect data from environment and give the data to microcontroller for processing

  • Temperature Sensor (eg. DHT11)
  • Light (eg. LDR, IR)
  • Radio (eg. RF and FM)
  • PIR motion Sensor
  • Ultrasonic Sensor (eg. HC-SR04)
  • Air Quality Sensor
PIR Sensor

2. Actuators

Actuator are electronics devices which act on the environment based on instructions given by micro-controller

  • Servo Motor
  • Gear Motor

3. Display

Used to display necessary information

  • TFT
  • 7 segment display
  • LED
  • LCD display

4. Relay and Switches

Used to turn devices ON/OFF

C. Smart Devices (connectivity)

These are modules which help in establishing communication between various devices

  • GPSgsm module iot
  • GSM
  • BLE
  • WIFI
  • GPRS
  • RFID
  • NFC


The Platform and Services Squad

These are the technologies which are currently being used in the field of Internet Of Things.

  1. RIOTifttt-logo
  2. Carriots
  3. Lithouse
  4. Sensinode
  5. IFTTT (if this than that)
  6. Arrayent
  7. Alljoyn
  8. ioBridge

Congratulations, if you read the whole article then you have successfully dissected the giant know as Internet Of Things. These are all the concepts which make up the IOT.

If you like our article then Share US among your friends and please give your suggestions and feedback.