Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Configure Time Zones

SUMMARY The time zone represents a region that observes the same time. It is recommended that you set the time zone before you configure the date and time on the network device.

Modify Default Time Zone

The default local time zone on a router or a switching device is UTC (Coordinated Universal Time, formerly known as Greenwich Mean Time, or GMT).

To modify the local time zone, include the time-zone statement at the [edit system] hierarchy level:

You can use the GMT hour-offset option to set the time zone relative to UTC (GMT) time. By default, hour-offset is 0. You can configure this to be a value in the range from –14 to +12.

You can also specify time-zone as a string such as PDT (Pacific Daylight Time) or WET (Western European Time), or specify the continent and major city.

Note:

Junos OS complies with the POSIX time-zone standard, which is counter-intuitive to the way time zones are generally indicated relative to UTC. A time zone ahead of UTC (east of the Greenwich meridian) is commonly indicated as GMT +n; for example, the Central European Time (CET) zone is indicated as GMT +1. However, this is not true for POSIX time zone designations. POSIX indicates CET as GMT-1. If you include the set system time-zone GMT+1 statement for a router or a switch in the CET zone, your device time will be set to one hour behind GMT, or two hours behind the actual CET time. For this reason, you might find it easier to use the POSIX time-zone strings, which you can list by entering set system time-zone ?.

For the time zone change to take effect for all processes running on the router or switch, you must reboot the router or switch.

The following example shows how to change the current time zone to America/New_York:

Starting in Junos OS Release 15.1F6, for the routers with the RE-MX-X6, RE-MX-X8, and RE-PTX-X8 Routing Engines, the date and time zones are synchronized from the admin guest Junos OS to the host OS. Thus, the guest OS and the host OS use the same time zone and there is no difference in the timestamps in system log files of Junos OS and the host OS. This time zone and date synchronization changes the time zone of the host from the default UTC to the configured time zone. However, for the time zone change to take effect for all processes running on the router, reboot the router by using the request vmhost reboot command.

Internet Assigned Numbers Authority (IANA) Time Zone

Junos OS devices use the tz database, also known as the IANA Time Zone Database to manage time zones. This database is periodically updated by IANA to reflect political and time changes. As such, you may need from time to time to update this file to ensure the Junos devices continue to accurately reflect worldwide time zones and daylight savings time intervals.

To update the IANA Time Zone Database, perform the following steps:

Import and Install Time Zone Files

The IANA Time Zone Database is maintained by the Internet Assigned Numbers Authority (IANA), which is a department of the Internet Corporation for Assigned Names and Numbers (ICANN). You can download the latest IANA Time Zone Database file from the following URL: http://www.iana.org/time-zones.

The following steps will guide you through one method of installing the file to your device. However, depending on your network access and other preferences, you may need to modify these steps.

  1. Log into the Junos device.
  2. If you are in the CLI interface, open the shell interface.
  3. Create a tz directory in the /var/tmp and navigate to that directory.
  4. Using FTP, download the time zone files archive.
    Note:

    FTP must be enabled on your device before you can use FTP. FTP is enabled by adding the ftp statement into the [edit system services] hierarchy.

    Note:

    If needed, you can edit the above untarred files to create or modify the time zones.

  5. Select the names of time zone files to compile and feed them to the following script. For example, to generate northamerica and asia tz files:
  6. Enable the use of the generated tz files using the CLI:

    This should show the newly generated tz files in /var/db/zoneinfo/.

  7. Set the time zone and commit the configuration:
  8. Verify that the time zone change has taken effect:

Configure Custom Time Zone

To use a custom time zone, follow these steps:

  1. Download a time zones archive (from a known or designated source) to the router or switch. Compile the time zone archive using the zic time zone compiler, which generates tz files.
  2. Using the CLI, configure the router or switch to enable the use of the generated tz files as follows:
  3. Display the imported time zones (saved in the directory /var/db/zoneinfo/):

    If you do not configure the router to use imported time zones, the Junos OS default time zones are shown (saved in the directory /usr/share/zoneinfo/).