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 18.104.22.168 ;; Query time: 116 msec ;; SERVER: 22.214.171.124#53(126.96.36.199) ;; 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 firstname.lastname@example.org'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 188.8.131.52
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 184.108.40.206 time timezone -360
And that it!
Latest posts by Jeff Staten (see all)
- Configure Your HP Procurve Switch with SNTP - May 5, 2015
- Configuring HP Procurve 2920 Switches - May 1, 2015
- Troubleshooting Sendmail - November 28, 2014
Thanks for your article. Very clear!
How do you set this up for Daylight savings time?
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.