Pan-Os Cli Quick Start
Pan-Os Cli Quick Start
Quick Start
Version 7.0
Contact Information
Corporate Headquarters:
For information on how to configure other components in the Palo Alto Networks Next-Generation Security
Platform, go to the Technical Documentation portal: https://www.paloaltonetworks.com/documentation or
search the documentation.
For access to the knowledge base and community forums, refer to https://live.paloaltonetworks.com.
For contacting support, for information on support programs, to manage your account or devices, or to open a
support case, refer to https://www.paloaltonetworks.com/support/tabs/overview.html.
For the most current PAN-OS and Panorama 7.1 release notes, go to
https://www.paloaltonetworks.com/documentation/71/pan-os/pan-os-release-notes.html.
Table of Contents
Get Started with the CLI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Access the CLI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Give Administrators Access to the CLI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Set Up a Firewall Administrative Account and Assign CLI Privileges . . . . . . . . . . . . . . . . . . . 7
Set Up a Panorama Administrative Account and Assign CLI Privileges . . . . . . . . . . . . . . . . . 8
Change CLI Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Navigate the CLI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Find a Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
View the Entire Command Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Find a Specific Command Using a Keyword Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Get Help on Command Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Get Help on a Command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Interpret the Command Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Customize the CLI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Table of Contents
Find a Command
SSH ConnectionIf you have completed initial configuration, you can establish a CLI connection over the
network using a secure shell (SSH) connection.
Serial ConnectionIf you have not yet completed initial configuration or if you chose not to enable SSH
on the Palo Alto Networks device, you can establish a direct serial connection from a serial interface on
your management computer to the Console port on the device.
Launch the terminal emulation software and select the type of connection (Serial or SSH).
To establish an SSH connection, enter the hostname or IP address of the device you want to connect to and
set the port to 22.
To establish a Serial connection, connect a serial interface on management computer to the Console port
on the device. Configure the Serial connection settings in the terminal emulation software as follows:
Data rate: 9600
Data bits: 8
Parity: none
Stop bits: 1
Flow control: none
Step 2
Step 3
Description
superuser
Has full access to the Palo Alto Networks device (firewall or Panorama) and can define
new administrator accounts and virtual systems. You must have superuser privileges to
create an administrative user with superuser privileges.
superreader
vsysadmin
vsysreader
deviceadmin
Has full access to all firewall settings except for defining new accounts or virtual systems.
devicereader
Has read-only access to all firewall settings except password profiles (no access) and
administrator accounts (only the logged in account is visible).
panorama-admin
1.
2.
3.
4.
5.
1.
2.
3.
4.
5.
Step 2
1.
2.
3.
4.
5.
1.
2.
3.
4.
5.
OperationalUse operational mode to view information about the firewall and the traffic running
through it or to view information about Panorama or a Log Collector. Additionally, use operational mode
commands to perform operations such as restarting, loading a configuration, or shutting down. When you
log in, the CLI opens in operational mode.
ConfigurationUse configuration mode to view and modify the configuration.
You can switch between operational and configuration modes at any time, as follows:
Switch CLI Modes
To switch from operational mode to configuration mode:
username@hostname> configure
Entering configuration mode
[edit]
username@hostname#
Notice that the command prompt changes from a > to a #, indicating that you have successfully changed modes.
To switch from configuration mode to operational mode, use either the quit or exit command:
username@hostname# quit
Exiting configuration mode
username@hostname>
To enter an operational mode command while in configuration mode, use the run command, for example:
Find a Command
Find a Command
The find command helps you find a command when you don't know where to start looking in the hierarchy.
The commandwhich is available in all CLI modeshas two forms. Used alone, find command displays the
entire command hierarchy. Used with the keyword parameter, find command keyword displays all commands
that contain the specified keyword.
You can also view a complete listing of all PAN-OS 7.0 CLI commands or view the CLI changes between the
current and previous PAN-OS release.
command without any parameters to display the entire command hierarchy in the current command
Find a Command
clear
clear
clear
clear
clear
:
command keyword
From the resulting lists of commands, you can identify that the command you need is
set shared certificate-profile <name> username-field.
If youre not sure exactly what to enter in the command line, you can then Get Help on Command Syntax.
Use the Tab key in the middle of entering a command and the command will automatically
complete, provided there are no other commands that match the letters you have typed thus far.
For example, if you type set dev and then press Tab, the CLI will recognize that the command
you are entering is deviceconfig and automatically finish populating the command line.
Symbol
Description
>
+ remote-port
+ source-ip
* from
Source (username@host:path)
> servers
<Enter>
Finish input
Indicates that the option has an associated value that you must enter.
For example, when setting up a high availability configuration, notice that the
+ enabled notation indicates that you must supply a value for this option:
admin@PA-3060# set deviceconfig high-availability ?
+ enabled
enabled
> group
HA group configuration
> interface
HA interface configuration
<Enter>
Finish input
Getting help for the enabled option shows that you must enter a value of yes or no:
admin@PA-3060# set deviceconfig high-availability enabled ?
no
no
yes
yes
Symbol
Description
Allows you to filter command output. You can either specify a match value, which will
only show command output that matches the value you specify, or you can specify
an except value, which will only show command output except for the value you
specify.
For example, use the | match option to display only the app-version in the output
of the show system info command:
admin@PA-3060> show system info | match app-version
app-version: 500-2712
Similarly, to show all users in your group lists who are not part of your organization,
you should show the user group list, but exclude the organizational unit (ou) for your
organization. Notice that, although there are a total of 4555 user-to-group mappings,
with the | except filter you can easily see the small list of users who are part of
external groups:
admin@PA-3060> show user group list | except ou=acme
cn=sap_globaladmin,cn=users,dc=acme,dc=local
cn=dnsupdateproxy,ou=admin groups,ou=administrator
accounts,dc=acme,dc=local
cn=dhcp administrators,ou=admin groups,ou=administrator
accounts,dc=acme,dc=local
cn=helpservicesgroup,cn=users,dc=acme,dc=local
cn=exchange domain servers,cn=users,dc=acme,dc=local
cn=network configuration operators,cn=builtin,dc=acme,dc=local
cn=dhcp users,ou=admin groups,ou=administrator
accounts,dc=acme,dc=local
cn=exchange windows permissions,ou=microsoft exchange security
groups,dc=acme,dc=local
cn=wins users,cn=users,dc=acme,dc=local
cn=enterprise read-only domain controllers,cn=users,dc=acme,dc=local
cn=print-server-admins,ou=admin groups,ou=administrator
accounts,dc=acme,dc=local
cn=telnetclients,cn=users,dc=acme,dc=local
cn=servicenowpasswordreset,ou=admin groups,ou=administrator
accounts,dc=acme,dc=local
cn=delegated setup,ou=microsoft exchange security
groups,dc=acme,dc=local
Total: 4555
* : Custom Group
</result></response>
admin@PA-3060>
never
<value>
<1-1440>
If you want to set the CLI timeout value to a value different from the global management idle-timeout value,
use the set cli timeout command in operational mode.
default
json
json
set
set
xml
xml
For example, in the default setting the config-output-format looks like this:
admin@PA-3060# show deviceconfig system ntp-servers
ntp-servers {
primary-ntp-server {
ntp-server-address pool.ntp.org;
authentication-type {
none;
}
}
}
Changing the setting to set results in output that looks like this:
admin@PA-3060# show deviceconfig system ntp-servers
set deviceconfig system ntp-servers primary-ntp-server ntp-server-address pool.ntp.org
set deviceconfig system ntp-servers primary-ntp-server authentication-type none
[edit]
Changing the setting to xml results in output that looks like this:
admin@PA-3060# show deviceconfig system ntp-servers
<response status="success" code="19">
<result total-count="1" count="1">
<ntp-servers>
<primary-ntp-server>
<ntp-server-address>pool.ntp.org</ntp-server-address>
<authentication-type>
<none/>
</authentication-type>
</primary-ntp-server>
</ntp-servers>
</result>
</response>
Switch to scripting mode. In scripting mode, you can copy and paste commands from a text file directly into the CLI.
Although you can do this without scripting-mode enabled (up to 20 lines). If you cut-and-paste a block of text into
the CLI, examine the output of the lines you pasted. If you see lines that are truncated or generate errors, you may
have to re-paste a smaller section of text, or switch to scripting-mode:
admin@PA-3060> set cli scripting-mode on
When in scripting-mode, you cannot use Tab to complete commands or use ? to get help on command syntax.
When you are done pasting commands, switch back to regular mode using the set cli scripting-mode
off command.
Load Configurations
The show
device.
session info command shows details about the sessions running through the Palo Alto Networks
When deleting configuration settings or objects using the CLI, the device does not check for dependencies
like it does in the web interface. Therefore, when you use delete from the CLI, you must manually search the
configuration for other places where the configuration object might be referenced. For example, before you
delete an application filter group named browser-based business, you should search the CLI for that value to
see if it is used anywhere in profiles or policies, using the following command:
admin@PA-3060> show config running | match "browser-based business"
Notice that because the object you are matching on has a space in it, you must enclose it in quotation marks.
2. View the validation results using the job ID that was displayed when you entered the validate command.
Verify that the job finished (FIN) and that the configuration is valid as shown in the following example:
[edit]
admin@PA-3060# exit
Exiting configuration mode
admin@PA-3060> show jobs id 3041
Enqueued
ID
Type
-------------------------------------------------------------------------2015/05/18 14:00:40
3041
Validate
FIN
OK 14:01:11
3. If the validation fails, fix any errors and then repeat steps 1 and 2.
After successfully validating the configuration, save it to the running configuration by performing a commit of
all or a portion of the configuration:
Commit the entire configuration:
admin@PA-3060# commit
Commit part of the configuration on a multi-vsys firewall:
admin@PA-3060# commit partial ?
+ device-and-network
device-and-network
+ shared-object
shared-object
> no-vsys
no-vsys
> vsys
vsys
<Enter>
Finish input
When doing a partial commit from the CLI, you must specify what part of the configuration to exclude from
the commit. For example, if you want to commit the vsys1 configuration changes and the shared objects,
you would enter the following command:
admin@PA-3060# commit partial vsys vsys1 device-and-network excluded
Commit part of the configuration on a firewall that does not have multiple virtual systems mode enabled:
admin@PA-200# commit partial ?
+ device-and-network
device-and-network
+ policy-and-objects
policy-and-objects
<Enter>
Finish input
For example, if you made a change in the security policy only, you might want to commit just the policy and
objects portion of the configuration as follows:
admin@PA-200# commit partial device-and-network excluded
(Vsys-specific authentication profiles only) Specify which virtual system (vsys) contains the authentication
profile you want to test. This is only necessary if you are testing an authentication profile that is specific to a
single vsys (that is, you do not need to do this if the authentication profile is shared).
admin@PA-3060> set system setting target-vsys <vsys-name>
For example, to test an authentication profile in vsys2 you would enter the following command:
admin@PA-3060> set system setting target-vsys vsys2
The set
Load Configurations
Load Configurations
On the device from which you want to copy configuration commands, set the CLI output mode to set:
admin@fw1> set cli config-output-format set
Step 2
Show the part of the configuration you want to copy. For example, to copy the SNMP configuration you
would enter the following command:
admin@fw1# show deviceconfig system snmp-setting
set deviceconfig system snmp-setting snmp-system location Headquarters
set deviceconfig system snmp-setting snmp-system contact [email protected]
set deviceconfig system snmp-setting access-setting version v2c snmp-community-string
public
When pasting commands into the command line, make sure you are entering them in the proper order
to avoid errors. Sometimes commands shown in the CLI are not the order in which they must be
configured on the device (for example, if you are pasting a configuration from a firewall into
Panorama). If you see errors, check whether the command that generated the error is dependent on a
later command. In these cases, you can usually just reenter the command. Also make sure you are
pasting sections of a configuration in a logical order. For example, you should not copy security policy
rules if you have not yet configured the objects the rules rely on, such as zones, security profiles, or
address groups.
Step 3
Copy the commands to a text editor such as Notepad and edit the settings as desired.
Step 4
On the second device, paste the commands into the command line.
There is a limit to the amount of text that can be copied into the SSH buffer (approximately 20 lines).
If you cut-and-paste a large block of text into the CLI, examine the output of the lines you pasted. If
you see lines that are truncated or generate errors, you may have to re-paste a smaller section of text,
or switch to scripting mode using the set cli scripting-mode on operational mode command,
which increases the buffer significantly.
Step 5
Load Configurations
config partial
A saved configuration file from a Palo Alto Networks firewall or from Panorama
To load a partial configuration, you must identify the configuration file you want to copy from and, if it is not
local, import it onto the device (see Use Secure Copy to Import and Export Files for an example of how to
import a saved configuration).
If you are managing more than two or three firewalls, consider using Panorama for central
management and monitoring of your firewalls.
To specify what part of the configuration to load, you must find the xpath location, which specifies the XML
node in the configuration file you are loading from and the node in the local candidate configuration you are
loading to.
The format of the command is:
admin@PA-3060# load config partial from <filename> from-xpath <source-xpath> to-xpath
<destination-xpath> mode [append|merge|replace]
You specify the source and destination of the load partial command using xpath locations, which specify
the XML node in the configuration you are copying from (from-xpath) and the XML node in the candidate
configuration you are copying to (to-xpath). Determining the correct xpath is a critical part of using this
command. The following table shows the format for the from-xpath and to-xpath on different types of
devices. Notice that the from-xpath begins at devices or shared, whereas the to-xpath begins with /config.
Type of Device
Configuration
Xpath Formats
Multi-vsys
Firewall
from-xpath
devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys-ID']/<object>
to-xpath
/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys-ID']/<object>
Single-vsys
Firewall
from-xpath
devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/<object>
to-xpath
/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/<object>
Panorama
Shared Object
from-xpath
shared/<object>
to-xpath
/config/shared/<object>
Load Configurations
Type of Device
Configuration
Xpath Formats
Panorama
Device Group
Object
from-xpath
/devices/entry[@name='localhost.localdomain']/device-group/entry[@name='device-group-name']/
<object>
to-xpath
/config/devices/entry[@name='localhost.localdomain']/device-group/entry[@name='device-groupname']/<object>
You can also find the xpath from the CLI debug mode (use the operational mode command debug
mode on to enable this), and then enter the configuration mode show command that shows the
object you are interested in copying. For example, to see the xpath for the application object
configuration in vsys1, you would use enter the show vsys vsys1 application command. Look
for the section of the output that begins with <request cmd="get" obj=". This signals the
beginning of the xpath. In the following example, the highlighted section is the xpath for the
application objects in vsys1:
admin@PA-3060# show vsys vsys1 application
(container-tag: vsys container-tag: entry key-tag: name value: vsys1
container-tag: application)
((eol-matched: . #t) (eol-matched: . #t) (eol-matched: . #t) (xpath-prefix: .
/config/devices/entry[@name='localhost.localdomain'])
(context-inserted-at-end-p: . #f))
/usr/local/bin/pan_ms_client --config-mode=default --set-prefix='set vsys vsys1 '
--cookie=2588252477840140 <<'EOF' |/usr/bin/less -X -E -M
<request cmd="get"
obj="/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/applic
ation"></request>
EOF
4. After you find the xpath for the node you want to load, refer to the table above to find the proper
from-xpath format and to-xpath format per the type of device you are loading the configuration from and
to.
Load Configurations
Use the load config partial command to copy sections of the configuration you just imported. For
example, you would use the following command to load the application filters you configured on fw1 from a
saved configuration file, fw1-config.xml, you imported from fw1 (a single-vsys firewall) to vsys3 on fw2.
Notice that even though fw1 does not have multiple virtual system support, the xpath still points to the vsys1
(the default vsys ID on single-vsys firewalls):
admin@fw2# load config partial from fw1-config.xml from-xpath
devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/application-filter to-xpath
/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys3']/application-filter mode merge
The quotation marks around the hostname and the vsys name (if applicable) must be neutral. The
command will fail if there are opened or closed quotation marks.
Step 3
The following example shows how to export a saved configuration from one firewall and import it onto
another. You can then Load a Partial Configuration from the first firewall onto the second firewall.
Export and Import Configurations
Step 1
On the first firewall, save the current configuration to a named configuration snapshot using the save
config to <filename> command in configuration mode. For example:
admin@PA-fw1# save config to fw1-config
Step 2
Export the named configuration snapshot and log database to an SCP-enabled server using the scp export
command in operational mode. When prompted, enter the password for your SCP server account.
admin@fw1> scp export configuration from <named-config-file> to <username@host:path>
For an SCP server running on Windows, the destination folder/filename path for both the export and import
commands requires a drive letter followed by a colon. For example:
admin@fw1> scp export configuration from fw1-config.xml to [email protected]:c:/fw-config
Step 3
Log in to the firewall to which you want to copy the configuration and logs, and then import the configuration
snapshot and log database. When prompted, enter the password for your SCP server account.
admin@fw2> scp import configuration from <username@host:path_to_named-config-file>
For example (on a Windows-based SCP server):
admin@fw2> scp import configuration from [email protected]:c:/fw-configs/fw1-config.xml
This example shows how to export and import a complete log database (logdb).
Import or Export the Log Database
Step 1
Export a log database to an SCP-enabled server using the scp export command in operational mode. When
prompted, enter the password for your SCP server account.
admin@fw1> scp export logdb to <username@host:path_to_destination_filename>
For an SCP server running on Windows, the destination folder/filename path for both the export and import
commands requires a drive letter followed by a colon. For example:
admin@fw1> scp export logdb to [email protected]:c:/fw-logs/fw1-logdb
Step 2
Log in to the firewall on which to import a log database, and then enter the import command. When prompted,
enter the password for your SCP server account.
admin@fw2> scp import logdb from <username@host:path_to_destination_filename>
For example (on a Windows-based SCP server):
admin@fw2> scp import logdb from [email protected]:c:/fw-logs/fw1-logdb
Start here...
MGT interface
admin password
DNS
NTP
Interfaces
System settings
Zones
Security Profiles
# set profiles
HIP Objects/Profiles
# set vsys <name> profiles
URL Filtering Profiles
# set shared profiles
WildFire Analysis Profiles
Server Profiles
# set server-profile
# set vsys <name> server-profile
# set shared server-profile
Authentication Profiles
# set authentication-profile
# set vsys <name> authentication-profile
# set shared authentication-profile
Certificate Profiles
# set certificate-profile
# set vsys <name> certificate-profile
# set shared certificate-profile
Policy
# set rulebase
# set vsys vsys1 rulebase
Log Quotas
User-ID
#
#
#
#
HA
WildFire Settings
Panorama
set
set
set
set
user-id-agent
vsys <name> user-id-agent
user-id-collector
vsys <name> user-id-collector
To configure...
Start here...
Restart
Use...
Show the administrators who are currently logged in to > show admins
the web interface, CLI, or API.
Show the administrators who can access the web
> show admins all
interface, CLI, or API, regardless of whether those
administrators are currently logged in.
When you run this command on the firewall, the output
includes both local administrators and those pushed
from a Panorama template.
>
>
>
>
show
show
show
show
user
user
user
user
group-mapping statistics
group-mapping state all
group list
group name <group-name>
> show log userid datasourcename equal <agent-name> direction equal backward
View mappings from a particular type of authentication service:
>
+
+
+
+
+
+
+
+
+
*
>
>
>
For example:
Use . . .
NAT
Show the NAT policy table
IPSec
Show IPSec counters
Show a list of all IPSec gateways and their > show vpn gateway
configurations
Show IKE phase 1 SAs
Troubleshooting
Ping from the management (MGT)
interface to a destination IP address
Use . . .
View a list of virtual systems configured on the admin@PA> set system setting target-vsys ?
firewall
none
none
vsys1
vsys2
<value>
vsys1
vsys2
<value>
Switch to a particular vsys so that you can issue admin@PA> set system setting target-vsys
commands and view data specific to that vsys <vsys-name>
For example, use the following command to switch to vsys2; note
that the vsys name is case sensitive:
If you want to . . .
Use . . .
M-Series Appliance Mode of Operation (Panorama, Log Collector, or PAN-DB Private Cloud Mode)
Switching the mode reboots the M-Series appliance, deletes any existing log data, and deletes all configurations
except the management access settings.
Display the current operational mode.
Switch from Panorama mode to PAN-DB > request system system-mode panurldb
private cloud mode (M-500 appliance
only).
Switch from Log Collector mode or
PAN-DB private cloud mode (M-500
appliance only) to Panorama mode.
If you want to . . .
Use . . .