You are on page 1of 6

CISCO COMMAND REFERENCE

Common Commands
Hostname
R(config)# hostname R1

Console Password
R(config)# line console 0
R(config-line)# password CISCO123
R(config-line)# login

Telnet (VTY) Password


R(config)# line vty 0 4
R(config-line)# password CISCO123
R(config-line)# login

Exec Mode (enable) Password – Encrypted


R(config)# enable secret CISCO321

Disable DNS Lookups


R(config)# no ip domain-lookup

Synchronous Logging
No interrupti ons while typing a command
R(config)# line console 0 (or line vty 0 4)
R(config-line)# logging synchronous

Banner
R(config)# banner motd $Authorized Personnel Only!
You are knowingly violating usage rights by accessing this system
without permission and will be prosecuted to the fullest extent
of the law.$

Router Commands
Subinterfaces (Router on a Stick)
R(config)# int fa0/1
R(config-if)# no shutdown
R(config-if)# int fa0/1.10
R(config-subif)# encapsulation dot1q 10
R(config-subif)# ip address 192.168.10.1 255.255.255.0
R(config-subif)# int fa0/1.20
R(config-subif)# encapsulation dot1q 20
R(config-subif)# ip address 192.168.20.1 255.255.255.0

DHCP Pools
R(config)# ip dhcp pool Subnet10
R(dhcp-config)# default router 192.168.10.1
R(dhcp-config)# network 192.168.10.0 255.255.255.0

Switch Commands
Default Gateway
S(config)# ip default-gateway 1.2.3.4

Creating & Naming a VLAN


S(config)# vlan 99
S(config-vlan)# name Students

Assigning an Address to a VLAN Interface


S(config)# int vlan 99
S(config-if)# ip address 1.2.3.4 255.255.255.0
S(config-if)# no shutdown

Configuring Several Interfaces at Once


S(config)# int range fa0/1 – fa0/24
S(config-if-range)# some command to apply

Port Speed
S(config)# int fa0/1
S(config-if)# speed 10 (10 or 100 or auto)

Port Duplex Mode


S(config)# int fa0/1
S(config-if)# duplex half (half or full or auto)

Access Port
S(config)# int fa0/1
S(config-if)# switchport mode access
S(config-if)# switchport access vlan 99
Trunk Port
S(config)# int fa0/1
S(config-if)# switchport trunk encapsulation dot1q (or isl)
S(config-if)# switchport trunk native vlan 99 (optional)
S(config-if)# switchport mode trunk

VTP Server
S(config)# vtp mode server
S(config)# vtp version 2
S(config)# vtp domain Cisco123
S(config)# vtp password ciscoSECRET

VTP Client
S(config)# vtp version 2
S(config)# vtp mode client
S(config)# vtp domain Cisco123
S(config)# vtp password ciscoSECRET

Port Security
S(config)# int fa0/1
S(config-if)# switchport port-security
S(config-if)# switchport port-security maximum 3
S(config-if)# switchport port-security violation shutdown
S(config-if)# switchport port-security mac-address sticky

Spanning Tree
Switch Priority (Per VLAN)
S1(config)# spanning-tree vlan 1,5,15,25,35 priority 4096

Root Switch
S2(config)# spanning-tree vlan 5 root
S2(config)# spanning-tree vlan 5 root primary

Secondary Root Switch


Backup in case the root fails
S2(config)# spanning-tree vlan 5 root secondary

Port Cost
S2(config)# interface fa0/1
S2(config-if)# spanning-tree cost 20
S2(config-if)# end
Port Priority
S2(config)# interface gig0/1
S2(config-if)# spanning-tree port-priority 64
S2(config-if)# spanning-tree vlan 5 port-priority 64

PortFast
S2(config)# interface fa0/10
S2(config-if)# spanning-tree portfast (access port)
S2(config-if)# spanning-tree portfast trunk (trunk port - DANGEROUS)

Access Control Lists


Access List (Standard)
R(config)# access-list 10 permit 172.16.0.0 0.0.255.255
R(config)# access-list 10 deny host 172.17.0.1

IP Access List (Standard)


R(config)# ip access-list standard 99
R(config-std-nacl)# permit 192.168.10.0
R(config-std-nacl)# permit 192.168.10.0 0.0.0.255

Remark Command
Add a comment to the access-list
R(config)# access-list 10 remark Only Jones has access

To see sequence numbers


Tells you the order of the commands
R# show access-lists
R# show access-lists list name
R# show ip access-list
R# show ip access-list list name

Miscellaneous
Correcting Native VLAN Mismatch
Indicates a misconfi gured trunk port
Go to the Switch & FA that it specifies- Type the following:
S(config-if)# switchport trunk native vlan 30
S(config-if)# switchport mode trunk

When configuring a PC
IP Address – same VLAN, count 1 up.
PC0 is on VLAN 20 (192.168.20.225)
PC3 is on VLAN20 (192.168.20.226)
PC1 is on VLAN 10 (192.168.10.193)
PC4 is on VLAN 10 (192.168.10.194)
Example:
VLAN 10 = Sales = 192.168.10.192/26
VLAN 20 = HR = 192.168.20.224/27
VLAN 30 = MGMT = 192.168.99.0/28

Configuring the Default Gateway (Router) of a PC


Look at what VLAN the PC is on-
If the PC is on VLAN 10 then choose 192.168.10.254

Configuring the Subnet Mask


/20 240 255.255.240.0 /26 192 255.255.255.192
/21 248 255.255.248.0 /27 224 255.255.255.224
/22 252 255.255.252.0 /28 240 255.255.255.240
/23 254 255.255.254.0 /29 248 255.255.255.248
/24 0 255.255.255.0 /30 252 255.255.255.252
/25 128 255.255.255.128

To Backup Your IOS


R# copy run start
R# copy flash: some_file_name TFTP: destination_file_name

Pre IOS
Flash-init
Load_helper
Dir flash:
Rename flash: config.text flash: cat
Dir flash:
Boot

IOS
R# show flash:
R# rename flash: cat flash: config.text
R# copy start run

Password Recovery for 2960 series Switches


Switch: flash_init
Switch: load_helper
Switch: dir flash:
Switch: rename flash: config.text flash: config.old
Switch: boot
Password Recovery on a Router (Cisco 2950)
1. Reboot the device
2. Ctrl, lightly press Pause|Break key
3. Rommon:
4. Rommon: config 0x2142 (changes configuration register to 2142)
5. Rommon: reset
6. No startup config
copy start run
7. config t: config-register 0x2102

The Configuration Register


R# show version
R(config)# config-register 0x2142 (changes configuration register to 2142)

You might also like