Cisco L2, L3 스위치 패스워드 리커버리 및 공장초기화

IT
작성자
Ethan
작성일
2023-05-26 22:31
조회
150

---- 시스코스위치 패스워드 리커버리, 공장초기화방법 ----

: 스위치의 로그인계정 패스워드나 enable패스워드를 잊어버릴때가 있습니다. ㅠㅜ
패스워드 초기화하는 과정입니다.
 
1. 스위치콘솔로 접속합니다.
2. 장비를 전원off 합니다.
3. 앞쪽 MODE 버튼을 누른체로 켭니다.

아래화면이 나올때까지 계속 누르고 있습니다.

Using driver version 1 for media type 1
Base ethernet MAC Address: 54:78:1a:9e
Xmodem file system is available.

The password-recovery mechanism is enabled.

The system has been interrupted prior to initializing the
flash filesystem.  The following commands will initialize
the flash filesystem, and finish loading the operating
system software:

flash_init
boot

switch:

4. flash를 초기화 시킵니다.

switch: flash_init    <-- 명령어실행
Initializing Flash...
mifs[2]: 0 files, 1 directories
mifs[2]: Total bytes     :    3870720
mifs[2]: Bytes used      :       1024
mifs[2]: Bytes available :    3869696
mifs[2]: mifs fsck took 0 seconds.
mifs[3]: 544 files, 19 directories
mifs[3]: Total bytes     :   27998208
mifs[3]: Bytes used      :   12161024
mifs[3]: Bytes available :   15837184
mifs[3]: mifs fsck took 8 seconds.
...done Initializing Flash.


switch: ?    <-- 물음표를 치면 여러명령어가 보임
? -- Present list of available commands
boot -- Load and boot an executable image
cat -- Concatenate (type) file(s)
copy -- Copy a file
delete -- Delete file(s)
dir -- List files in directories
flash_init -- Initialize flash filesystem(s)
format -- Format a filesystem
fsck -- Check filesystem consistency
help -- Present list of available commands
memory -- Present memory heap utilization information
mkdir -- Create dir(s)
more -- Concatenate (display) file(s)
rename -- Rename a file
reset -- Reset the system
rmdir -- Delete empty dir(s)
set -- Set or display environment variables
set_bs -- Set attributes on a boot sector filesystem
set_param -- Set system parameters in flash
sleep -- Pause (sleep) for a specified number of seconds
type -- Concatenate (type) file(s)
-- MORE --
unset -- Unset one or more environment variables
version -- Display boot loader version

5. config파일을 확인해봅니다.
 
switch: dir flash:
Directory of flash:/

2  -rwx  1400      <date>               config.text.renamed
3  -rwx  616       <date>               vlan.dat
4  -rwx  3066      <date>               config.text
5  drwx  512       <date>               c2960-lanlitek9-mz.122-55.SE5
561  -rwx  5         <date>               private-config.text.renamed
562  -rwx  3096      <date>               multiple-fs
563  -rwx  1920      <date>               private-config.text

6. config파일을 임시로 변경하고 다시 확인해봅니다.

switch: rename flash:config.text flash:config.backup
 
switch: dir flash:
Directory of flash:/

2  -rwx  1400      <date>               config.text.renamed
3  -rwx  616       <date>               vlan.dat
4  -rwx  3066      <date>               config.backup    <-- 변경됨
5  drwx  512       <date>               c2960-lanlitek9-mz.122-55.SE5
561  -rwx  5         <date>               private-config.text.renamed
562  -rwx  3096      <date>               multiple-fs
563  -rwx  1920      <date>               private-config.text

7.  리부팅시켜 패스워드를 초기화 시킵니다.

switch: boot
Loading "flash:/c2960-lanlitek9-mz.122-55.SE5/c2960-lanlitek9-mz.122-55.SE5.bin"...@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@~
 
8. enable모드로 들어가서 파일명을 다시 원상복구합니다.
 
Would you like to enter the initial configuration dialog? [yes/no]: no
Switch>en
Switch#
Switch#show flash

Directory of flash:/

2  -rwx        1400   Mar 1 1993 00:03:57 +00:00  config.text.renamed
3  -rwx         616   Dec 1 1993 10:08:30 +00:00  vlan.dat
563  -rwx        1048   Mar 1 1993 00:01:03 +00:00  multiple-fs
4  -rwx        3066   Dec 1 1993 10:23:24 +00:00  config.backup
5  drwx         512   Mar 1 1993 00:11:16 +00:00  c2960-lanlitek9-mz.122-55.SE5
561  -rwx           5   Mar 1 1993 00:03:57 +00:00  private-config.text.renamed

27998208 bytes total (15842304 bytes free)

Switch#rename flash:config.backup flash:config.text   <-- 다시 config파일명을 원상복구
Destination filename [config.text]?    <-- 여기선 그냥 엔터누름
Switch#show flash

Directory of flash:/

2  -rwx        1400   Mar 1 1993 00:03:57 +00:00  config.text.renamed
3  -rwx         616   Dec 1 1993 10:08:30 +00:00  vlan.dat
563  -rwx        1048   Mar 1 1993 00:01:03 +00:00  multiple-fs
4  -rwx        3066   Dec 1 1993 10:23:24 +00:00  config.text   <-- 이전이름으로 원상복구됨
5  drwx         512   Mar 1 1993 00:11:16 +00:00  c2960-lanlitek9-mz.122-55.SE5
561  -rwx           5   Mar 1 1993 00:03:57 +00:00  private-config.text.renamed

9. flash설정을 다시 running-config로 복사합니다.

Switch#copy flash:config.text system:running-config
Destination filename [running-config]?
% Generating 1024 bit RSA keys, keys will be non-exportable...[OK]

10. 새로운 enable패스워드나 user패스워드를 변경하고 저장합니다.

​     저장후 리부팅한 후 정상적으로 붙는지 테스트해보면 끝.

Switch1#conf t
Switch1(config)#enable secret 12345
Switch1#wr 

@ config설정까지 공장초기화 하고싶으면 아래 명령어 후 리부팅합니다.

Switch1#erase startup-config
Erasing the nvram filesystem will remove all configuration files! Continue? [confirm]
[OK]
Erase of nvram: complete
Switch1#  reload
Proceed with reload? [confirm]

 
출처 : 나전노:) 나으전산관리노하우 님 blog
시스코스위치 패스워드리커버리 및 공장초기화방법 : 네이버 블로그 (naver.com)



witch>enable
switch# show running-config //config 설정 확인 -> 필요 config 백업
switch# erase startup-config //초기 설정파일 삭제
Erasing the nvram filesystem will remove all configuration files! Continue?[confirm] // Enter로 진행
[OK]
Erase of nvram : complete
switch# write erase //config 설정 초기화
Erasing the nvram filesystem will remove all configuration files! Continue?[confirm] // Enter로 진행
[OK]
Erase of nvram : complete
switch# reload //장비 명령어 재부팅
System configuration has been modified. Save?[yes/no] : no
Proceed with reload? [confirm] // Enter로 진행
Continue with configuration dialog? [yes/no] : no

VLAN 정보를 제외한 후 스위치 설정 초기화


출처: 프리윙즈 님 blog
https://freewings.tistory.com/3

 

전체 69
번호 제목 작성자 작성일 추천 조회
69
linux/ history 조회 시 날짜 시간 표시하기
Ethan | 2024.03.20 | 추천 0 | 조회 48
Ethan 2024.03.20 0 48
68
geoip 국가 코드 (geoip country code)
Ethan | 2024.03.20 | 추천 0 | 조회 32
Ethan 2024.03.20 0 32
67
linux/CentOS7 -> Rocky8,9 네트워크 설정 변경 내용
Ethan | 2024.03.16 | 추천 0 | 조회 46
Ethan 2024.03.16 0 46
66
linux/SSH - ssh no matching key exchange method found 에러 원인과 해결 방법
Ethan | 2024.03.11 | 추천 0 | 조회 232
Ethan 2024.03.11 0 232
65
linux/rocky8 네트워크 설정하기
Ethan | 2024.03.01 | 추천 0 | 조회 61
Ethan 2024.03.01 0 61
64
linux/rocky 남은 용량 확인 명령어
Ethan | 2024.02.23 | 추천 0 | 조회 85
Ethan 2024.02.23 0 85
63
linux/rocky8 SSH접속 허용하기
Ethan | 2024.02.23 | 추천 0 | 조회 119
Ethan 2024.02.23 0 119
62
linux/CentOS 폴더 찾기, 파일 찾기, 문자열 찾기
Ethan | 2024.01.16 | 추천 0 | 조회 83
Ethan 2024.01.16 0 83
61
AXGATE 네트워크 방화벽 기본 명령어
Ethan | 2023.10.11 | 추천 0 | 조회 271
Ethan 2023.10.11 0 271
60
NirSoft 네트워크 점검 및 테스트 툴
Ethan | 2023.10.03 | 추천 0 | 조회 109
Ethan 2023.10.03 0 109
59
HP 스위치 명령어
Ethan | 2023.08.31 | 추천 0 | 조회 1444
Ethan 2023.08.31 0 1444
58
HP ARUBA 기본 명령어 정리
Ethan | 2023.08.30 | 추천 0 | 조회 169
Ethan 2023.08.30 0 169
57
주니퍼 명령어 (Juniper Command) 정리
Ethan | 2023.08.21 | 추천 0 | 조회 402
Ethan 2023.08.21 0 402
56
윈도우/리눅스 취약점 진단 스크립트 사용 관련 링크
Ethan | 2023.07.26 | 추천 0 | 조회 352
Ethan 2023.07.26 0 352
55
윈도우 10 / diskpart 명령어로 디스크 초기화하고 MBR 또는 GPT로 변경하는 방법
Ethan | 2023.06.03 | 추천 0 | 조회 118
Ethan 2023.06.03 0 118