Продолжая тему сброса устройств в настройки по умолчанию, рассмотрим сброс коммутаторов Cisco Catalyst на примере коммутатора Cisco Catalyst WS-C2950-24.
Подключаемся через последовательный интерфейс к консоли управления коммутатора. Распиновка консольного кабеля такая:
Подключаемся с использованием утилиты minicom [2]. Параметры настройки COM-порта 9600 8N1.
Рассмотрим такие варианты работы с коммутатором:
Восстановление доступа к коммутатору
Выполним пошагово следующие действия:
- Нажимаем и удерживаем на коммутаторе кнопку Mode.
- Подаем на коммутатор питание, подключив кабель питания.
- Ожидаем окончания загрузки Boot Loader, дожидаясь приглашение командной строки "switch:":
C2950 Boot Loader (C2950-HBOOT-M) Version 12.1(11r)EA1, RELEASE SOFTWARE (fc1) Compiled Mon 22-Jul-02 18:57 by antonino WS-C2950-24 starting... Base ethernet MAC Address: 00:08:20:fd:8b:00 Xmodem file system is available. 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 load_helper boot switch:
- Вводим команду flash_init и жмем клавишу "Enter":
switch: flash_init Initializing Flash... flashfs[0]: 6 files, 1 directories flashfs[0]: 0 orphaned files, 0 orphaned directories flashfs[0]: Total bytes: 7741440 flashfs[0]: Bytes used: 2904576 flashfs[0]: Bytes available: 4836864 flashfs[0]: flashfs fsck took 10 seconds. ...done initializing flash. Boot Sector Filesystem (bs:) installed, fsid: 3 Parameter Block Filesystem (pb:) installed, fsid: 4
- Вводим команду "load_helper" и жмем клавишу "Enter":
switch: load_helper
- Теперь нам доступны следующие возможности:
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 load_helper -- Load and initialize a helper image 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_param -- Set system parameters in flash trap -- Cause a software breakpoint to occur type -- Concatenate (type) file(s) -- MORE -- unset -- Unset one or more environment variables version -- Display boot loader version
- Выведем список файлов на флеше, воспользовавшись командой "dir flash:":
switch: dir flash: Directory of flash:/ 2 -rwx 2888611 <date> c2950-i6q4l2-mz.121-13.EA1c.bin 3 -rwx 241 <date> env_vars 4 -rwx 736 <date> vlan.dat 6 -rwx 6329 <date> config.text 7 -rwx 47 <date> private-config.text 4843008 bytes available (2898432 bytes used)
- Конфигурация коммутатора находится в файле config.text. Переименуем файл конфигурации, воспользовавшись командой "rename", например в config.old:
switch: rename flash:config.text flash:config.old
- Продолжим загрузку коммутатора командой boot:
switch: boot Loading "flash:/c2950-i6q4l2-mz.121-13.EA1c.bin"... ############################################################## ############################################################## ############################################################## ############################################################## ################################################# File "flash:/c2950-i6q4l2-mz.121-13.EA1c.bin" uncompressed and installed, entry point: 0x80010000 executing... Restricted Rights Legend Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c) of the Commercial Computer Software - Restricted Rights clause at FAR sec. 52.227-19 and subparagraph (c) (1) (ii) of the Rights in Technical Data and Computer Software clause at DFARS sec. 252.227-7013. cisco Systems, Inc. 170 West Tasman Drive San Jose, California 95134-1706 Cisco Internetwork Operating System Software IOS (tm) C2950 Software (C2950-I6Q4L2-M), Version 12.1(13)EA1c, RELEASE SOFTWARE (fc1) Copyright (c) 1986-2003 by cisco Systems, Inc. Compiled Tue 24-Jun-03 17:31 by yenanh Image text-base: 0x80010000, data-base: 0x805A8000 Initializing flashfs... flashfs[1]: 5 files, 1 directories flashfs[1]: 0 orphaned files, 0 orphaned directories flashfs[1]: Total bytes: 7741440 flashfs[1]: Bytes used: 2898432 flashfs[1]: Bytes available: 4843008 flashfs[1]: flashfs fsck took 8 seconds. flashfs[1]: Initialization complete. Done initializing flashfs. POST: System Board Test : Passed POST: Ethernet Controller Test : Passed ASIC Initialization Passed POST: FRONT-END LOOPBACK TEST : Passed cisco WS-C2950-24 (RC32300) processor (revision B0) with 20839K bytes of memory. Processor board ID FAB0XXXXXXX Last reset from system-reset Running Standard Image 24 FastEthernet/IEEE 802.3 interface(s) 32K bytes of flash-simulated non-volatile configuration memory. Base ethernet MAC Address: 00:08:20:XX:XX:XX Motherboard assembly number: 73-XXXX-XX Power supply part number: 34-XXXX-XX Motherboard serial number: FAB0XXXXXXX Power supply serial number: DAB0XXXXXXX Model revision number: B0 Model number: WS-C2950-24 System serial number: FAB0XXXXXXX --- System Configuration Dialog --- Would you like to enter the initial configuration dialog? [yes/no]:
- Отказываемся от конфигурационного диалога:
Would you like to enter the initial configuration dialog? [yes/no]: no
- Переходим в режим enable и подгружаем файл конфигурации:
Switch>enable Switch#copy flash:config.old running-config Destination filename [running-config]? 6329 bytes copied in 4.420 secs (1432 bytes/sec)
- Переходим в режим конфигурации, меняем пароль пользователя admin (или создаем в случае отсутствия) и пароль режима enable (также, в случае необходимости, меняем пароли на line telnet, line vty, коректируем конфигурацию и тд):
TEST-sw#configure terminal Enter configuration commands, one per line. End with CNTL/Z. TEST-sw(config)#username admin privilege 15 password PASSWORD_HERE TEST-sw(config)#enable password ENABLE_PASSWORD_HERE
- Выходим из режима конфигурации, сохраняем внесенные изменения, удаляем старый файл конфигурации и перезагружаем коммутатор:
TEST-sw(config)#exit TEST-sw#copy running-config startup-config Destination filename [startup-config]? Building configuration... [OK] TEST-sw#delete flash:config.old Delete filename [config.old]? Delete flash:config.old? [confirm]y TEST-sw#reload Proceed with reload? [confirm]
- Авторизуемся на коммутаторе, используя параметры аутентификации, заданные в пункте 12.
Сброс коммутатора в настройки по умолчанию
Выполним пошагово следующие действия:
- Нажимаем и удерживаем на коммутаторе кнопку Mode.
- Подаем на коммутатор питание, подключив кабель питания.
- Ожидаем окончания загрузки Boot Loader, дожидаясь приглашение командной строки "switch:":
C2950 Boot Loader (C2950-HBOOT-M) Version 12.1(11r)EA1, RELEASE SOFTWARE (fc1) Compiled Mon 22-Jul-02 18:57 by antonino WS-C2950-24 starting... Base ethernet MAC Address: 00:08:20:fd:8b:00 Xmodem file system is available. 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 load_helper boot switch:
- Вводим команду flash_init и жмем клавишу "Enter":
switch: flash_init Initializing Flash... flashfs[0]: 6 files, 1 directories flashfs[0]: 0 orphaned files, 0 orphaned directories flashfs[0]: Total bytes: 7741440 flashfs[0]: Bytes used: 2904576 flashfs[0]: Bytes available: 4836864 flashfs[0]: flashfs fsck took 10 seconds. ...done initializing flash. Boot Sector Filesystem (bs:) installed, fsid: 3 Parameter Block Filesystem (pb:) installed, fsid: 4
- Вводим команду "load_helper" и жмем клавишу "Enter":
switch: load_helper
- Теперь нам доступны следующие возможности:
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 load_helper -- Load and initialize a helper image 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_param -- Set system parameters in flash trap -- Cause a software breakpoint to occur type -- Concatenate (type) file(s) -- MORE -- unset -- Unset one or more environment variables version -- Display boot loader version
- Выведем список файлов на флеше, воспользовавшись командой "dir flash:":
switch: dir flash: Directory of flash:/ 2 -rwx 2888611 <date> c2950-i6q4l2-mz.121-13.EA1c.bin 3 -rwx 241 <date> env_vars 4 -rwx 736 <date> vlan.dat 6 -rwx 6329 <date> config.text 7 -rwx 47 <date> private-config.text 4843008 bytes available (2898432 bytes used)
- Конфигурация коммутатора находится в файле config.text, список VLAN-ов - в файле vlan.dat. Удалим эти файлы, воспользовавшись командой "delete":
switch: delete flash:config.text Are you sure you want to delete "flash:config.text" (y/n)?y File "flash:config.text" deleted switch: delete flash:vlan.dat Are you sure you want to delete "flash:vlan.dat" (y/n)?y File "flash:vlan.dat" deleted
- Перезагружаем коммутатор:
switch: reset Are you sure you want to reset the system (y/n)?y System resetting...