Synchronizing Time When the Router Boots

Problem

You want the router to synchronize its time when it boots.

Solution

Have the router get the time when it boots:

	[edit system]
	aviva@router1#  
set ntp boot-server 172.10.23.196

 

Discussion

The easiest way to have NTP set the time on your router is to get the time when the router boots. You include the ntp boot-server statement, and you set the address of an NTP server. Typically, you want to have at least one time server on the local networkeither another router or a server of some kindand you want all the other routers to get their time from this router. If the boot server is another router, you need to make sure that NTP is running on that router and that it is set up as an NTP peer so it can send its time to other routers.

A good practice is to configure a boot server on any router that is running NTP in case the time is wildly off when the router starts or has drifted beyond the point where it can be periodically sychnronized by a boot server (see Recipe 6.4); otherwise, the time is never set. The time might be off by a lot with a new router or Routing Engine. Once the time is set, the Routing Engine's battery-powered time-of-day clock keeps running even with the power off, so it seeds the time to within a few seconds when the router boots. Another common reason for the time to be wildly off is if you manually set the time without setting the time zone first, so the clock might be off by some number of hours.

The NTP boot server must be reachable when the router boots, without any routing protocols running and with any of the interfaces being up. This means it must be directly reachable from the management Ethernet interface, fxp0. When the Routing Engine boots, the ntpdate utility runs early in the boot process, before chassisd and rpd are up. The only thing that is up and configured at that point is fxp0.

With this method of setting up NTP, the router gets the time once, when it boots, and sets its clock based on the time it receives from the server. While you could choose this as the only method for getting accurate time on the router, the clock time can drift over long periods, so it is a better idea to get the time when the router boots and to also synchronize the time periodically with time servers to slowly correct any drifting.

If the NTP boot server is another router, you cannot boot both routers at once, for instance, if you are power-cycling all the routers in your POP. You must start the boot server first.

See Also

Recipe 6.4


Router Configuration and File Management

Basic Router Security and Access Control

IPSec

SNMP

Logging

NTP

Router Interfaces

IP Routing

Routing Policy and Firewall Filters

RIP

IS-IS

OSPF

BGP

MPLS

VPNs

IP Multicast



JUNOS Cookbook
Junos Cookbook (Cookbooks (OReilly))
ISBN: 0596100140
EAN: 2147483647
Year: 2007
Pages: 290
Authors: Aviva Garrett

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net