CLI reference

All 103 commands the simulator understands, generated from the simulator itself. Routers, switches and firewalls open the network console; Linux gateways, servers and PCs open a Linux shell.

Working the console

  • Ask with ? — on its own it lists what this mode accepts; after a word it lists what can come next; glued to a word (sh?) it completes it.
  • Abbreviate freely — any unique prefix works: sh ip int br, conf t, int g0/1. Tab completes.
  • Read the errors — a ^ marks the word that went wrong, and unknown words get a did-you-mean.
  • Ports follow the device — consoles name ports like GigabitEthernet0/1 (Gi0/1); Linux hosts use eth0. Switching commands work only on switches.

In the syntax below, <value> is yours to fill in, [ ] is optional and a|b means one of the choices.

Network console

Routers, switches and firewalls. Modes nest: each section says how you get there, and exit or end takes you back out.

User mode

rtr>

Where every session starts: look, test and trace, but change nothing.

  • enable

    Also: en

    Enter privileged mode.
  • exit
    Leave the current mode.Works from any mode.
  • show ip ospf
    Summarise the OSPF process: router ID, areas, adjacencies.Works from any mode.
  • show ip ospf neighbor

    Also: sh ip ospf nei

    List OSPF neighbours and adjacency state.Works from any mode.
  • show ip ospf interface [<interface>]
    Show which interfaces run OSPF, their area, cost and hello mode.Works from any mode.
  • show ip bgp
    Display the BGP table: every path per prefix, with the selected one marked.Works from any mode.
  • show ip bgp summary

    Also: sh ip b s

    One line per BGP neighbour: AS, session state, prefixes received.Works from any mode.
  • show ip bgp neighbors
    Per-neighbour detail, including why a session is not established.Works from any mode.
  • show access-lists [<list>]

    Also: show ip access-lists

    Display access lists, their entries and where each is applied.Works from any mode.
  • show ip nat translations

    Also: sh ip nat tr

    List active address translations: which inside host is sharing which outside port.Works from any mode.
  • show ip dhcp binding

    Also: sh ip dhcp bin

    List the addresses this device's DHCP pools have leased, and to whom.Works from any mode.
  • ip addr show [dev <interface>]

    Also: ip a, ip addr

    Display interface addresses and counters.Also works in: Privileged mode.
  • ip link show
    Display link-layer state for all interfaces.Also works in: Privileged mode.
  • ip route show

    Also: ip r

    Display the forwarding table in iproute2 format.Also works in: Privileged mode.
  • show interfaces [<interface>]

    Also: sh int

    Summarise interface administrative state, link state and addressing.Works from any mode.
  • show vlan brief

    Also: sh vl br

    List VLANs and the access ports assigned to each.Works from any mode.
  • show interfaces [<interface>] switchport
    Show mode, access VLAN and trunk settings of every switchport (or one).Works from any mode.
  • show interfaces [<interface>] trunk
    Show trunk ports, their native VLAN and allowed VLANs (all, or one port).Works from any mode.
  • show ip route

    Also: sh ip ro

    Display the forwarding table with route source codes.Works from any mode.
  • show route

    Also: sh ro

    Shortcut for show ip route.Works from any mode.
  • show version
    Display operating system version and uptime.Works from any mode.
  • show ip interface brief

    Also: sh ip int br

    One line per interface: IPv4 address, admin and link state.Works from any mode.
  • show ip arp

    Also: show arp

    List IPv4-to-MAC bindings learned on each routed interface.Works from any mode.
  • show mac address-table
    List the MAC addresses learned on each switchport, per VLAN.Works from any mode.
  • ping [-c <count>] [-s <size>] <destination>
    Send ICMP echo requests to a destination; -s sets the payload size in bytes (default 56).Also works in: Privileged mode.
  • traceroute <destination>
    Trace the hop-by-hop path to a destination.Also works in: Privileged mode.
  • show logging

    Also: sh log

    Display the device log buffer.Works from any mode.
  • hostname
    Print the device hostname.Also works in: Privileged mode.
  • ?

    Also: help

    List the commands available from the current mode.Works from any mode.

Privileged mode

rtr#

Reached with enable. Full visibility, saving the configuration, and iproute2-style quick changes.

  • disable
    Return to unprivileged user mode.
  • configure terminal

    Also: conf t

    Enter global configuration mode.
  • ip addr add <address>/<prefix> dev <interface>

    Also: ip address add, ip a add

    Add an address to a port (iproute2 syntax, e.g. dev Gi0/0).
  • ip addr del <address>/<prefix> dev <interface>
    Remove an address from an interface.
  • ip link set <interface> up|down
    Change the administrative state of a port (e.g. Gi0/0).
  • ip route add <network>/<prefix>|default via <next-hop> [dev <interface>]
    Install a static route.
  • ip route del <network>/<prefix>|default
    Remove a static route.
  • show running-config
    Display the active configuration.Also works in: Global configuration, Interface configuration, VLAN configuration, Routing-protocol configuration, Access-list configuration, DHCP pool configuration.
  • show startup-config
    Display the configuration the device loads at boot.Also works in: Global configuration, Interface configuration, VLAN configuration, Routing-protocol configuration, Access-list configuration, DHCP pool configuration.
  • copy running-config startup-config

    Also: copy run start

    Save the active configuration so it survives a reload.
  • write memory

    Also: wr

    Save the active configuration (same as copy running-config startup-config).

Global configuration

rtr(config)#

Reached with configure terminal. Device-wide settings, routing processes, access lists and services.

  • interface <interface>
    Select a port (e.g. Gi0/0) and enter interface configuration mode.Also works in: Interface configuration, VLAN configuration, Routing-protocol configuration, Access-list configuration, DHCP pool configuration.
  • end
    Return directly to privileged mode from any configuration mode.Also works in: Interface configuration, VLAN configuration, Routing-protocol configuration, Access-list configuration, DHCP pool configuration.
  • hostname <name>
    Set the device hostname.
  • ip route <network>/<prefix> via <next-hop>
    Install a static route toward a next-hop address.
  • vlan <1-4094> [name <name>]
    Create a VLAN and enter VLAN configuration mode (or name it in one line).Also works in: VLAN configuration.
  • no vlan <2-4094>
    Delete a VLAN from the VLAN database.
  • no ip route <network>/<prefix>
    Remove a static route.
  • spanning-tree mode stp|rstp|mstp
    Select the spanning-tree protocol (IEEE 802.1D, 802.1w or 802.1s).
  • spanning-tree vlan <vlan-list> priority <0-61440>
    Set the bridge priority for VLANs; lower wins the root election.
  • ip routing
    Enable IPv4 forwarding between interfaces.
  • no ip routing
    Disable IPv4 forwarding — the device stops routing transit traffic.
  • ip route <network> <mask> <next-hop>|<exit-interface>
    Install a static route toward a next hop or straight out of an interface.
  • no ip route <network> <mask> [<next-hop>|<exit-interface>]
    Remove static routes for a prefix (all of them, or the one via a given next hop).
  • router ospf <1-65535>
    Start (or edit) an OSPF process and enter routing-protocol configuration.Also works in: Routing-protocol configuration.
  • no router ospf <1-65535>
    Stop the OSPF process and discard its configuration.
  • router bgp <1-4294967295>
    Start (or edit) BGP for an autonomous system and enter routing-protocol configuration.Also works in: Routing-protocol configuration.
  • no router bgp <1-4294967295>
    Stop BGP and discard its configuration.
  • access-list <1-99> permit|deny <source> [<wildcard>]
    Append a source-only entry to a numbered standard access list.
  • access-list <100-199> permit|deny <protocol> <source> <destination> [eq <port>]
    Append a protocol/source/destination entry to a numbered extended access list.
  • no access-list <1-199>
    Delete a numbered access list and every entry in it.
  • ip access-list standard|extended <name>
    Create or edit a named access list and enter access-list configuration mode.Also works in: Access-list configuration.
  • no ip access-list standard|extended <name>
    Delete a named access list.
  • ip nat inside source list <list> interface <interface> overload
    Let inside hosts matched by an access list share the outside interface's address (port overload).
  • no ip nat inside source list <list> [interface <interface> overload]
    Stop translating the hosts an access list matches.
  • ip dhcp pool <name>
    Create or edit a DHCP address pool and enter DHCP pool configuration mode.Also works in: DHCP pool configuration.
  • no ip dhcp pool <name>
    Delete a DHCP pool. Addresses already leased stay with their clients until they expire.

Interface configuration

rtr(config-if)#

Reached with interface <name>. Addressing, port state, switchport, filtering and NAT roles.

  • ip address <address>/<prefix>
    Assign an IPv4 address to the selected interface.
  • no ip address [<address>/<prefix>|<address> <mask>]
    Remove one IPv4 address, or every address, from the selected interface.
  • description <text>
    Label the selected interface.
  • mtu <68-9216>
    Set the interface MTU.
  • switchport mode access|trunk
    Set the selected port to access or trunk mode.
  • switchport access vlan <1-4094>
    Assign the selected access port to a VLAN.
  • switchport trunk allowed vlan [add|remove|except] <list>|all|none
    Set, extend or trim the VLANs a trunk carries, e.g. 10,20,30-35.
  • switchport trunk native vlan <1-4094>
    Set the untagged VLAN on the selected trunk.
  • shutdown
    Administratively disable the selected interface.
  • no shutdown
    Administratively enable the selected interface.
  • no description
    Remove the label from the selected interface.
  • encapsulation dot1q <1-4094>
    Tag the selected subinterface's traffic with an 802.1Q VLAN id.
  • ip access-group <list> in|out
    Filter traffic entering or leaving the selected interface with an access list.
  • no ip access-group [<list>] in|out
    Stop filtering one direction of the selected interface.
  • ip nat inside|outside
    Mark the selected interface as facing the private (inside) or public (outside) side of NAT.
  • no ip nat inside|outside
    Take the selected interface out of address translation.

VLAN configuration

rtr(config-vlan)#

Reached with vlan <id>.

  • name <vlan-name>
    Name the VLAN being configured.

Routing-protocol configuration

rtr(config-router)#

Reached with router ospf <id> or router bgp <asn>.

  • router-id <a.b.c.d>
    Fix this router's OSPF router ID instead of deriving it from an address.
  • no router-id
    Go back to deriving the OSPF router ID from interface addresses.
  • network <address> <wildcard> area <area-id>
    Enable OSPF on interfaces whose address matches, placing them in an area.
  • no network <address> <wildcard> area <area-id>
    Remove an OSPF network statement.
  • passive-interface <interface>
    Advertise an interface's subnet but never form adjacencies on it.
  • no passive-interface <interface>
    Resume sending hellos on an interface.
  • neighbor <address> remote-as <1-4294967295>
    Define a BGP peer and the AS it belongs to.
  • no neighbor <address>
    Remove a BGP peer.
  • network <address> mask <mask>
    Originate a prefix into BGP (advertised only while it is in the routing table).
  • no network <address> mask <mask>
    Stop originating a prefix into BGP.

Access-list configuration

rtr(config-acl)#

Reached with ip access-list standard|extended <name>.

  • permit|deny <source> [<wildcard>]
    Append an entry to the standard list being edited.
  • permit|deny <protocol> <source> <destination> [eq <port>]
    Append an entry to the extended list being edited.
  • no <sequence>
    Delete one entry, by its sequence number, from the list being edited.

DHCP pool configuration

rtr(config-dhcp)#

Reached with ip dhcp pool <name>.

  • network <address> <mask>
    Set the subnet this pool hands addresses out of.
  • no network
    Clear the pool's subnet; it stops answering clients.
  • default-router <address>
    Set the gateway address clients of this pool are told to use.
  • no default-router
    Stop offering a gateway to this pool's clients.

Linux shell

admin@host:~$

Linux gateways, servers and PCs. iproute2 for addresses, links and routes, plus the everyday diagnostic tools. Read-only hosts let you look but refuse changes, as a real unprivileged account would.

  • dhclient [<interface>]
    Ask the local segment's DHCP server for an address, gateway and lease.
  • ip addr add <address>/<prefix> dev <interface>

    Also: ip address add, ip a add

    Add an address to a port (iproute2 syntax, e.g. dev eth0).Also works in: Privileged mode.
  • ip addr del <address>/<prefix> dev <interface>
    Remove an address from an interface.Also works in: Privileged mode.
  • ip link set <interface> up|down
    Change the administrative state of a port (e.g. eth0).Also works in: Privileged mode.
  • ip route add <network>/<prefix>|default via <next-hop> [dev <interface>]
    Install a static route.Also works in: Privileged mode.
  • ip route del <network>/<prefix>|default
    Remove a static route.Also works in: Privileged mode.
  • ip addr show [dev <interface>]

    Also: ip a, ip addr

    Display interface addresses and counters.Also works in: User mode, Privileged mode.
  • ip link show
    Display link-layer state for all interfaces.Also works in: User mode, Privileged mode.
  • ip route show

    Also: ip r

    Display the forwarding table in iproute2 format.Also works in: User mode, Privileged mode.
  • ping [-c <count>] [-s <size>] <destination>
    Send ICMP echo requests to a destination; -s sets the payload size in bytes (default 56).Also works in: User mode, Privileged mode.
  • traceroute <destination>
    Trace the hop-by-hop path to a destination.Also works in: User mode, Privileged mode.
  • dmesg
    Print the kernel and system log.
  • ipcalc <address>/<prefix>
    Calculate network, broadcast and host range for an address.
  • hostname
    Print the device hostname.Also works in: User mode, Privileged mode.
  • ?

    Also: help

    List the commands available from the current mode.Also works in: User mode, Privileged mode, Global configuration, Interface configuration, VLAN configuration, Routing-protocol configuration, Access-list configuration, DHCP pool configuration.

Something missing or behaving oddly? Use Feedback / Report bug in any workspace, or try it on a live incident.