Password recovery and Factory Default on Cisco switch 2960 and 3560

Attach a terminal to the console port of the switch.
Use the following 
Unplug the power cable from the Switch.
Power the switch and bring it to the switch: prompt:
For 2900XL, 3500XL, 2940, 2950, 2960, 2970, 3550, 3560, and 3750 series switches, do this:
Hold down the mode button located on the left side of the front panel, while you reconnect the power cable to the switch.


2960, 2970
Release the Mode button when the SYST LED blinks amber and then turns solid green. When you release the Mode button, the SYST LED blinks green.

3560, 3750
Release the Mode button after approximately 15 seconds when the SYST LED turns solid green. When you release the Mode button, the SYST LED blinks green.
The system has been interrupted prior to initializing the flash file system to finish
loading the operating system software:
flash_init
load_helper
boot
switch:
Issue the flash_init command.
switch: flash_init Initializing Flash

Issue the load_helper command.
switch: load_helper switch:


Issue the dir flash: command.
Note: Make sure to type a colon ":" after the dir flash.
The switch file system is displayed:
switch: dir flash:


Type rename flash:config.text flash:config.old to rename the configuration file.
switch: rename flash:config.text flash:config.old


Issue the boot command to boot the system.
switch: boot
Enter "n" at the prompt to abort the initial configuration dialog.


At the switch prompt, type en to enter enable mode.
Switch>en Switch#

For password recovery

Type
 rename flash:config.old flash:config.text to rename the configuration file with its original name.
Switch#rename flash:config.old flash:config.text Destination filename [config.text]


Copy the configuration file into memory.
Switch#copy flash:config.text system:running-config Destination filename [running-config]?
The configuration file is now reloaded
Overwrite the current passwords that you do not know. Choose a strong password with at least one capital letter, one number, and one special character.
Note: Overwrite the passwords which are necessary. You need not overwrite all of the mentioned passwords.
Sw1# conf t !--- To overwrite existing secret password Sw1(config)#enable secret  !--- To overwrite existing enable password Sw1(config)#enable password  !--- To overwrite existing vty password Sw1(config)#line vty 0 15 Sw1(config-line)#password  Sw1(config-line)#login !--- To overwrite existing console password Sw1(config-line)#line con 0 Sw1(config-line)#password


·          
Write the running configuration to the configuration file with the write memory command.
Sw1#write memory Building configuration... [OK] Sw1#


For Factory reset:
don’t give below command for factory reset
Switch#copy flash:config.text system:running-config
do copy running config to flash,
Switch#copy running-config flash:
Destination filename [running-config]?
Building configuration...

Switch#copy running-config startup-config
Destination filename [startup-config]?
Building configuration...



DHCP Server on Cisco 2960 Switches

ip dhcp excluded-address 172.17.0.1 172.17.0.50
ip dhcp pool 172.17.0.0/21
network 172.17.0.0 255.255.248.0
default-router 172.17.0.1 (yours)
dns-server 213.42.20.20 195.229.241.222 8.8.8.8
lease 4
ip dhcp snooping
ip dhcp-server 172.17.0.2
interface vlan 1
ip address 172.17.0.2

CONFIGURE PPPOE CONNECTION ON CISCO ROUTER 1841

Cisco 1841- erase everything on the router’s configuration and start from scratch.

router# configure terminal
router(config)# config-register 0x2102
router(config)# end
router#

router#write erase
router#reload

System configuration has been modified. Save? [yes/no]: n
Proceed with reload? [confirm]


Would you like to enter the initial configuration dialog? [yes/no]: n
Show the running config
Router#show run


Copy and Paste the following configuration into your router

no parser cache
no service pad
service timestamps debug uptime
service timestamps log uptime
service password-encryption
!
hostname cisco
!
boot-start-marker
boot-end-marker
!
!
mmi polling-interval 60
no mmi auto-configure
no mmi pvc
mmi snmp-timeout 180
no aaa new-model
ip subnet-zero
ip cef
!
!
ip dhcp excluded-address 172.17.0.1 172.17.0.50
!
ip dhcp pool 172.17.0.0/21
network 172.17.0.0 255.255.248.0
default-router 172.17.0.1
dns-server 213.42.20.20 195.229.241.222 8.8.8.8


Note:- 
  • If the DHCP Server is on different switch or firewall, remove the above-      given DHCP pool commands.
  • f0/1 IP address and access list, be same as that DHCP Server.
  • Don't forget to give this f0/1 IP Address as default router address on that DHCP Server.



!
!
no ip domain lookup
vpdn enable
!
vpdn-group 1
request-dialin
protocol pppoe
!
no ftp-server write-enable
!
interface FastEthernet0/0
description Physical_Internet_Interface
no ip address
no ip mroute-cache
duplex auto
speed auto
pppoe enable
pppoe-client dial-pool-number 1
no cdp enable
!
interface FastEthernet0/1
description Internal_LAN_Interface
ip address 172.17.0.1 255.255.248.0
ip nat inside
no ip mroute-cache
duplex auto
speed auto
no cdp enable
!
interface Dialer1
description Logical_Internet_Interface
ip address negotiated
ip mtu 1492
ip nat outside
encapsulation ppp
ip tcp adjust-mss 1452
no ip mroute-cache
dialer pool 1
dialer-group 1
no cdp enable
ppp authentication pap callin
ppp pap sent-username xxxxxxxx password xxxxxxxx
ppp ipcp dns request
ppp ipcp route default
ppp ipcp address accept
!
ip classless
!
!
no ip http server
no ip http secure-server
ip nat inside source list 10 interface Dialer1 overload
!
access-list 10 permit 172.17.0.0 0.0.7.255
dialer-list 1 protocol ip permit
no cdp run
!
!
control-plane
!
line con 0
exec-timeout 120 0
stopbits 1
line aux 0
line vty 0 4
exec-timeout 0 0
login local
length 0
!
scheduler max-task-time 5000
---------------------------------------------

Don't forget no shutdown command on interface f0/0 and f0/1

interface fastEthernet 0/0
no shut
interface fastEthernet 0/1
no shut
exit

Save the configuration after the test.

write memory