Setting the Routers Time

Setting the Router s Time

The router's internal clock is set with the clock set command. This command is not a configuration command (i.e., you must be in enable mode to give it, but you don't need to give the configure terminal command) and is not stored in the router's configuration. The time is in military (24-hour) time . For example:

Router#clock set 13:00:00 20 jun 1999

In addition to setting the time itself, you need to set the time zone using the clock timezone command. This command is part of the router's configuration. For example, a router on the east coast of the United States would have the line:

Router(config)#clock timezone EST -5

-5 is the UTC (Coordinated Universal Time) offset for the Eastern time zone.

Now that the time and time zone have been set, one final configuration item exists: in most places, you want to observe Daylight Savings Time. The following command tells the router to use Daylight Savings Time in the Eastern time zone:

Router(config)#clock summer-time EDT recurring

 

3.6.1. The Calendar Versus the Clock

High-end Cisco routers have a calendar that is separate from the system clock. The calendar runs continuously, even if the router is off. After the calendar has been set, the system clock automatically sets itself every time the router is booted. The following commands set the router's calendar and set the clock's time from the calendar time. The calendar set command simply sets the time and is not stored in the router's configuration.

Router#calendar set 12:10:00 5 September 2004 Router#clock read-calendar

 

3.6.2. Configuring NTP

The Network Time Protocol (NTP) is available in IOS Versions 9.21 and above. This protocol uses an NTP server to synchronize the router's time with other clocks on the network. Configuring NTP is as simple as setting the address of an NTP server. There are several NTP servers on the Internet for your use; your ISP may have its own NTP server.

clock timezone EST -5 ntp server 10.10.1.5

When you enable NTP, a new command called ntp clock-period appears in the router's configuration. (If you do a show running-config, you will see it in there even if you didn't enter it.) This command is set automatically by the NTP software and it is best to leave it alone.

Did you allow an NTP server on the gateway router's access list? If NTP is not working after issuing these commands, check the gateway router's access list.

On a high-end router, we add a command to the configuration to tell the router to update its internal clock with the NTP time:

clock timezone EST -5 clock update-calendar ntp server 10.10.1.2

A high-end router can also be the NTP server for the network. To use the router as an NTP server, add the following commands to the configuration. These commands tell the router to use the internal calendar for NTP time:

clock timezone EST -5 clock calendar-valid ntp master

Never use the ntp master command on a router that is participating in NTP over the Internet. It will declare the router as a stratum 1 NTP server. Not only will the router no longer change its own time based on NTP information it learns, but it might disturb other NTP hosts on the Internet.

Категории