Configure Your HP Procurve Switch with SNTP

HP-2920-48G-PoE

HP’s Procurve 2920-48G and 2920-48G-PoE+ Switches

When you get a new HP Procurve Switch, you want to configure it so that the time is correct.  This helps to make your logs, monitoring, etc… all be more useful and time relevant.  Additionally, in a prior article (Setup NTP on CentOS Linux), we discussed NTP and how to configure it in a Linux box.  Today, we will configure your HP 2920 Procurve switch to get its time from NTP servers.

Choose an NTP Server for Your HP Procurve Switch

NTP or SNTP (Simple Network Time Protocol) will allow your machine to query time servers on the internet to know what time it is and set its own internal clock accordingly.  First, let’s get the IP address of a time server.  I chose time1.google.com and resolve the address using a tool like ping or dig:

$ dig time1.google.com

; <<>> DiG 9.8.3-P1 <<>> time1.google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 20815
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;time1.google.com.        IN    A

;; ANSWER SECTION:
time1.google.com.    86400    IN    A    216.239.32.15

;; Query time: 116 msec
;; SERVER: 208.67.222.222#53(208.67.222.222)
;; WHEN: Tue May  5 22:17:35 2015
;; MSG SIZE  rcvd: 50

Configure Your HP Procurve Switch with SNTP (Simple Network Time Protocol)

So, now that we have an SNTP server to use, let’s configure our switch to query it.  We do this, by logging in to your switch with either the console, ssh, etc…

$ ssh -l manager 192.168.10.11
manager@192.168.10.11's password:
HP J9729A 2920-48G-POE+ Switch
Software revision WB.15.12.0015

Copyright (C) 1991-2014 Hewlett-Packard Development Company, L.P.

                   RESTRICTED RIGHTS LEGEND
 Confidential computer software.  Valid license from HP required for possession,
 use or copying. Consistent with FAR 12.211 and 12.212, Commercial Computer
 Software, Computer Software Documentation, and Technical Data for Commercial
 Items are licensed to the U.S. Government under vendor's standard commercial
 license.
                   HEWLETT-PACKARD DEVELOPMENT COMPANY, L.P.
                   20555 State Highway 249, Houston, TX 77070

Press any key to continue
Your previous successful login (as manager) was on 1990-01-01 03:11:23
 from 192.168.0.65

Now that we are logged in to the switch, let’s enter configuration mode

USDRO-A01# config t

now that we are in configuration mode, we can begin to configure it for sntp.  We begin with the timesync command:

USDRO-A01(config)# timesync sntp

Next, we tell it how many SNTP servers we are going to query.  We use unicast for one, or broadcast for multiple.  In my case, I am using unicast:

USDRO-A01 (config)# sntp unicast

Now, we tell it the SNTP server that we want to query.  We also set the priority.  If we only have 1 server, it is easy, but if we have multiple SNTP servers in the list, then the priority becomes important.  In the case where there are multiple SNTP server, the lowest number is the highest priority.

USDRO-A01 (config)# sntp server priority 1 216.239.32.15

Finally, we need to set the offset for the time zone that we are in.  This offset is set in minutes.  My timezone (Mountain is -6 hours away from GMT).  So, I multiply the number of hours by 60 and use that.

USDRO-A01 (config)# time timezone -360

And that should do it.  We can now test to be sure that our switch has the correct time set:

USDRO-A01(config)# time
Tue May  5 22:45:07 2015

Putting It all Together

Here is all of the configuration altogether:

timesync sntp
sntp unicast
sntp server priority 1 216.239.32.15
time timezone -360

And that it!

The following two tabs change content below.
Jeff has 20 years of professional IT experience, having done nearly everything in his roles of IT consultant, Systems Integrator, Systems Engineer, CNOC Engineer, Systems Administrator, Network Systems Administrator, and IT Director. If there is one thing he knows for sure, it is that there is always a simple answer to every IT problem and that downtime begins with complexity. Seasoned IT professional by day, Jeff hopes to help other IT professionals by blogging about his experiences at night on his blog: http://uptimemadeeasy.com. You can find Jeff on or LinkedIn at: LinkedIn or Twitter at: Twitter

Latest posts by Jeff Staten (see all)

4 comments for “Configure Your HP Procurve Switch with SNTP

  1. November 10, 2015 at 4:47 am

    Thanks for your article. Very clear!

  2. m e holdstock
    March 29, 2016 at 10:36 am

    thank you

  3. Tony
    July 25, 2016 at 3:41 pm

    How do you set this up for Daylight savings time?

  4. Thomas
    September 20, 2016 at 11:48 am

    Tory:
    Use the following command:
    time daylight-time-rule (your region, e.g. western europe)

    The time command should reflect correct daylight savings changes (if any) after that command.

Leave a Reply

Your email address will not be published. Required fields are marked *