Cisco Cheat Sheet

My handy-dandy notes for configuring Cisco Switches through the IOS software. These are mainly for my reference but if you find them useful, or can make them more useful, please comment.

Password Recovery Quick-Links

  • Cisco 2900XL Series switches – tried this on a 2912XL, and instructions didn’t quite work. In flash: there is file named word, that needs to be either renamed or deleted as well for the password recovery to work. Also I used no enable secret and no enable password as well. This didn’t apply to the 2950XL switches.

Adding an IP address to a switch

  • type enable to enter privilege mode
  • type config terminal
  • type interface vlan 1
  • type ip address 192.168.1.4 255.255.255.0
  • type no shutdown – required to activate the management address
  • type exit
  • type ip default-gateway 192.168.1.1

Removing an IP address from a switch

  • type enable to enter privilege mode
  • type config terminal
  • type interface vlan 1
  • type no ip address

Configuring Interfaces and ports

  • type enable to enter privilege mode
  • type config terminal
  • type interface fastethernet0/{port #} – the port # is essential or else an “Incomplete Command” will result
  • type duplex auto – auto-detect full duplex/half duplex
  • type speed auto – auto detect 10/100/1000 speeds
  • type spanning-tree portfast – speeds up (a lot) the time it takes for the port to get to forwarding mode. Note: use only if a server/work station is connected to this port, cause it could prevent the Spanning-Tree protocol from detecting and disabling loops in the network.

Configuring Multiple ports at the same time

Turns out there is no way to specify a range of IP addresses for my old IOS switches. However a quick shell script can quickly generate commands for me to copy/paste into the terminal.

 

> i=1;while [ $i -lt 25 ]; do echo "int fast0/$i"; echo speed auto; echo duplex auto; echo span portfast; let i+=1; done;

From: http://www.knowledgenet.com/em/kn/cisco/2002/news1202/index2.html

Can I set the speed and duplex on all Catalyst switch ports simultaneously or do I need to configure each port individually? – Cris Rodriguez, Technician

This depends upon the switch platform that you are referring to. If you are working with a Cisco switch that runs the Cat OS, then you can. You can both configure ports that are sequential and not sequential all at the same time. Here are some examples to do this.

 

set port duplex 2/1-20, 2/22 full
set port speed 2/2-12, 2/15-16 100

If you are working with a Cisco switch that runs the IOS, then you must be a little creative. You do not have the same CLI options to configure multiple ports simultaneously with a Cisco switch running the IOS. You do have several options though. The easiest way to do this type of configuration is to create a text file, for example in VI or notepad. After creating the statements in your text editor, simply copy and paste the lines into the CLI. Here is an example of the text that can be copied into the CLI.

 

configure terminal
interface fastethernet 1/1
speed 100
duplex full
interface fastethernet 1/2
speed 100
duplex full
interface fastethernet 1/3
speed 100
duplex full
...............text omitted
end
! To return to privileged mode

show running-config
! To verify your configuration

Newer IOS based switches allow multiple ports to be configured at the same time. The interface range command runs on all platforms that support Cisco IOS Release 12.0(7)XE, Release 12.1 E, and Release 12.1(5)T. In interface range configuration mode, you can configure multiple interfaces with the same configuration parameters. Once you enter the interface-range configuration mode, all command parameters you enter are attributed to all interfaces within that range until you exit out of the interface-range configuration mode. Following is an example of using the command. Please note that the space before the dash is required.

 

router(config)# interface range fastethernet 5/1 - 5, gigabitethernet 1/1 - 2
router(config-if)# speed 100
router(config-if)# duplex full
router(config-if)# no shutdown

You can also use SNMP and the switch GUI to complete this configuration. Though I believe the easier path is to create a text file.

Assign ports to a VLAN on 2900 switches

  • From Cisco Documentation
    • configure terminal
    • interface {name}
    • switchport mode access
    • switchport access vlan {num}
    • end
    • show running-config

Setting a telnet password

Enabling SNMP

  • enable privilege mode
  • config terminal
  • snmp-server community {password} RO – sets a community string with Read Only privilege.
  • … or no snmp-server community {password} – removes a community string.

Finding MAC Address discovered per port

  • On a Cisco WS-X2948
  • show cam dynamic

Saving Configuration on 2948 Port Switch

 

  • copy config flash
  • Should ask if flashdevice is bootflash, hit Enter
  • Ask if name to copy to is: myswitch.cfg, Enter Y
  • set boot auto-config bootflash:myswitch.cfg
    • There may be warnings like: nvram configuration may be lost during next bootup, and re-configured using the file(s) specified. These can be ignored.

{ 2 trackbacks }

how to set cisco 2948 telnet password
June 22, 2008 at 9:15 pm
My Cisco Cheat Sheet | Tech Blog of RR
April 21, 2010 at 12:52 pm

{ 6 comments… read them below or add one }

1 Nacanieli May 29, 2007 at 1:15 am

thanks for the information

Reply

2 Emison July 23, 2007 at 1:48 am

great stuff, and lots of appreciation

Reply

3 Dwayne January 24, 2008 at 2:34 pm

Thank you Thank you thank you thank you!

Reply

4 B Moore October 25, 2009 at 8:09 pm

Telnet passwords.

Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#line vty 0 4
(this chooses all lines 1-4, you can specify exactly which ones you want)
Router(config-line)#login
% Login disabled on line 66, until ‘password’ is set
% Login disabled on line 67, until ‘password’ is set
% Login disabled on line 68, until ‘password’ is set
% Login disabled on line 69, until ‘password’ is set
% Login disabled on line 70, until ‘password’ is set
Router(config-line)#password cisco
Router(config-line)#service password-encryption
Router(config)#

Reply

5 daniel May 1, 2010 at 1:03 am

kind’a kool.

Reply

6 shoaib August 13, 2010 at 2:33 am

is there any feature in cisco 2950 24 ports
binding mac to ip
set reset every port
mac sticky feature

Reply

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>