Technical Documentation

Setting a Custom Time Zone on Routers or Switches Running JUNOS Software

You can update the time zone database information on routers or switches running JUNOS Software. This feature simplifies time zone management in devices running JUNOS Software by allowing for future unforeseen time zone database adjustments. You can configure your router to use a custom time zone database file that you create to meet your requirements by editing an existing time zone database file.

Tasks for setting a custom time zone are:

  1. Importing and Installing Time Zone Files
  2. Configuring a Custom Time Zone

Importing and Installing Time Zone Files

To import and install time zone files, follow these steps:

  1. Download the time zone files archive and untar them to a temporary directory such as /var/tmp:
    # mkdir -p /var/tmp/tz && cd /var/tmp/tz && rm *
    # wget '*.tar.gz'
    # tar xvzf tzdata*.gz


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

  2. 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:
    # /usr/libexec/ui/compile-tz northamerica asia
  3. Enable the use of the generated tz files using the CLI:
    # set system use-imported-time-zones

    # set system time-zone ?

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

  4. Set the time zone and commit:
    # set system time-zone <your-time-zone>
    # commit
  5. Verify that the time zone change has taken effect:
    # run show system uptime

Configuring a 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. Compile the time zone archive using the zic time zone compiler, which generates tz files.
  2. Using the CLI, configure the router to enable the use of the generated tz files as follows:
    user@host# set system use-imported-time-zones
  3. Display the imported time zones (saved in the directory /var/db/zoneinfo/):
    user@host# set system time-zone ?

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

Published: 2010-04-26