Cisco Commands: Difference between revisions
| Line 111: | Line 111: | ||
Set a banner message | Set a banner message | ||
banner motd MESSAGEHERE | banner motd MESSAGEHERE | ||
Set the domain name | |||
ip domain-name cisco.com | |||
Assign a default gateway | Assign a default gateway | ||
Revision as of 20:40, 14 January 2026
Commands for cisco IOS devices (switches, routers, etc)
Enable ipv4 routing
This needs to be manually done sometimes on layer 3 switches
ip routing
Enable ipv6 routing
This needs to be done on routers to enable ipv6 functionality
ipv6 unicast-routing
Show the entire mac address table (Lets you figure out what device is plugged into each switch port)
show mac address-table
Show OS and Device versions
show version
Show logged in users
show users
List files in current directory
dir
List files in nvram
dir nvram:
Copy command destinatons (we use running-config as an example source file)
copy running-config cisco copy destinations
Elevate to root user
enable
Add an encrypted password for the enable command
enable secret ThisisaSecret
Enter global configuration mode (You can use the do prefix to run regular commands from the config mode if you don't feel like running exit first)
configure terminal
Show startup config (the one stored in nvram for next boot)
show startup-config
Show running config (the one stored in ram and is currently in use)
show running-config
Show a specific interface's config in the running configuration.
show run interface g0/0
Filter through the running config (similar to grep on linux)
show run | include {searchterm}
show run | begin {searchterm}
show run | section {section-name}
Copy the in-use config to the startup config so that it will be used on the next boot. There are two ways to shorten it below
copy running-config startup-config copy run start wr
Apply weak encryption to all unencrypted passwords. This only changes what is displayed in the config file, any password typed through a network cable is still transmitted in plain text.
service password-encryption
Show IPv4 IP Address assigned to each interface
show ip interface brief
Show IPv6 IP Address assigned to each interface
show ipv6 interface brief
Show all routes
show ip route
Show vlans and interfaces assigned to them
show vlan brief
Show VLAN and related information about an interface
show interface g0/1 switchport
Show trunk interfaces
show int trunk
Clear mac address table (switches only)
clear mac address-table
Clear arp cache
clear arp-cache
Telnet/Remote Access Commands
Remote into a connected device using telnet
connect {Device Name}
Show a list of hosts to connect to
show hosts
Show all connected telnet sessions
show sessions
Disconnect a telnet session
disconnect {Device Name}
Suspend the active telnet connection (Keyboard Shortcut)
Ctrl+Shift+6 -> x
Global configuration commands
Disable default behavior of looking up unknown names/commands in DNS
no ip domain-lookup
Set a banner message
banner motd MESSAGEHERE
Set the domain name
ip domain-name cisco.com
Assign a default gateway
ip default-gateway 192.168.10.1
Change the machine's hostname (does not require a reboot)
hostname
Configure the console port (0)
line con 0
Configure vty interfaces 0 through 15
line vty 0 15
Configure the interface "vlan 1"
interface vlan 1
Configure the interface "fa0/1"
interface fa0/1
Configure the range of interfaces fa0/2 to fa0/3
interface range fa0/2-3
Enter vlan configuration mode
vlan 1
Vlan Configuration Commands
Set vlan name
name MyAwesomeVlan
Console or VTY line configuration commands
Add a password to console port access
password itsasecret
Force users to enter the password to login
login
Interface configuration commands
Set the interface to a specific vlan (Alt)
encapsulation dot1q 10
Set the interface to a specific vlan
switchport mode access ! disable trunking, default is switchport mode auto switchport access vlan 10
Set an interface to trunk mode
switchport trunk encapsulation dot1q ! switches off the legacy cisco trunking protocol, not needed on newer switches switchport mode trunk
Change allowed vlans on trunk interface
switchport trunk allowed vlan 10,20,33,99
Set native vlan on a trunk interface
switchport trunk native vlan 99
Set an IPv4 address on the interface
ip address 192.168.0.1 255.255.255.0
Change interface state to "up"
no shutdown
Ipv6 Interface Commands
Set an IPv6 address on the interface
ipv6 address 2001:DB8:CAFE:1::1/64
Set a link-local address on the interface
ipv6 addr fe80::1 link-local
Remove an IPv6 address on the interface
no ipv6 address 2001:DB8:CAFE:1::1/64
Remove all IPv6 addresses on the interface
no ipv6 address