​Junos Commit At Command

The Junos commit at command allows us to schedule a commit for either a future date or after the next reboot.

Commit At Example

In this example, we’re going to put a basic configuration on interface ge-0/0/3 and schedule a commit in the future. This is the new config being added.

[edit]
lab@vMX-1# show | compare 
[edit interfaces ge-0/0/3]
+    unit 0 {
+        family inet {
+            address 172.16.100.1/24;
+        }
+    }

[edit]
lab@vMX-1#

Scheduling The Commit

When scheduling the commit the time can be specified as any of the following:

  • reboot – The configuration will be applied upon the next reboot
  • Time “HH:MM:SS” – A time in the future, on the current day before 23:59:59.
  • Date and Time “YYYY-MM-DD HH:MM:SS”

In the below output, we show the current time and issue the commit at command.

[edit]
lab@vMX-1# run show system uptime    
Current time: 2024-01-01 01:55:04 UTC
Time Source:  LOCAL CLOCK 
System booted: 2024-01-01 01:45:33 UTC (00:09:31 ago)
Protocols started: 2024-01-01 01:49:05 UTC (00:05:59 ago)
Last configured: 2023-12-30 03:56:43 UTC (1d 21:58 ago) by root
 1:55AM  up 10 mins, 1 users, load averages: 0.49, 0.65, 0.45

[edit]
lab@vMX-1# commit at "01:58:00" 
configuration check succeeds
commit at will be executed at 2024-01-01 01:58:00 UTC
The configuration has been changed but not committed
Exiting configuration mode

lab@vMX-1>

Note that you will be logged out of configuration mode. No further commits can be made until the scheduled commit is either run or canceled.

After letting the time pass, we can check the current configuration.

lab@vMX-1> show system uptime 
Current time: 2024-01-01 02:04:36 UTC
Time Source:  LOCAL CLOCK 
System booted: 2024-01-01 01:45:33 UTC (00:19:03 ago)
Protocols started: 2024-01-01 01:49:05 UTC (00:15:31 ago)
Last configured: 2024-01-01 01:58:30 UTC (00:06:06 ago) by lab
 2:04AM  up 19 mins, 1 users, load averages: 0.25, 0.41, 0.42

lab@vMX-1> show configuration | compare rollback 1 
[edit interfaces ge-0/0/3]
+    unit 0 {
+        family inet {
+            address 172.16.100.1/24;
+        }
+    }

lab@vMX-1> 

What Happens While Commits Are Scheduled

While there is a pending commit, the configuration cannot be changed.

lab@vMX-1> configure 
Entering configuration mode
Users currently editing the configuration:
  lab terminal pts/0 (pid 8774) on since 2024-01-01 02:11:19 UTC, idle 00:03:41
      commit-at
The configuration has been changed but not committed

[edit]
lab@vMX-1# set interfaces lo0 description "A New Description Here" 
error: configuration database locked by:
  lab terminal pts/0 (pid 8774) on since 2024-01-01 02:11:19 UTC, idle 00:04:04
      commit at
error: configuration database locked by:
  lab terminal pts/0 (pid 8774) on since 2024-01-01 02:11:19 UTC, idle 00:04:04
      commit at

[edit]
lab@vMX-1# commit 
error: Another commit is pending

[edit]
lab@vMX-1# exit 
The configuration has been changed but not committed
Exiting configuration mode

lab@vMX-1>

How To See What Commits Are Scheduled

You can see pending commits with show system commit. Pay close attention to the first line.

lab@vMX-1> show system commit 
commit requested by lab via cli at 2024-01-01 01:58:00 UTC
0   2023-12-30 03:56:43 UTC by root via cli
1   2023-12-29 13:57:42 UTC by lab via cli
2   2023-12-29 13:56:14 UTC by lab via cli
3   2023-12-29 13:51:24 UTC by lab via cli

To see what configuration is going to be applied, you should be able to enter configuration mode and perform a show | compare. Using a ‘show configuration | compare …’ will not work, as that shows the current configuration and the scheduled commit is still pending and not yet committed.

lab@vMX-1> configure 
Entering configuration mode
Users currently editing the configuration:
  lab terminal pts/0 (pid 8774) on since 2024-01-01 02:11:19 UTC, idle 00:05:41
      commit-at
The configuration has been changed but not committed

[edit]
lab@vMX-1# show | compare 
[edit interfaces ge-0/0/3]
+    unit 0 {
+        family inet {
+            address 172.16.100.1/24;
+        }
+    }

[edit]
lab@vMX-1# exit 
The configuration has been changed but not committed
Exiting configuration mode

lab@vMX-1>

How To Cancel A Scheduled Commit

To cancel a commit use the ‘clear system commit’ command.

lab@vMX-1> show system commit 
commit requested by lab via cli at 2024-01-01 02:30:00 UTC
0   2024-01-01 02:11:23 UTC by lab via cli
1   2024-01-01 01:58:30 UTC by lab via cli commit at
2   2023-12-30 03:56:43 UTC by root via cli
3   2023-12-29 13:57:42 UTC by lab via cli
OUTPUT REMOVED FOR BREVITY
                                        
lab@vMX-1> clear system commit 
Pending commit cleared

lab@vMX-1> show system commit 
0   2024-01-01 02:11:23 UTC by lab via cli
1   2024-01-01 01:58:30 UTC by lab via cli commit at
2   2023-12-30 03:56:43 UTC by root via cli
3   2023-12-29 13:57:42 UTC by lab via cli
OUTPUT REMOVED FOR BREVITY
                                        
lab@vMX-1> 

Although the scheduled commit is canceled, it appears the configuration remains in the candidate configuration file. We can check this by entering configuration mode and doing a show | compare again.

lab@vMX-1> configure 
Entering configuration mode
The configuration has been changed but not committed

[edit]
lab@vMX-1# show | compare 
[edit interfaces ge-0/0/3]
+    unit 0 {
+        family inet {
+            address 172.16.100.1/24;
+        }
+    }

[edit]
lab@vMX-1#

Commit At From Configure And Configure Private Modes

Is there a difference in running commit at from configure mode compared to configure private?

Let’s try configure first with the following steps:

  • Enter configure mode
  • Configure interface ge-0/0/3 and show | compare
  • Enter the commit at command
  • Enter configuration mode and view pending configuration
  • Cancel the scheduled commit, re-enter configuration mode, and do a show | compare
lab@vMX-1> configure 
Entering configuration mode

[edit]
lab@vMX-1# set interfaces ge-0/0/3 unit 0 family inet address 172.16.100.1/24   

[edit]
lab@vMX-1# show | compare 
[edit interfaces ge-0/0/3]
+    unit 0 {
+        family inet {
+            address 172.16.100.1/24;
+        }
+    }

[edit]
lab@vMX-1# commit at 03:00:00 
configuration check succeeds
commit at will be executed at 2024-01-01 03:00:00 UTC
The configuration has been changed but not committed
Exiting configuration mode

lab@vMX-1> edit 
Entering configuration mode
Users currently editing the configuration:
  lab terminal pts/0 (pid 9478) on since 2024-01-01 02:42:50 UTC
      commit-at
The configuration has been changed but not committed

[edit]
lab@vMX-1# show | compare 
[edit interfaces ge-0/0/3]
+    unit 0 {
+        family inet {
+            address 172.16.100.1/24;
+        }
+    }

[edit]
lab@vMX-1# exit 
The configuration has been changed but not committed
Exiting configuration mode

lab@vMX-1> clear system commit 
Pending commit cleared

lab@vMX-1> edit 
Entering configuration mode
The configuration has been changed but not committed

[edit]
lab@vMX-1# show | compare 
[edit interfaces ge-0/0/3]
+    unit 0 {
+        family inet {
+            address 172.16.100.1/24;
+        }
+    }

[edit]
lab@vMX-1# exit 
The configuration has been changed but not committed
Exit with uncommitted changes? [yes,no] (yes) yes 

Exiting configuration mode

lab@vMX-1>

After we cancel the pending commit, the planned configuration is still in the shared candidate configuration. What happens if we repeat this using configure private?

lab@vMX-1> configure private 
warning: uncommitted changes will be discarded on exit
Entering configuration mode

[edit]
lab@vMX-1# set interfaces ge-0/0/3 unit 0 family inet address 172.16.100.1/24 

[edit]
lab@vMX-1# show | compare 
[edit interfaces ge-0/0/3]
+    unit 0 {
+        family inet {
+            address 172.16.100.1/24;
+        }
+    }

[edit]
lab@vMX-1# commit at 03:00:00 
configuration check succeeds
commit at will be executed at 2024-01-01 03:00:00 UTC
Exiting configuration mode

lab@vMX-1> configure 
Entering configuration mode
Users currently editing the configuration:
  lab terminal pts/0 (pid 9478) on since 2024-01-01 02:48:23 UTC
      commit-at
The configuration has been changed but not committed

[edit]
lab@vMX-1# show | compare 
[edit interfaces ge-0/0/3]
+    unit 0 {
+        family inet {
+            address 172.16.100.1/24;
+        }
+    }

[edit]
lab@vMX-1# exit 
The configuration has been changed but not committed
Exiting configuration mode

lab@vMX-1> clear system commit 
warning: discarding uncommitted changes
Pending commit cleared

lab@vMX-1> configure 
Entering configuration mode

[edit]
lab@vMX-1# show | compare 

[edit]
lab@vMX-1# exit 
Exiting configuration mode

lab@vMX-1>

A couple of things are worth noting. Even though we made the commit in a private configuration, while the commit is scheduled it appears to be visible in the shared candidate configuration file. Once canceled, however, the pending configuration is no longer present and is discarded.

Is Commit At Useful

I have never used the commit at command in a production network.

If we take the command at face value, it allows a configuration change to be made during the day, but applied at a time in the future, presumably outside of business hours.

The issues I have with this are:

  • No other commits can be made while the scheduled commit is pending
  • For most changes, I want to be present to ensure the change doesn’t break anything, rather than finding out in the morning when people are complaining about the network
  • If a change is simple enough I don’t have to worry about it breaking the network, why is it not being done as a normal change during the day?

On the other hand, this might be useful on a smaller network, where there are fewer changes or the organization is comfortable with network changes happening without someone immediately checking for issues.

Leave a Comment

Your email address will not be published. Required fields are marked *