Setting up NTP on HP Switches – HP Networking Series Part 3

This is a short guide on how to set up NTP time synchronisation on HP Network devices. I’ll be covering SNTP settings in this guide, as well as some of the niftier things that aren’t in the manuals but still are really handy. NTP time synchronisation allows you to maintain correct time across your network, which is very important for troubleshooting when comparing logs between two switches for example.

Write the old config to memory

Start by issuing the command “write memory” before you do anything, that way you can boot the switch to recover your previous settings if you mess something up.
If you’re doing this over Telnet/SSH and the switch is miles away, you might want to consider using the reload command as well to tell the switch to reboot after a couple of hours if you loose access to it, see my article on how to do this.

Configuring General Time Settings

First, we need to configure stuff like time zone and DST (Day-Light Savings Time) rules.
Enter config mode by typing “configure”

SW1# configure 
SW1(config)#

Now we’ll set the DST rule:
Type “time day” and hit tab to autocomplete. Hit tab again to show you the available options.

SW1(config)# time daylight-time-rule 
none 
alaska 
continental-us-and-canada 
middle-europe-and-portugal 
southern-hemisphere 
western-europe 
user-defined

Write the beginning of the option you want, hit tab again, and hit enter. I’ll use “western-europe” here in Finland.

SW1(config)# time daylight-time-rule western-europe

Then, we’ll set the time zone with the following command:

SW1(config)# time timezone +120

This sets the normal (non-DST) time to GMT+2, so after timezone, type you GMT offset in minutes.

Configuring SNTP Time Synchronisation

First, we’ll set the timesync setting to sntp

SW1(config)# timesync sntp

That’ll enable SNTP, so now that we’ve got that sorted, let’s move on to configuring SNTP with the “sntp” command.

First, we’ll set the SNTP mode to unicast:

SW1(config)# sntp unicast

Then we’ll add the settings for which server to query for time.

I’ll paste the console output here so you can see how it’s done IRL, and remember that if you hit tab in the middle of a command the switch will give you tips or a list of options:

SW1(config)# sntp 
authentication Enable sntp Authentication 
broadcast Operate in broadcast mode 
<30-720> The amount of time between updates of the system clock via SNTP 
server Configure SNTP servers to poll time from. 
unicast Operate in unicast mode
SW1(config)# sntp server 
priority Priority of the Server Address.
SW1(config)# sntp server priority 
<1-3> Enter a number for the 'priority' command/parameter.
SW1(config)# sntp server priority 1 
IP-ADDR SNTP server IPv4 address. 
IPV6-ADDR SNTP server IPv6 address.
SW1(config)# sntp server priority 1 192.168.0.10

That’ll set the NTP server 192.168.0.10 to priority 1 in the switch config, i.e. the server it will check time against first. You can add additional servers with priority 2 and 3 as backup servers.

Check your settings

Check your settings so that they actually worked:

SW1(config)# show time 
Mon Nov 11 14:53:35 2013
SW1(config)# show sntp
SNTP Configuration
SNTP Authentication : Disabled 
Time Sync Mode: Sntp 
SNTP Mode : Unicast 
Poll Interval (sec) [720] : 720 
Source IP Selection: Outgoing Interface
Priority SNTP Server Address Version Key-id 
-------- --------------------------------------- ------- ---------- 
1 192.168.0.10 3 0
SW1(config)#

If the time is still wrong, you might wanna check your settings.

Write the new config to memory

Remember to issue the command “write memory” to push your new settings to memory when you’ve verified that everything works.

A couple of tips;

Some SNTP/NTP servers might require authentication, and you can set all that with the sntp command.
SNTP is the same as NTP, except that it’s missing a lot of the sync features of NTP (but since you don’t need µsec accuracy on a switch, you’ll be fine). NTP servers usually answers SNTP requests, so don’t worry about that either.
A little known fact is that most Microsoft Domain Controllers will actually answer SNTP requests, so try that if you don’t have a separate NTP server in your network.

This post is part of a new series called Network Friday, where I explain a new networking concept every Friday and tell you have to configure it on (mostly) HP hardware. The series will mostly focus on the configuration side, as I feel there are lots of resources out there that do a fine job of explaining complex concepts, but very few that show you how to do it on your specific hardware. This series aims to address this somewhat, at least on the HP side of the fence.

This how-to was originally posted over at the Spiceworks community:

http://community.spiceworks.com/how_to/56790-setting-up-ntp-on-hp-switches



Categories: Networks, Tech

Tags: , , , , , , , , , , ,

4 replies

  1. Thank you! Very useful. How do you replace server priority 1? I used NIST server but logging shows that it is not responding. When I rin the same command (sntp server priority 1 129.6.15.27) switch responds that priority 1 is configured.

    • Hi William!
      I know, it’s a bit idiotic how you need to go about replacing a SNTP server on Procurve stuff, but the way you do it is to issue the command to add your old server with a no statement in front of the command first. So what you got to do is first input “no sntp server priority 1 OLDIP” and then “sntp server priority 1 NEWIP”. Hope that helps! BTW, the no statement is quite universal and used in a lot of other places on Procurve switches.

      Best regards,
      Sebastian

  2. Hi,

    Do you know if there is a way to configure HP Switch to act as network time server for other devices, not only as a NTP client?

    Thanks
    Sergiu

    • Hi Sergiu!
      Sadly, HP Procurve switches only implement the SNTP client (and to my knowledge the later firmwares with NTP only include the client portion as well). Cisco devices on the other hand have the NTP server functionality implemented if I remember correctly. But if you need an NTP server, you can easily stand one up on a virtual Linux machine (I have a guide for doing that on this blog, https://grumpytechie.net/2017/02/28/setting-up-a-virtual-ntp-server-on-debian/ ) or if you have an Active Directory Domain Controller, they will answer SNTP requests as well. Also, you can resolve pool.ntp.org a couple of times to get the IPs of a couple of NTP servers, these can then be used as time sources, but it’s a bit of a no-no to hard code pool server IPs into any configuration.

      Cheers,
      Sebastian

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.