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.774 ms

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

Step 4: Run command set date 2024-04-22 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
sntp 4.2.8p12@1.3728-o (1)
2024-04-22 12:00:01.152912 (+0000) +105717.888050 +/- 70486.539543 10.100.0.100 s4 no-leap

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

Mon
Show output
Tue Apr 23 17:21:59 UTC 2024

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-04-22 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.000    0.000   0.000

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

Mon
Show output
Tue Apr 23 17:22:08 UTC 2024

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 25 src=127.0.0.1 dst=127.0.0.1 sport=46094 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=46094 packets=0 bytes=0 mark=0 use=1
udp      17 179 src=10.100.0.50 dst=10.100.0.100 sport=123 dport=123 packets=5 bytes=380 src=10.100.0.100 dst=10.100.0.50 sport=123 dport=123 packets=5 bytes=380 [ASSURED] mark=0 use=1
udp      17 21 src=127.0.0.1 dst=127.0.0.1 sport=33036 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=33036 packets=0 bytes=0 mark=0 use=1
udp      17 25 src=127.0.0.1 dst=127.0.0.1 sport=38060 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=38060 packets=0 bytes=0 mark=0 use=1
udp      17 21 src=127.0.0.1 dst=127.0.0.1 sport=36988 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=36988 packets=0 bytes=0 mark=0 use=1
conntrack v1.4.5 (conntrack-tools): 5 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 25 src=127.0.0.1 dst=127.0.0.1 sport=46094 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=46094 packets=0 bytes=0 mark=0 use=1
udp      17 179 src=10.100.0.50 dst=10.100.0.100 sport=123 dport=123 packets=5 bytes=380 src=10.100.0.100 dst=10.100.0.50 sport=123 dport=123 packets=5 bytes=380 [ASSURED] mark=0 use=1
udp      17 21 src=127.0.0.1 dst=127.0.0.1 sport=33036 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=33036 packets=0 bytes=0 mark=0 use=1
udp      17 25 src=127.0.0.1 dst=127.0.0.1 sport=38060 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=38060 packets=0 bytes=0 mark=0 use=1
udp      17 21 src=127.0.0.1 dst=127.0.0.1 sport=36988 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=36988 packets=0 bytes=0 mark=0 use=1
conntrack v1.4.5 (conntrack-tools): 5 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=1.02 ms

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

Step 4: Run command set date 2024-04-22 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
sntp 4.2.8p12@1.3728-o (1)
2024-04-22 12:00:01.152313 (+0000) +105733.902001 +/- 70497.215510 10.100.0.100 s4 no-leap

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

Mon
Show output
Tue Apr 23 17:22:15 UTC 2024

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-04-22 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.000    0.000   0.000

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

Mon
Show output
Tue Apr 23 17:22:24 UTC 2024

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 25 src=127.0.0.1 dst=127.0.0.1 sport=46167 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=46167 packets=0 bytes=0 mark=0 use=1
udp      17 179 src=192.168.0.1 dst=10.100.0.100 sport=123 dport=123 packets=5 bytes=380 src=10.100.0.100 dst=192.168.0.1 sport=123 dport=123 packets=5 bytes=380 [ASSURED] mark=0 use=1
udp      17 21 src=127.0.0.1 dst=127.0.0.1 sport=52305 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=52305 packets=0 bytes=0 mark=0 use=1
udp      17 25 src=127.0.0.1 dst=127.0.0.1 sport=44972 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=44972 packets=0 bytes=0 mark=0 use=1
udp      17 21 src=127.0.0.1 dst=127.0.0.1 sport=55519 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=55519 packets=0 bytes=0 mark=0 use=1
conntrack v1.4.5 (conntrack-tools): 5 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 25 src=127.0.0.1 dst=127.0.0.1 sport=46167 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=46167 packets=0 bytes=0 mark=0 use=1
udp      17 179 src=192.168.0.1 dst=10.100.0.100 sport=123 dport=123 packets=5 bytes=380 src=10.100.0.100 dst=192.168.0.1 sport=123 dport=123 packets=5 bytes=380 [ASSURED] mark=0 use=1
udp      17 21 src=127.0.0.1 dst=127.0.0.1 sport=52305 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=52305 packets=0 bytes=0 mark=0 use=1
udp      17 25 src=127.0.0.1 dst=127.0.0.1 sport=44972 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=44972 packets=0 bytes=0 mark=0 use=1
udp      17 21 src=127.0.0.1 dst=127.0.0.1 sport=55519 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=55519 packets=0 bytes=0 mark=0 use=1
conntrack v1.4.5 (conntrack-tools): 5 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.866 ms

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

Step 4: Run command set date 2024-04-22 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
sntp 4.2.8p12@1.3728-o (1)
2024-04-22 12:00:01.145248 (+0000) +105749.971858 +/- 70507.928748 10.100.0.100 s4 no-leap

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

Mon
Show output
Tue Apr 23 17:22:31 UTC 2024

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-04-22 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.000    0.000   0.000

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

Mon
Show output
Tue Apr 23 17:22:40 UTC 2024

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 21 src=127.0.0.1 dst=127.0.0.1 sport=39243 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=39243 packets=0 bytes=0 mark=0 use=1
udp      17 25 src=127.0.0.1 dst=127.0.0.1 sport=56797 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=56797 packets=0 bytes=0 mark=0 use=1
udp      17 179 src=192.168.0.1 dst=10.100.0.100 sport=123 dport=123 packets=5 bytes=380 src=10.100.0.100 dst=192.168.0.1 sport=123 dport=123 packets=5 bytes=380 [ASSURED] mark=0 use=1
udp      17 25 src=127.0.0.1 dst=127.0.0.1 sport=55844 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=55844 packets=0 bytes=0 mark=0 use=1
udp      17 21 src=127.0.0.1 dst=127.0.0.1 sport=51928 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=51928 packets=0 bytes=0 mark=0 use=1
conntrack v1.4.5 (conntrack-tools): 5 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 21 src=127.0.0.1 dst=127.0.0.1 sport=39243 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=39243 packets=0 bytes=0 mark=0 use=1
udp      17 25 src=127.0.0.1 dst=127.0.0.1 sport=56797 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=56797 packets=0 bytes=0 mark=0 use=1
udp      17 179 src=192.168.0.1 dst=10.100.0.100 sport=123 dport=123 packets=5 bytes=380 src=10.100.0.100 dst=192.168.0.1 sport=123 dport=123 packets=5 bytes=380 [ASSURED] mark=0 use=1
udp      17 25 src=127.0.0.1 dst=127.0.0.1 sport=55844 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=55844 packets=0 bytes=0 mark=0 use=1
udp      17 21 src=127.0.0.1 dst=127.0.0.1 sport=51928 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=51928 packets=0 bytes=0 mark=0 use=1
conntrack v1.4.5 (conntrack-tools): 5 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.948 ms

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

Step 4: Run command set date 2024-04-22 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
sntp 4.2.8p12@1.3728-o (1)
2024-04-22 12:00:01.205184 (+0000) +105766.122246 +/- 70518.695689 10.100.0.100 s4 no-leap

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

Mon
Show output
Tue Apr 23 17:22:47 UTC 2024

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-04-22 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.000    0.000   0.000

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

Mon
Show output
Tue Apr 23 17:22:56 UTC 2024

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 25 src=127.0.0.1 dst=127.0.0.1 sport=40248 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=40248 packets=0 bytes=0 mark=0 use=1
udp      17 178 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
udp      17 21 src=127.0.0.1 dst=127.0.0.1 sport=44945 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=44945 packets=0 bytes=0 mark=0 use=1
udp      17 25 src=127.0.0.1 dst=127.0.0.1 sport=41920 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=41920 packets=0 bytes=0 mark=0 use=1
udp      17 21 src=127.0.0.1 dst=127.0.0.1 sport=53629 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=53629 packets=0 bytes=0 mark=0 use=1
conntrack v1.4.5 (conntrack-tools): 5 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 25 src=127.0.0.1 dst=127.0.0.1 sport=40248 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=40248 packets=0 bytes=0 mark=0 use=1
udp      17 178 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
udp      17 21 src=127.0.0.1 dst=127.0.0.1 sport=44945 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=44945 packets=0 bytes=0 mark=0 use=1
udp      17 25 src=127.0.0.1 dst=127.0.0.1 sport=41920 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=41920 packets=0 bytes=0 mark=0 use=1
udp      17 21 src=127.0.0.1 dst=127.0.0.1 sport=53629 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=53629 packets=0 bytes=0 mark=0 use=1
conntrack v1.4.5 (conntrack-tools): 5 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.482 ms

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

Step 4: Run command set date 2024-04-22 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
sntp 4.2.8p12@1.3728-o (1)
2024-04-22 12:00:00.092723 (+0000) +105783.695238 +/- 70530.411002 10.100.0.100 s4 no-leap

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

Mon
Show output
Tue Apr 23 17:23:04 UTC 2024

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-04-22 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.000    0.000   0.000

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

Mon
Show output
Tue Apr 23 17:23:13 UTC 2024

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 25 src=127.0.0.1 dst=127.0.0.1 sport=40960 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=40960 packets=0 bytes=0 mark=0 use=1
udp      17 21 src=127.0.0.1 dst=127.0.0.1 sport=47140 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=47140 packets=0 bytes=0 mark=0 use=1
udp      17 25 src=127.0.0.1 dst=127.0.0.1 sport=57662 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=57662 packets=0 bytes=0 mark=0 use=1
udp      17 179 src=192.168.0.1 dst=10.100.0.100 sport=123 dport=123 packets=5 bytes=380 src=10.100.0.100 dst=192.168.0.1 sport=123 dport=123 packets=5 bytes=380 [ASSURED] mark=0 use=1
udp      17 21 src=127.0.0.1 dst=127.0.0.1 sport=43831 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=43831 packets=0 bytes=0 mark=0 use=1
conntrack v1.4.5 (conntrack-tools): 5 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 25 src=127.0.0.1 dst=127.0.0.1 sport=40960 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=40960 packets=0 bytes=0 mark=0 use=1
udp      17 21 src=127.0.0.1 dst=127.0.0.1 sport=47140 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=47140 packets=0 bytes=0 mark=0 use=1
udp      17 25 src=127.0.0.1 dst=127.0.0.1 sport=57662 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=57662 packets=0 bytes=0 mark=0 use=1
udp      17 179 src=192.168.0.1 dst=10.100.0.100 sport=123 dport=123 packets=5 bytes=380 src=10.100.0.100 dst=192.168.0.1 sport=123 dport=123 packets=5 bytes=380 [ASSURED] mark=0 use=1
udp      17 21 src=127.0.0.1 dst=127.0.0.1 sport=43831 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=43831 packets=0 bytes=0 mark=0 use=1
conntrack v1.4.5 (conntrack-tools): 5 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.524 ms

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

Step 4: Run command set date 2024-04-22 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
sntp 4.2.8p12@1.3728-o (1)
2024-04-22 12:00:00.092813 (+0000) +105799.552967 +/- 70540.982821 10.100.0.100 s4 no-leap

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

Mon
Show output
Tue Apr 23 17:23:20 UTC 2024

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-04-22 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.000    0.000   0.000

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

Mon
Show output
Tue Apr 23 17:23:29 UTC 2024

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 21 src=127.0.0.1 dst=127.0.0.1 sport=55903 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=55903 packets=0 bytes=0 mark=0 use=1
udp      17 25 src=127.0.0.1 dst=127.0.0.1 sport=55560 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=55560 packets=0 bytes=0 mark=0 use=1
udp      17 21 src=127.0.0.1 dst=127.0.0.1 sport=35457 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=35457 packets=0 bytes=0 mark=0 use=1
udp      17 179 src=192.168.0.1 dst=10.100.0.100 sport=123 dport=123 packets=5 bytes=380 src=10.100.0.100 dst=192.168.0.1 sport=123 dport=123 packets=5 bytes=380 [ASSURED] mark=0 use=1
udp      17 25 src=127.0.0.1 dst=127.0.0.1 sport=56657 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=56657 packets=0 bytes=0 mark=0 use=1
conntrack v1.4.5 (conntrack-tools): 5 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 21 src=127.0.0.1 dst=127.0.0.1 sport=55903 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=55903 packets=0 bytes=0 mark=0 use=1
udp      17 25 src=127.0.0.1 dst=127.0.0.1 sport=55560 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=55560 packets=0 bytes=0 mark=0 use=1
udp      17 21 src=127.0.0.1 dst=127.0.0.1 sport=35457 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=35457 packets=0 bytes=0 mark=0 use=1
udp      17 179 src=192.168.0.1 dst=10.100.0.100 sport=123 dport=123 packets=5 bytes=380 src=10.100.0.100 dst=192.168.0.1 sport=123 dport=123 packets=5 bytes=380 [ASSURED] mark=0 use=1
udp      17 25 src=127.0.0.1 dst=127.0.0.1 sport=56657 dport=53 packets=2 bytes=124 [UNREPLIED] src=127.0.0.1 dst=127.0.0.1 sport=53 dport=56657 packets=0 bytes=0 mark=0 use=1
conntrack v1.4.5 (conntrack-tools): 5 flow entries have been shown.