Installing your own time base database on Junos devices
In connection with the event that awaits us soon: the day, or rather nights, “no transition to winter time”, I would like to tell you about updating the base of time zones on Juniper Networks, Inc. equipment. executing the Junos operating system.
The procedure itself is beautifully described in the documentation presented on the company's website, in the document: " Setting a Custom Time Zone on Routers Running JUNOS Software ". I will only talk about it in my native language and clarify certain details. The developers of the operating system were sightedly noticed that the update of the time zone database may occur more often than the update of the operating system itself. And they provided the opportunity to use the database, personally modified by the administrators operating their equipment.
How to do it?
First, we need to get and upload the latest time zone database to the device. Junos developers use a completely standard " Time Zone Database " used in many other operating systems. Its current version is available on the IANA website. ')
I dare to assume that you, as an administrator, have access to equipment via the SSH protocol. And, accordingly, you can use the SCP to transfer the base obtained from IANA to the device.
In this case, we put the archive we need into the user's home directory “admin-name”, located on the device with the DNS name “junos-host.domain.tld”. This is just one of the possible ways. Another, I will describe later.
Second, we need to log in to the updatable device with Junos, using the SSH protocol. And get a shell on it using the "start shell" command
- JUNOS 10.2R3.10 built 2010-10-16 20:36:59 UTC admin-name @ junos-host> start shell %
You will find yourself in the home directory of the user under which you registered. If you used the same username when copying the time zone database file, you will be able to see this file by executing the “ls -lh” command. You can find out the current location within the file system using the “pwd” command.
Let's return to the first point and I will tell about one more way to receive the file with archive of temporary zones on the device. This method may be suitable if you have access to the Internet from your device. You can use the fetch command and download the file directly from the IANA site while in shell mode on the device.
Third, unpack the contents of the time zone database archive file into the recommended directory in the documentation.
% mkdir -p / var / tmp / tz && cd / var / tmp / tz && rm * % tar xzvf /var/home/admin-name/tzdata*.gz
Notice that we have made the directory "/ var / tmp / tz" current. And it unpacked the contents of the archive file located in the home directory of the user, under whose name you registered on the device. If you executed the “pwd” command described in clause two, you noticed that the path to the home directory shown at that moment and the path used in the “tar” command are different. You can use any of the options. Junos simply creates symbolic links for the respective directories.
If necessary, at the moment, you can modify the database files, which are plain text files, using, for example, the text editor "vi" available in the system.
% vi europe
Fourth. To execute the following items, you need to get the “root” user privileges on the device. This can be done using the “su” program.
% su Password: root @ junos-host%
A legitimate question arises: “Where can I get the password for the root user”? Well, of course, if you do not know him. The password is stored in the device configuration, section system.
The fifth. To compile the user time zone database, we will use the “compile-tz” script. In it, in fact, there is only a call to the application "zic" with preset parameters.
% / usr / libexec / ui / compile-tz europe
As parameters of the script, we pass the name of the source file or several files, or any parameters valid for the "zic" command.
The resulting compiled time zone database files will be placed in the directory: "/ var / db / zoneinfo /".
The sixth. How to apply the resulting database? You just need to specify the use of imported time zone database (use-imported-time-zones) and set the time zone correctly (time-zone).
[edit] admin-name @ junos-host # set system use-imported-time-zones
[edit] admin-name @ junos-host # set system time-zone Europe / Moscow