1. 程式人生 > >日常筆記-設置遠程訪問恢復密碼

日常筆記-設置遠程訪問恢復密碼

system 文件內容 rac 測試 protoc tftp 安裝 mode write

思科設備配置命令: 同樣存在模式的區分 - 用戶模式 - 用戶試圖 特權模式 - 系統試圖 全局配置模式 接口配置模式 interface gi0/0 no shutdown ip address 192.168.1.1 255.255.255.0 線路配置模式(等同於華為中的 user-interface vty ) line vty 0 4 password nihao 協議配置模式 ------------------------------------------------------------------ 設備初始化配置命令: Router> //剛開始進入設備,處於用戶模式 Router>enable //通過該命令進入到“特權模式”; Router# Router#config terminal //進入到設備的“全局配置模式” Router(config)# Router(config)#hostname R1 //更改設備主機名; R1(config)# R1(config)# no ip domain-lookup // 關閉設備的域名查詢功能; R1(config)# exit // 退出到上一個模式; R1# R1(config)# end // 無論在什麽模式,直接回退到“特權模式” R1# R1#show ip interface brief //查看當前設備上的接口的狀態信息; interface ip-address ok? method status protocol gi0/0 un yes unset admin down down R1#config terminal //進入全局配置模式; R1(config)# interface gi0/0 // 進入接口 gi0/0 的配置模式; R1(config-if)# no shutdown // 打開該端口; R1(config-if)# ip address 192.168.1.1 255.255.255.0 //配置IP地址; R1(config-if)# end //返回到特權模式,為了驗證接口的配置命令; R1#show ip interface brief // 驗證之前的配置命令是否成功; R1#show running-config //查看設備當前的運行配置文件(位於RAM中) R1#write //保持設備的配置內容到“啟動配置文件”(位於NVRAM中) R1#show startup-config // 查看啟動配置文件內容; ============================================================ 設備管理方式: 本地管理 -通過console口進行管理,使用console 線; -默認情況下,是不需要密碼的; -為了安全,配置密碼: 1、確定當前的設備管理方式 :show user 2、在 console 口下配置密碼; line console 0 password nihao 3、在 console 口下啟用認證功能; line console 0 login 4、驗證與測試 show running-config 退出設備,再次登錄,應該是需要密碼的; 遠程管理 ------------------------------------------------------------- 特權密碼配置: -默認情況下,用戶模式進入特權模式,是不需要密碼的; -為了安全考慮,配置特權密碼: R1(config)# 1、enable password nihao ,該方式配置的密碼是明文; 2、enable secret wobuhao ,配置的密碼以密文方式存儲; -enable secret 優先級高於 enable password; -刪除“特權密碼”: R1(config)# no enable password | no enable secret 註意: 為了設備中的所有的密碼,都能夠以加密的方式存在內存中: 我們為設備開啟“密碼加密服務”:(默認該服務沒有開啟) R1(config)# service password-encrytion 當開啟該服務以後,line console 和 vty 下面的密碼都以加密 的形式存在於 running-config 中。 --------------------------------------------------------------- 密碼破解: -針對路由器 #核心:配置寄存器 默認值為 0x2102,表示在設備啟動過程中,是需要查找和加載 啟動配置文件 - startup-config ; 為了實現密碼破解,需要更改寄存器的值為 0x2142,目的是為 了:在啟動過程中,跳過“查找並加載配置文件”的步驟; #配置命令: R1(config)#config-register 0x2142 // 重啟之後,才會生效 #驗證命令: show version //查看設備的配置寄存器; reload // 設備重啟命令; #破解步驟: 0、設備加電,並一直按下組合鍵: ctrl+break 此時設備會進入到 romm 模式(類似於PC的安全模式) 1、修改配置寄存器值為 0x2142 ,並重啟設備; romm1> confreg 0x2142 //修改配置寄存器; romm2> o/r 0x2142 //修改配置寄存器; romm3> ? //在 romm模式下依然支持幫助命令 - ? romm4> reset // 在 romm模式下重啟設備; 設備重啟以後進入到“系統對話框配置”模式, 進行選擇 - no ; 雖然後進入到“用戶模式”; 2、在特權模式下,將啟動配置文件 copy 到內存中: copy startup-config running-config 3、修改配置文件中的密碼; 4、將配置寄存器修改為默認值: 0x2102 5、保存配置:write; 6、將設備重啟:reload 註意: 啟動配置文件(startup-config)是存在於 nvram中, 查看網絡設備上存儲的文件的命令: dir all-filesystem 刪除文件: delete flash:\xxxxxxx.bin // 刪除特定路徑下的特定文件; 刪除啟動配置文件時,一般使用: erase nvram: // 將 nvram 中的文件全部擦除掉; 在 cisco packet tracert : dir nvram: //查看NVRAM中是否存在startup-config erase startup-config // 擦除 nvram 中的 startup-config ; ---------------------------------------------------------------- 交換機密碼破解: -本質:讓交換機在啟動過程中查找配置文件的名字的時候, 找不到對應文件名的文件(該文件是:config.text) -破解步驟: 1、設備加電,並一直不停的按mode 鍵,設備進入到switch: 模式 ; 2、在 switch: 模式下輸入 flash_init 命令; 3、查找、更改並驗證配置文件名字已經修改為其他名字; switch:dir switch:rename {source-file} {destination-file} 比如: rename flash:config.text flash:111 switch: dir //驗證文件名字是否更改成功; 4、重啟設備 : switch : boot //在交換機的romm模式重啟設備 5、進入到設備的“特權模式”,確定並修改配置文件名字為 config.text Switch# dir Switch# rename flash:111 flash:config.text Switch# dir 6、將啟動配置文件 復制到 內存中: Switch# copy startup-config running-config 7、修改交換機的密碼; 8、保存配置; ------------------------------------------------------------- 案例2: 1、配置 PC ip - 192.168.1.2 mask - 255.255.255.0 gateway - 192.168.1.1 2、配置網關 interface gi0/0 // PC的網關端口IP地址; no shutdown ip address 192.168.1.1 255.255.255.0 interface gi0/1 // 交換機SW1的網關端口IP地址; no shutdown ip address 10.0.0.1 255.255.255.0 3、配置交換機 #配置管理IP地址; interface vlan 1 no shutdown ip address 10.0.0.2 255.255.255.0 #配置交換機的默認網關; ip default-gateway 10.0.0.1 4、配置遠程訪問所需要的相關參數; #配置 VTY 密碼; line vty 0 4 password nihao #配置 特權密碼; enable password / secret cisco 5、驗證與測試 PC - 接口IP地址; 網關 - show ip interface brief switch - show ip interface brief / show running-config PC: telnet 10.0.0.2 password : nihao erase nvram:刪除啟動配置文件; erase flash:刪除 IOS ; ----------------------------------------------------- 思科設備安裝IOS: 1、console線 --- xmodem ,速度極慢; 2、tftp : 在設備無法正常啟動IOS時,也會進入到 romm 模式, 該模式下,是支持 TFTP功能的;

日常筆記-設置遠程訪問恢復密碼