Junos License Management: Add, Check and Delete Licenses - 夜莺博客

Junos License Management: Add, Check and Delete Licenses

A Junos device can boot perfectly, pass link, and still refuse to forward traffic because a feature license is missing or expired. On SRX firewalls the most common symptom is a policy that will not install; on EX and QFX switches it is a port that stays down or an advanced feature that silently fails to activate. This guide collects the operational commands you need to inspect, add, renew and delete Junos license keys, plus the checks that tell you whether a key was actually accepted by the device.

Where Junos licenses live

Junos stores license keys in the configuration under system license keys and in the device's license database, which is why the same key can be added either from a file or inline as a configuration statement. Keys are bound to the chassis serial number, so a key generated for one switch cannot be installed on another.

Checking installed licenses

show system license

The primary command lists every installed feature, its usage count and its validity date:

user@host> show system license
License usage:
                                 Licenses     Licenses    Licenses    Expiry
  Feature name                       used    installed      needed
  Virtual Appliance                      0            1           0    permanent
  SRX100HS                               0            0           0    2027-02-25
  advanced-ipsec                         0            0           0    2027-02-25

Licenses installed:
  License identifier: JUNOS123456
  License version: 4
  Software Serial Number: ABC1234
  Customer ID: MyCorp
  Features:
    Virtual Appliance  - none
      date-based, 2026-01-01 05:30:00 - 2027-01-01 05:30:00

Read three things from this output: the Expiry column (permanent, a date, or expired), the needed column (any non-zero value means the device is running a feature it is not entitled to use), and the feature list per license identifier. A timed license that has passed its end date shows as expired but remains visible until it is removed or the device cleans it up.

Checking usage per feature

user@host> show system license usage
user@host> show system license keys

Adding a license key

From operational mode

The quickest method is to paste the key directly into privileged mode:

user@host> request system license add terminal
[Type ^D at a new line to end input]
JUNOS123456 abcdef ...
^D
License keys installed successfully

The same command reads a file from the local filesystem when you have downloaded the key from the Juniper licensing portal:

user@host> request system license add /var/tmp/license_key.txt

From configuration mode

user@host# set system license keys key "JUNOS123456 abcdef ..."
user@host# commit

Configuration-mode installation is useful when the key is applied as part of an automated build, because it survives a configuration rollback and is visible in show configuration system license.

Auto-updating subscription licenses

Subscription and trial keys on QFX, SRX, EX, NFX, vBNG, vMX, vSRX and ACX devices can be refreshed from the Juniper Agile Licensing portal without manually re-installing a key:

user@host> request system license update
Trying to update license keys from https://ae1.juniper.net has been sent,
use show system license to check status.

user@host> request system license update trial

Autoupdate renews 60 days before expiry and retries every 24 hours by default, so a device that can reach ae1.juniper.net on TCP 443 keeps its own keys current. Devices without internet access need the key re-installed manually at each renewal.

Deleting a license key

user@host> show system license > /var/tmp/license-listing.txt
user@host> request system license delete JUNOS123456
user@host# delete system license keys key "JUNOS123456 abcdef ..."

Delete only after confirming the features the key enables are not in use; removing a key for an active feature can take that feature down at the next commit.

Troubleshooting checklist

  • Key rejected as invalid — the key was generated for a different chassis serial number, or it was copied with a line break in the middle of the base64 block. Re-paste it as a single continuous string.
  • Feature still not working after install — check show system license usage for a non-zero "needed" value and confirm the feature name matches what the platform expects.
  • License expired but traffic still flows — some platforms continue to pass existing sessions; new feature activation and configuration commits are what fail. Treat an expired key as an outage in waiting.
  • Autoupdate never succeeds — DNS resolution or outbound HTTPS to ae1.juniper.net is being blocked. Test with ping ae1.juniper.net and confirm the management VRF has a default route.
  • Keys disappear after a software upgrade — verify the license database with show system license keys and re-add the key if the upgrade erased the local file copy.

See also: Junos software upgrade with request system software, installing a Junos .tgz package on EX switches, and essential Junos troubleshooting commands.

原文链接:https://www.juniper.net/documentation/us/en/software/license/juniper-licensing-user-guide/topics/topic-map/monitor-junos-licenses.html