Ntp Client

This scenario shows how to configure NTP for clock synchronization between different OSDx systems.

../../../_images/client.svg

Test NTP Service

Description

DUT0 is configured to obtain time information from a static configured NTP server.

Scenario

Step 1: Set the following configuration in DUT1:

set interfaces ethernet eth0 address 10.100.0.100/24
set protocols static route 0.0.0.0/0 next-hop 10.100.0.50
set system ntp master prefer
set system ntp master stratum 3

Step 2: Set the following configuration in DUT0:

set interfaces ethernet eth0 address 10.100.0.50/24

Step 3: Ping IP address 10.100.0.100 from DUT0:

admin@DUT0$ ping 10.100.0.100 count 1 size 56 timeout 1
Show output
PING 10.100.0.100 (10.100.0.100) 56(84) bytes of data.
64 bytes from 10.100.0.100: icmp_seq=1 ttl=64 time=0.455 ms

--- 10.100.0.100 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.455/0.455/0.455/0.000 ms

Step 4: Run command set date 2024-06-19 12:00:00 at DUT0 and expect this output: Step 5: Run command set date ntp 10.100.0.100 at DUT0 and check if output does not contain the following tokens:

skipping this server
Show output
Date was successfully updated!

Step 6: Run command show date at DUT0 and check if output does not contain the following tokens:

Wed
Show output
Thu 20 Jun 2024 19:05:00 UTC +00:00

Step 7: Run command system conntrack clear at DUT1 and expect this output:

Show output
Connection tracking table has been emptied

Step 8: Run command set date 2024-06-19 12:00:00 at DUT0 and expect this output: Step 9: Run command system ntp status at DUT0 and check if output contains the following tokens:

NTP is not running
Show output
NTP is not running

Step 10: Set the following configuration in DUT0:

set system ntp server address 10.100.0.100 max-poll 4
set system ntp server address 10.100.0.100 min-poll 3

Step 11: Run command system ntp status at DUT0 and check if output contains the following tokens:

10.100.0.100
Show output
     remote           refid      st t when poll reach   delay   offset   jitter
===============================================================================
 10.100.0.100    .INIT.          16 u    -    8    0   0.0000   0.0000   0.0001

Step 12: Run command show date at DUT0 and check if output does not contain the following tokens:

Wed
Show output
Thu 20 Jun 2024 19:05:10 UTC +00:00

Step 13: Run command system conntrack show protocol udp at DUT1 and check if output contains the following tokens:

src=10.100.0.50 dst=10.100.0.100 sport=123 dport=123
Show output
udp      17 177 src=10.100.0.50 dst=10.100.0.100 sport=123 dport=123 packets=4 bytes=304 src=10.100.0.100 dst=10.100.0.50 sport=123 dport=123 packets=4 bytes=304 [ASSURED] mark=0 use=1
conntrack v1.4.5 (conntrack-tools): 1 flow entries have been shown.

Step 14: Run command system conntrack show protocol udp at DUT1 and check if output does not contain the following tokens:

src=192.168.0.1 dst=10.100.0.100 sport=123 dport=123
Show output
udp      17 177 src=10.100.0.50 dst=10.100.0.100 sport=123 dport=123 packets=4 bytes=304 src=10.100.0.100 dst=10.100.0.50 sport=123 dport=123 packets=4 bytes=304 [ASSURED] mark=0 use=1
conntrack v1.4.5 (conntrack-tools): 1 flow entries have been shown.

Test NTP Service With Local-Address

Description

DUT0 is configured to obtain time information from an NTP server. Local-address is configured to force a specific source address for NTP requests.

Scenario

Step 1: Set the following configuration in DUT1:

set interfaces ethernet eth0 address 10.100.0.100/24
set protocols static route 0.0.0.0/0 next-hop 10.100.0.50
set system ntp master prefer
set system ntp master stratum 3

Step 2: Set the following configuration in DUT0:

set interfaces ethernet eth0 address 10.100.0.50/24
set interfaces dummy dum0 address 192.168.0.1/24

Step 3: Ping IP address 10.100.0.100 from DUT0:

admin@DUT0$ ping 10.100.0.100 count 1 size 56 timeout 1
Show output
PING 10.100.0.100 (10.100.0.100) 56(84) bytes of data.
64 bytes from 10.100.0.100: icmp_seq=1 ttl=64 time=0.678 ms

--- 10.100.0.100 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.678/0.678/0.678/0.000 ms

Step 4: Run command set date 2024-06-19 12:00:00 at DUT0 and expect this output: Step 5: Run command set date ntp 10.100.0.100 at DUT0 and check if output does not contain the following tokens:

skipping this server
Show output
Date was successfully updated!

Step 6: Run command show date at DUT0 and check if output does not contain the following tokens:

Wed
Show output
Thu 20 Jun 2024 19:05:20 UTC +00:00

Step 7: Run command system conntrack clear at DUT1 and expect this output:

Show output
Connection tracking table has been emptied

Step 8: Run command set date 2024-06-19 12:00:00 at DUT0 and expect this output: Step 9: Run command system ntp status at DUT0 and check if output contains the following tokens:

NTP is not running
Show output
NTP is not running

Step 10: Set the following configuration in DUT0:

set system ntp server address 10.100.0.100 max-poll 4
set system ntp server address 10.100.0.100 min-poll 3
set system ntp server address 10.100.0.100 local-address 192.168.0.1

Step 11: Run command system ntp status at DUT0 and check if output contains the following tokens:

10.100.0.100
Show output
     remote           refid      st t when poll reach   delay   offset   jitter
===============================================================================
 10.100.0.100    .INIT.          16 u    -    8    0   0.0000   0.0000   0.0001

Step 12: Run command show date at DUT0 and check if output does not contain the following tokens:

Wed
Show output
Thu 20 Jun 2024 19:05:30 UTC +00:00

Step 13: Run command system conntrack show protocol udp at DUT1 and check if output contains the following tokens:

src=10.100.0.50 dst=10.100.0.100 sport=123 dport=123
Show output
udp      17 177 src=192.168.0.1 dst=10.100.0.100 sport=123 dport=123 packets=4 bytes=304 src=10.100.0.100 dst=192.168.0.1 sport=123 dport=123 packets=4 bytes=304 [ASSURED] mark=0 use=1
conntrack v1.4.5 (conntrack-tools): 1 flow entries have been shown.

Step 14: Run command system conntrack show protocol udp at DUT1 and check if output contains the following tokens:

src=192.168.0.1 dst=10.100.0.100 sport=123 dport=123
Show output
udp      17 177 src=192.168.0.1 dst=10.100.0.100 sport=123 dport=123 packets=4 bytes=304 src=10.100.0.100 dst=192.168.0.1 sport=123 dport=123 packets=4 bytes=304 [ASSURED] mark=0 use=1
conntrack v1.4.5 (conntrack-tools): 1 flow entries have been shown.

Test NTP Service With Local-Interface

Description

DUT0 is configured to obtain time information from an NTP server through a virtual dummy interface.

Scenario

Step 1: Set the following configuration in DUT1:

set interfaces ethernet eth0 address 10.100.0.100/24
set protocols static route 0.0.0.0/0 next-hop 10.100.0.50
set system ntp master prefer
set system ntp master stratum 3

Step 2: Set the following configuration in DUT0:

set interfaces ethernet eth0 address 10.100.0.50/24
set interfaces dummy dum0 address 192.168.0.1/24

Step 3: Ping IP address 10.100.0.100 from DUT0:

admin@DUT0$ ping 10.100.0.100 count 1 size 56 timeout 1
Show output
PING 10.100.0.100 (10.100.0.100) 56(84) bytes of data.
64 bytes from 10.100.0.100: icmp_seq=1 ttl=64 time=0.526 ms

--- 10.100.0.100 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.526/0.526/0.526/0.000 ms

Step 4: Run command set date 2024-06-19 12:00:00 at DUT0 and expect this output: Step 5: Run command set date ntp 10.100.0.100 at DUT0 and check if output does not contain the following tokens:

skipping this server
Show output
Date was successfully updated!

Step 6: Run command show date at DUT0 and check if output does not contain the following tokens:

Wed
Show output
Thu 20 Jun 2024 19:05:40 UTC +00:00

Step 7: Run command system conntrack clear at DUT1 and expect this output:

Show output
Connection tracking table has been emptied

Step 8: Run command set date 2024-06-19 12:00:00 at DUT0 and expect this output: Step 9: Run command system ntp status at DUT0 and check if output contains the following tokens:

NTP is not running
Show output
NTP is not running

Step 10: Set the following configuration in DUT0:

set system ntp server address 10.100.0.100 max-poll 4
set system ntp server address 10.100.0.100 min-poll 3
set system ntp server address 10.100.0.100 local-interface dum0

Step 11: Run command system ntp status at DUT0 and check if output contains the following tokens:

10.100.0.100
Show output
     remote           refid      st t when poll reach   delay   offset   jitter
===============================================================================
 10.100.0.100    .INIT.          16 u    -    8    0   0.0000   0.0000   0.0001

Step 12: Run command show date at DUT0 and check if output does not contain the following tokens:

Wed
Show output
Thu 20 Jun 2024 19:05:50 UTC +00:00

Step 13: Run command system conntrack show protocol udp at DUT1 and check if output contains the following tokens:

src=10.100.0.50 dst=10.100.0.100 sport=123 dport=123
Show output
udp      17 177 src=192.168.0.1 dst=10.100.0.100 sport=123 dport=123 packets=4 bytes=304 src=10.100.0.100 dst=192.168.0.1 sport=123 dport=123 packets=4 bytes=304 [ASSURED] mark=0 use=1
conntrack v1.4.5 (conntrack-tools): 1 flow entries have been shown.

Step 14: Run command system conntrack show protocol udp at DUT1 and check if output contains the following tokens:

src=192.168.0.1 dst=10.100.0.100 sport=123 dport=123
Show output
udp      17 177 src=192.168.0.1 dst=10.100.0.100 sport=123 dport=123 packets=4 bytes=304 src=10.100.0.100 dst=192.168.0.1 sport=123 dport=123 packets=4 bytes=304 [ASSURED] mark=0 use=1
conntrack v1.4.5 (conntrack-tools): 1 flow entries have been shown.

Test NTP Service With Local-VRF

Description

DUT0 is configured to obtain time information from an NTP server via VRF (Virtual Routing and Forwarding).

Scenario

Step 1: Set the following configuration in DUT1:

set interfaces ethernet eth0 address 10.100.0.100/24
set protocols static route 0.0.0.0/0 next-hop 10.100.0.50
set system ntp master prefer
set system ntp master stratum 3

Step 2: Set the following configuration in DUT0:

set interfaces ethernet eth0 address 10.100.0.50/24
set interfaces ethernet eth0 vrf WAN
set system vrf WAN

Step 3: Ping IP address 10.100.0.100 from DUT0:

admin@DUT0$ ping 10.100.0.100 vrf WAN count 1 size 56 timeout 1
Show output
ping: Warning: source address might be selected on device other than WAN.
PING 10.100.0.100 (10.100.0.100) from 10.100.0.50 WAN: 56(84) bytes of data.
64 bytes from 10.100.0.100: icmp_seq=1 ttl=64 time=0.507 ms

--- 10.100.0.100 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.507/0.507/0.507/0.000 ms

Step 4: Run command set date 2024-06-19 12:00:00 at DUT0 and expect this output: Step 5: Run command set date ntp 10.100.0.100 vrf WAN at DUT0 and check if output does not contain the following tokens:

skipping this server
Show output
Date was successfully updated!

Step 6: Run command show date at DUT0 and check if output does not contain the following tokens:

Wed
Show output
Thu 20 Jun 2024 19:06:01 UTC +00:00

Step 7: Run command system conntrack clear at DUT1 and expect this output:

Show output
Connection tracking table has been emptied

Step 8: Run command set date 2024-06-19 12:00:00 at DUT0 and expect this output: Step 9: Run command system ntp status at DUT0 and check if output contains the following tokens:

NTP is not running
Show output
NTP is not running

Step 10: Set the following configuration in DUT0:

set system ntp server address 10.100.0.100 max-poll 4
set system ntp server address 10.100.0.100 min-poll 3
set system ntp server address 10.100.0.100 local-vrf WAN
set system ntp server address 10.100.0.100 local-interface eth0

Step 11: Run command system ntp status at DUT0 and check if output contains the following tokens:

10.100.0.100
Show output
     remote           refid      st t when poll reach   delay   offset   jitter
===============================================================================
 10.100.0.100    .INIT.          16 u    -    8    0   0.0000   0.0000   0.0001

Step 12: Run command show date at DUT0 and check if output does not contain the following tokens:

Wed
Show output
Thu 20 Jun 2024 19:06:12 UTC +00:00

Step 13: Run command system conntrack show protocol udp at DUT1 and check if output contains the following tokens:

src=10.100.0.50 dst=10.100.0.100 sport=123 dport=123
Show output
udp      17 177 src=10.100.0.50 dst=10.100.0.100 sport=123 dport=123 packets=4 bytes=304 src=10.100.0.100 dst=10.100.0.50 sport=123 dport=123 packets=4 bytes=304 [ASSURED] mark=0 use=1
conntrack v1.4.5 (conntrack-tools): 1 flow entries have been shown.

Step 14: Run command system conntrack show protocol udp at DUT1 and check if output does not contain the following tokens:

src=192.168.0.1 dst=10.100.0.100 sport=123 dport=123
Show output
udp      17 177 src=10.100.0.50 dst=10.100.0.100 sport=123 dport=123 packets=4 bytes=304 src=10.100.0.100 dst=10.100.0.50 sport=123 dport=123 packets=4 bytes=304 [ASSURED] mark=0 use=1
conntrack v1.4.5 (conntrack-tools): 1 flow entries have been shown.

Test NTP Service With Local-VRF And Local-Address

Description

DUT0 is configured to obtain time information from an NTP server via VRF (Virtual Routing and Forwarding). NTP requests will be generated using the specified local address as source.

Scenario

Step 1: Set the following configuration in DUT1:

set interfaces ethernet eth0 address 10.100.0.100/24
set protocols static route 0.0.0.0/0 next-hop 10.100.0.50
set system ntp master prefer
set system ntp master stratum 3

Step 2: Set the following configuration in DUT0:

set interfaces ethernet eth0 address 10.100.0.50/24
set interfaces ethernet eth0 vrf WAN
set system vrf WAN
set interfaces dummy dum0 address 192.168.0.1/24
set interfaces dummy dum0 vrf LAN
set protocols vrf WAN static route 192.168.0.0/24 next-hop-vrf LAN
set protocols vrf LAN static route 0.0.0.0/0 interface eth0
set system vrf LAN

Step 3: Ping IP address 10.100.0.100 from DUT0:

admin@DUT0$ ping 10.100.0.100 vrf WAN count 1 size 56 timeout 1
Show output
ping: Warning: source address might be selected on device other than WAN.
PING 10.100.0.100 (10.100.0.100) from 10.100.0.50 WAN: 56(84) bytes of data.
64 bytes from 10.100.0.100: icmp_seq=1 ttl=64 time=0.494 ms

--- 10.100.0.100 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.494/0.494/0.494/0.000 ms

Step 4: Run command set date 2024-06-19 12:00:00 at DUT0 and expect this output: Step 5: Run command set date ntp 10.100.0.100 vrf WAN at DUT0 and check if output does not contain the following tokens:

skipping this server
Show output
Date was successfully updated!

Step 6: Run command show date at DUT0 and check if output does not contain the following tokens:

Wed
Show output
Thu 20 Jun 2024 19:06:23 UTC +00:00

Step 7: Run command system conntrack clear at DUT1 and expect this output:

Show output
Connection tracking table has been emptied

Step 8: Run command set date 2024-06-19 12:00:00 at DUT0 and expect this output: Step 9: Run command system ntp status at DUT0 and check if output contains the following tokens:

NTP is not running
Show output
NTP is not running

Step 10: Set the following configuration in DUT0:

set system ntp server address 10.100.0.100 max-poll 4
set system ntp server address 10.100.0.100 min-poll 3
set system ntp server address 10.100.0.100 local-vrf LAN
set system ntp server address 10.100.0.100 local-address 192.168.0.1

Step 11: Run command system ntp status at DUT0 and check if output contains the following tokens:

10.100.0.100
Show output
     remote           refid      st t when poll reach   delay   offset   jitter
===============================================================================
 10.100.0.100    .INIT.          16 u    -    8    0   0.0000   0.0000   0.0001

Step 12: Run command show date at DUT0 and check if output does not contain the following tokens:

Wed
Show output
Thu 20 Jun 2024 19:06:33 UTC +00:00

Step 13: Run command system conntrack show protocol udp at DUT1 and check if output contains the following tokens:

src=10.100.0.50 dst=10.100.0.100 sport=123 dport=123
Show output
udp      17 177 src=192.168.0.1 dst=10.100.0.100 sport=123 dport=123 packets=4 bytes=304 src=10.100.0.100 dst=192.168.0.1 sport=123 dport=123 packets=4 bytes=304 [ASSURED] mark=0 use=1
conntrack v1.4.5 (conntrack-tools): 1 flow entries have been shown.

Step 14: Run command system conntrack show protocol udp at DUT1 and check if output contains the following tokens:

src=192.168.0.1 dst=10.100.0.100 sport=123 dport=123
Show output
udp      17 177 src=192.168.0.1 dst=10.100.0.100 sport=123 dport=123 packets=4 bytes=304 src=10.100.0.100 dst=192.168.0.1 sport=123 dport=123 packets=4 bytes=304 [ASSURED] mark=0 use=1
conntrack v1.4.5 (conntrack-tools): 1 flow entries have been shown.

Test NTP Service With Local-VRF And Local-Interface

Description

DUT0 is configured to obtain time information from an NTP server via VRF (Virtual Routing and Forwarding). NTP requests will be generated through the specified local interface.

Scenario

Step 1: Set the following configuration in DUT1:

set interfaces ethernet eth0 address 10.100.0.100/24
set protocols static route 0.0.0.0/0 next-hop 10.100.0.50
set system ntp master prefer
set system ntp master stratum 3

Step 2: Set the following configuration in DUT0:

set interfaces ethernet eth0 address 10.100.0.50/24
set interfaces ethernet eth0 vrf WAN
set system vrf WAN
set interfaces dummy dum0 address 192.168.0.1/24
set interfaces dummy dum0 vrf LAN
set protocols vrf WAN static route 192.168.0.0/24 next-hop-vrf LAN
set protocols vrf LAN static route 0.0.0.0/0 interface eth0
set system vrf LAN

Step 3: Ping IP address 10.100.0.100 from DUT0:

admin@DUT0$ ping 10.100.0.100 vrf WAN count 1 size 56 timeout 1
Show output
ping: Warning: source address might be selected on device other than WAN.
PING 10.100.0.100 (10.100.0.100) from 10.100.0.50 WAN: 56(84) bytes of data.
64 bytes from 10.100.0.100: icmp_seq=1 ttl=64 time=0.488 ms

--- 10.100.0.100 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.488/0.488/0.488/0.000 ms

Step 4: Run command set date 2024-06-19 12:00:00 at DUT0 and expect this output: Step 5: Run command set date ntp 10.100.0.100 vrf WAN at DUT0 and check if output does not contain the following tokens:

skipping this server
Show output
Date was successfully updated!

Step 6: Run command show date at DUT0 and check if output does not contain the following tokens:

Wed
Show output
Thu 20 Jun 2024 19:06:45 UTC +00:00

Step 7: Run command system conntrack clear at DUT1 and expect this output:

Show output
Connection tracking table has been emptied

Step 8: Run command set date 2024-06-19 12:00:00 at DUT0 and expect this output: Step 9: Run command system ntp status at DUT0 and check if output contains the following tokens:

NTP is not running
Show output
NTP is not running

Step 10: Set the following configuration in DUT0:

set system ntp server address 10.100.0.100 max-poll 4
set system ntp server address 10.100.0.100 min-poll 3
set system ntp server address 10.100.0.100 local-vrf LAN
set system ntp server address 10.100.0.100 local-interface dum0

Step 11: Run command system ntp status at DUT0 and check if output contains the following tokens:

10.100.0.100
Show output
     remote           refid      st t when poll reach   delay   offset   jitter
===============================================================================
 10.100.0.100    .INIT.          16 u    -    8    0   0.0000   0.0000   0.0001

Step 12: Run command show date at DUT0 and check if output does not contain the following tokens:

Wed
Show output
Thu 20 Jun 2024 19:06:55 UTC +00:00

Step 13: Run command system conntrack show protocol udp at DUT1 and check if output contains the following tokens:

src=10.100.0.50 dst=10.100.0.100 sport=123 dport=123
Show output
udp      17 177 src=192.168.0.1 dst=10.100.0.100 sport=123 dport=123 packets=4 bytes=304 src=10.100.0.100 dst=192.168.0.1 sport=123 dport=123 packets=4 bytes=304 [ASSURED] mark=0 use=1
conntrack v1.4.5 (conntrack-tools): 1 flow entries have been shown.

Step 14: Run command system conntrack show protocol udp at DUT1 and check if output contains the following tokens:

src=192.168.0.1 dst=10.100.0.100 sport=123 dport=123
Show output
udp      17 177 src=192.168.0.1 dst=10.100.0.100 sport=123 dport=123 packets=4 bytes=304 src=10.100.0.100 dst=192.168.0.1 sport=123 dport=123 packets=4 bytes=304 [ASSURED] mark=0 use=1
conntrack v1.4.5 (conntrack-tools): 1 flow entries have been shown.