HowTo Enable NTP on Mellanox Switches

Version 5

    This is a basic post demonstrating how to enable NTP client on Mellanox switches.

     

     

    References

     

    Configure Time and Date Manually

    This is a manual option, in case you do not want to use an NTP server to synchronize the date and time.

     

    1. Show the current time. Run:

    switch (config) # show clock

    Time:       12:00:03

    Date:       2014/01/01

    Time zone:  UTC

                (Etc/UTC)

    UTC offset: same as UTC

    switch (config) #

     

    2. Manually set the current time and date.

    switch (config) # clock set 12:13:14 2015/07/07

    switch (config) # show clock

    Time:       12:13:17

    Date:       2015/07/07

    Time zone:  UTC

                (Etc/UTC)

    UTC offset: same as UTC

    switch (config) #

     

     

    Configure NTP

    1. Make sure to have an NTP server in the network for the switch to connect to.

    Here is an example How to Install and Configure a Linux NTP Server and Client

     

    2. Enable NTP globally. Run:

    switch (config) # ntp enable

     

    3. Test the NTP server by querying the current time.

    switch  (config) # ntpdate 10.4.0.134

    28 Jul 19:59:19 ntpdate[16180]: step time server 10.4.0.134 offset 1842248.046711 sec

     

    4. Set the NTP client to connect to this NTP server.

     

    There are two options to sync the time in this case:

    1. Using the command ntp server: This command points to an NTP server (meaning that this switch is the client), and no matter what your clock says, time will jump to the server's clock setting because it has assumed authority.

    2. Using the command ntp peer: This command is set between two switches/servers, and the assumption is that neither one has authority over knowing what time it is, and the two NTP peers sync their clocks by shifting their time towards each other.

     

    Under normal conditions, it is recommended to use a specific NTP server in the network (via the command "ntp server"), unless no such server is available, in which case you can align a group of switches/servers (via the command "ntp peer").

    switch (config) # ntp server 10.4.0.134

    switch (config) # show ntp

    NTP is administratively enabled.

    Clock is unsynchronized.

    Active servers and peers:

                                                                       Poll   Last

                    Conf                      Offset  Ref              Interv Resp

    Address         Type Status      Stratum  (msec)  Clock            (sec)  (sec)

    ===============================================================================

    10.4.0.134      serv pending         3    -0.789  192.114.62.250     64      2

     

    Note: It takes a few minutes for the NTP client to sync with the NTP server.

     

    mti-mar-sx01 [standalone: master] (config) # show ntp

    NTP is administratively enabled.

    Clock is synchronized.  Reference: 10.4.0.134.  Offset: 10.039 ms.

    Active servers and peers:

                                                                       Poll   Last

                    Conf                      Offset  Ref              Interv Resp

    Address         Type Status      Stratum  (msec)  Clock            (sec)  (sec)

    ===============================================================================

    10.4.0.134      serv sys.peer (*)    3    10.039  192.114.62.250    128     45

     

    6. Set the timezone. For example, for the pacific time zone (UTC -7), run:

    switch (config) # clock timezone UTC-offset UTC-7

     

    7. Check that the current time has been updated from the NTP server. Run:

    switch (config) # show clock

    Time:       15:12:21

    Date:       2015/07/28

    Time zone:  UTC-offset UTC-7

                (Etc/GMT+7)

    UTC offset: -0700 (UTC minus 7 hours)