Written for PAN-OS 11.2 and 12.1 on Palo Alto Networks next-generation firewalls, and checked against Palo Alto Networks' documentation and knowledge base. Each command shows the mode it's typed in: operational is the > prompt you get after logging in, and configuration is # (after configure). Config changes do nothing until you commit them. The routing commands are for the legacy virtual router; firewalls using the Advanced Routing Engine configure routing under logical routers instead. Names, addresses and passwords are examples, so swap in your own.

Modes and getting around #

  • Go into configuration modePAN-OS · Operational mode (>)
    configure
  • Leave configuration modePAN-OS · Configuration mode (#)
    exit
  • Run an operational command from configuration modePAN-OS · Configuration mode (#)
    run show system info
  • Show the model, serial number, PAN-OS version and uptimePAN-OS · Operational mode (>)
    show system info
  • Stop output pausing at the end of each screenPAN-OS · Operational mode (>)
    set cli pager off
  • Show config as set commands instead of XML-style blocksPAN-OS · Operational mode (>)
    set cli config-output-format set
  • Find commands that contain a wordPAN-OS · Operational mode (>)
    find command keyword session
  • Show only lines that match some textPAN-OS · Operational mode (>)
    show interface all | match session
  • Show running and finished jobs (commits, downloads, installs)PAN-OS · Operational mode (>)
    show jobs all
  • Show one job's progressPAN-OS · Operational mode (>)
    show jobs id 42
  • Show who is logged inPAN-OS · Operational mode (>)
    show admins
  • Show the date and timePAN-OS · Operational mode (>)
    show clock

Commit and configuration files #

  • Show the changes you haven't committedPAN-OS · Operational mode (>)
    show config diff
  • Check the changes without applying themPAN-OS · Configuration mode (#)
    validate full
  • Apply the changesPAN-OS · Configuration mode (#)
    commit
  • Apply the changes with a descriptionPAN-OS · Configuration mode (#)
    commit description "Allow web from inside"
  • Throw away uncommitted changes by reloading the running configPAN-OS · Configuration mode (#)
    load config from running-config.xml
  • Show the running configPAN-OS · Operational mode (>)
    show config running
  • Show the candidate config (with your changes)PAN-OS · Operational mode (>)
    show config candidate
  • Save the candidate config to a named filePAN-OS · Configuration mode (#)
    save config to before-change.xml
  • Load a saved config file, ready to commitPAN-OS · Configuration mode (#)
    load config from before-change.xml

    Warning: Replaces the whole candidate config. Check it with show config diff, then commit.

  • Copy the running config to an SCP serverPAN-OS · Operational mode (>)
    scp export configuration from running-config.xml to [email protected]:/backups
  • Copy a config file in from an SCP serverPAN-OS · Operational mode (>)
    scp import configuration from [email protected]:/backups/before-change.xml

Basic setup #

  • Set the hostnamePAN-OS · Configuration mode (#)
    set deviceconfig system hostname pa-fw1
  • Set the management interface addressPAN-OS · Configuration mode (#)
    set deviceconfig system ip-address 192.168.10.2 netmask 255.255.255.0 default-gateway 192.168.10.1

    Warning: Your session drops when you commit if you're connected to the old address.

  • Set the DNS serverPAN-OS · Configuration mode (#)
    set deviceconfig system dns-setting servers primary 192.168.10.53
  • Set the NTP serverPAN-OS · Configuration mode (#)
    set deviceconfig system ntp-servers primary-ntp-server ntp-server-address pool.ntp.org
  • Set the time zonePAN-OS · Configuration mode (#)
    set deviceconfig system timezone Europe/Dublin
  • Allow management access only from one networkPAN-OS · Configuration mode (#)
    set deviceconfig system permitted-ip 192.168.10.0/24

    Warning: Once one is set, only listed networks can reach the management interface. Add your own first.

  • Add an admin user with full rightsPAN-OS · Configuration mode (#)
    set mgt-config users netadmin permissions role-based superuser yes
  • Set an admin's password (it asks for it)PAN-OS · Configuration mode (#)
    set mgt-config users netadmin password

Interfaces, zones and routing #

  • Give a Layer 3 interface an IP addressPAN-OS · Configuration mode (#)
    set network interface ethernet ethernet1/1 layer3 ip 192.168.20.1/24
  • Allow ping and other management on an interfacePAN-OS · Configuration mode (#)
    set network interface ethernet ethernet1/1 layer3 interface-management-profile allow-ping
  • Add a VLAN subinterfacePAN-OS · Configuration mode (#)
    set network interface ethernet ethernet1/1 layer3 units ethernet1/1.10 tag 10
  • Put an interface in a zonePAN-OS · Configuration mode (#)
    set zone trust network layer3 ethernet1/1
  • Add an interface to the virtual routerPAN-OS · Configuration mode (#)
    set network virtual-router default interface ethernet1/1
  • Add a default routePAN-OS · Configuration mode (#)
    set network virtual-router default routing-table ip static-route default-route destination 0.0.0.0/0 nexthop ip-address 203.0.113.1
  • Show every interfacePAN-OS · Operational mode (>)
    show interface all
  • Show one interface's counters and settingsPAN-OS · Operational mode (>)
    show interface ethernet1/1
  • Show the routing tablePAN-OS · Operational mode (>)
    show routing route
  • Show the forwarding tablePAN-OS · Operational mode (>)
    show routing fib
  • Show the routing table (Advanced Routing Engine)PAN-OS · Operational mode (>)
    show advanced-routing route
  • Find which route and interface an address usesPAN-OS · Operational mode (>)
    test routing fib-lookup virtual-router default ip 198.51.100.10
  • Show the ARP tablePAN-OS · Operational mode (>)
    show arp all

Objects, security rules and NAT #

  • Add an address objectPAN-OS · Configuration mode (#)
    set address web-server-1 ip-netmask 192.168.20.10/32
  • Add an address groupPAN-OS · Configuration mode (#)
    set address-group web-servers static [ web-server-1 ]
  • Add a service (port) objectPAN-OS · Configuration mode (#)
    set service tcp-8443 protocol tcp port 443
  • Add a security rulePAN-OS · Configuration mode (#)
    set rulebase security rules allow-web from trust to untrust source any destination web-server-1 application [ ssl web-browsing ] service application-default action allow
  • Move a rule to the topPAN-OS · Configuration mode (#)
    move rulebase security rules allow-web top
  • Move a rule above another onePAN-OS · Configuration mode (#)
    move rulebase security rules allow-web before deny-all
  • Turn a rule off without deleting itPAN-OS · Configuration mode (#)
    set rulebase security rules allow-web disabled yes
  • Delete a rulePAN-OS · Configuration mode (#)
    delete rulebase security rules allow-web
  • Add source NAT to the outside interface's addressPAN-OS · Configuration mode (#)
    set rulebase nat rules outbound-nat from trust to untrust source any destination any service any source-translation dynamic-ip-and-port interface-address interface ethernet1/1
  • Test which security rule some traffic would matchPAN-OS · Operational mode (>)
    test security-policy-match from trust to untrust source 192.168.20.25 destination 198.51.100.10 destination-port 443 protocol 6
  • Test which NAT rule some traffic would matchPAN-OS · Operational mode (>)
    test nat-policy-match from trust to untrust source 192.168.20.25 destination 198.51.100.10 destination-port 443 protocol 6
  • Show the security rules the firewall is runningPAN-OS · Operational mode (>)
    show running security-policy
  • Show the NAT rules the firewall is runningPAN-OS · Operational mode (>)
    show running nat-policy
  • Show hit counts for every security rulePAN-OS · Operational mode (>)
    show rule-hit-count vsys vsys-name vsys1 rule-base security rules all
  • List security rules that haven't been usedPAN-OS · Operational mode (>)
    show running rule-use rule-base security type unused vsys vsys1

Sessions and counters #

  • Show session table totalsPAN-OS · Operational mode (>)
    show session info
  • List sessions from an addressPAN-OS · Operational mode (>)
    show session all filter source 192.168.20.25
  • List sessions to an address and portPAN-OS · Operational mode (>)
    show session all filter destination 198.51.100.10 destination-port 443
  • Count active sessions on a rulePAN-OS · Operational mode (>)
    show session all filter rule allow-web count yes
  • Show one session in detailPAN-OS · Operational mode (>)
    show session id 12345
  • Clear one sessionPAN-OS · Operational mode (>)
    clear session id 12345
  • Clear every session from an addressPAN-OS · Operational mode (>)
    clear session all filter source 192.168.20.25

    Warning: Cuts those connections straight away.

  • Show why packets are being dropped, since the last runPAN-OS · Operational mode (>)
    show counter global filter delta yes severity drop
  • Show CPU, memory and processes on the management planePAN-OS · Operational mode (>)
    show system resources
  • Show dataplane CPU and buffer usePAN-OS · Operational mode (>)
    show running resource-monitor
  • Show disk spacePAN-OS · Operational mode (>)
    show system disk-space

Packet capture and flow debugging #

  • See the current capture and debug settingsPAN-OS · Operational mode (>)
    debug dataplane packet-diag show setting
  • Clear old capture and debug settings firstPAN-OS · Operational mode (>)
    debug dataplane packet-diag clear all
  • Match traffic from one address to anotherPAN-OS · Operational mode (>)
    debug dataplane packet-diag set filter match source 192.168.20.25 destination 198.51.100.10
  • Match the return traffic tooPAN-OS · Operational mode (>)
    debug dataplane packet-diag set filter match source 198.51.100.10 destination 192.168.20.25
  • Turn the filter onPAN-OS · Operational mode (>)
    debug dataplane packet-diag set filter on

    Warning: Always turn the filter on before a capture or flow debug, or it captures everything.

  • Capture packets as they arrivePAN-OS · Operational mode (>)
    debug dataplane packet-diag set capture stage receive file rx.pcap
  • Capture dropped packetsPAN-OS · Operational mode (>)
    debug dataplane packet-diag set capture stage drop file drop.pcap
  • Start capturingPAN-OS · Operational mode (>)
    debug dataplane packet-diag set capture on
  • Stop capturingPAN-OS · Operational mode (>)
    debug dataplane packet-diag set capture off
  • Read a capture on the CLIPAN-OS · Operational mode (>)
    view-pcap filter-pcap rx.pcap
  • Log how the firewall handles matching packetsPAN-OS · Operational mode (>)
    debug dataplane packet-diag set log feature flow basic
  • Start flow loggingPAN-OS · Operational mode (>)
    debug dataplane packet-diag set log on
  • Stop flow loggingPAN-OS · Operational mode (>)
    debug dataplane packet-diag set log off
  • Capture on the management interfacePAN-OS · Operational mode (>)
    tcpdump filter "host 192.168.20.25 and not port 22"
  • Read the management interface capturePAN-OS · Operational mode (>)
    view-pcap mgmt-pcap mgmt.pcap

Logs #

  • Show the newest traffic logsPAN-OS · Operational mode (>)
    show log traffic direction equal backward
  • Show traffic logs for one rulePAN-OS · Operational mode (>)
    show log traffic rule equal allow-web
  • Show the newest threat logsPAN-OS · Operational mode (>)
    show log threat direction equal backward
  • Show the newest system logsPAN-OS · Operational mode (>)
    show log system direction equal backward
  • Show the newest config change logsPAN-OS · Operational mode (>)
    show log config direction equal backward
  • Follow the management server logPAN-OS · Operational mode (>)
    tail follow yes mp-log ms.log
  • Read the authentication logPAN-OS · Operational mode (>)
    less mp-log authd.log

High availability #

  • Show HA state and the peer's statePAN-OS · Operational mode (>)
    show high-availability state
  • Show all HA detailsPAN-OS · Operational mode (>)
    show high-availability all
  • Check session sync between the pairPAN-OS · Operational mode (>)
    show high-availability state-synchronization
  • Push this firewall's config to the peerPAN-OS · Operational mode (>)
    request high-availability sync-to-remote running-config

    Warning: Overwrites the peer's config.

  • Fail over by suspending this firewallPAN-OS · Operational mode (>)
    request high-availability state suspend

    Warning: Moves traffic to the peer. Run request high-availability state functional to bring it back.

  • Bring a suspended firewall backPAN-OS · Operational mode (>)
    request high-availability state functional

IPsec VPN and GlobalProtect #

  • Show IKE phase 1 SAsPAN-OS · Operational mode (>)
    show vpn ike-sa
  • Show IKE SAs for one gatewayPAN-OS · Operational mode (>)
    show vpn ike-sa gateway branch-gw
  • Show IPsec phase 2 SAsPAN-OS · Operational mode (>)
    show vpn ipsec-sa
  • Show tunnels with packet and byte countersPAN-OS · Operational mode (>)
    show vpn flow
  • Start IKE phase 1 with a gatewayPAN-OS · Operational mode (>)
    test vpn ike-sa gateway branch-gw
  • Start IPsec phase 2 for a tunnelPAN-OS · Operational mode (>)
    test vpn ipsec-sa tunnel branch-tunnel
  • Reset phase 1 with a gatewayPAN-OS · Operational mode (>)
    clear vpn ike-sa gateway branch-gw
  • Reset phase 2 for a tunnelPAN-OS · Operational mode (>)
    clear vpn ipsec-sa tunnel branch-tunnel
  • Read the IKE logPAN-OS · Operational mode (>)
    less mp-log ikemgr.log
  • List users connected to GlobalProtectPAN-OS · Operational mode (>)
    show global-protect-gateway current-user

User-ID #

  • List IP-to-user mappingsPAN-OS · Operational mode (>)
    show user ip-user-mapping all
  • Show the user mapped to one addressPAN-OS · Operational mode (>)
    show user ip-user-mapping ip 192.168.20.25
  • List groups the firewall knowsPAN-OS · Operational mode (>)
    show user group list
  • List members of a groupPAN-OS · Operational mode (>)
    show user group name "cn=it-staff,ou=groups,dc=example,dc=com"
  • Show group mapping statusPAN-OS · Operational mode (>)
    show user group-mapping state all
  • Check the built-in User-ID agent is connectedPAN-OS · Operational mode (>)
    show user server-monitor state all
  • Clear one address's user mappingPAN-OS · Operational mode (>)
    clear user-cache ip 192.168.20.25/32

Software, content and licences #

  • Check for PAN-OS versionsPAN-OS · Operational mode (>)
    request system software check
  • List PAN-OS versions available and downloadedPAN-OS · Operational mode (>)
    request system software info
  • Download a PAN-OS versionPAN-OS · Operational mode (>)
    request system software download version 12.1.4
  • Install a PAN-OS versionPAN-OS · Operational mode (>)
    request system software install version 12.1.4

    Warning: Takes effect after a reboot. On an HA pair, upgrade one firewall at a time.

  • Reboot the firewallPAN-OS · Operational mode (>)
    request restart system

    Warning: Stops all traffic until it's back up.

  • Check for app and threat updatesPAN-OS · Operational mode (>)
    request content upgrade check
  • Download the latest app and threat contentPAN-OS · Operational mode (>)
    request content upgrade download latest
  • Install the latest app and threat contentPAN-OS · Operational mode (>)
    request content upgrade install version latest
  • Download the latest antivirusPAN-OS · Operational mode (>)
    request anti-virus upgrade download latest
  • Fetch licences from Palo Alto NetworksPAN-OS · Operational mode (>)
    request license fetch
  • Show licencesPAN-OS · Operational mode (>)
    request license info

Troubleshooting #

  • Ping from a dataplane interface addressPAN-OS · Operational mode (>)
    ping source 192.168.20.25 host 198.51.100.10
  • Trace the route from a dataplane interface addressPAN-OS · Operational mode (>)
    traceroute source 192.168.20.25 host 198.51.100.10
  • Test an authentication profilePAN-OS · Operational mode (>)
    test authentication authentication-profile ldap-auth username netadmin password
  • Check which URL category a site is inPAN-OS · Operational mode (>)
    test url www.example.com
  • Show an interface's error countersPAN-OS · Operational mode (>)
    show counter interface ethernet1/1
  • Restart the management server processPAN-OS · Operational mode (>)
    debug software restart process management-server

    Warning: Drops admin sessions while it restarts. Traffic keeps flowing.