CCNA筆記--4

第四章, Cisco IOS簡介
路由器IOS
IOS是被用來傳送網絡服務並啓動網絡應用的。
Cisco路由器的IOS軟件負責完成重要的工作:
1. 加載網絡協議和功能
2. 在設備間連接高速流量
3. 在控制訪問中添加安全性防止未授權的網絡使用
4. 爲簡化網絡的增長和冗餘備份,提供可縮放性
5. 爲連接到網絡中的資源,提供網絡的可靠性
連接到Cisco路由器
可以通過連接到Cisco路由器來進行路由器的設置、配置的驗證及統計數據的審覈。
通常是使用通過控制檯端口進行連接。控制檯接口一般是一個RJ-45的連接器,位於路由器背面,默認的時候,沒有口令要求。
啓動路由器
初次啓動一個Cisco路由器時,它將運行一個開機自檢過程。如果通過,他將在閃存中查找IOS系統,如果有IOS文件存在則執行裝載操作。閃存世一個電子可擦寫變成的制度存儲器。然後,IOS將繼續加載並查找一個合法的配置文件,它默認時是存儲在NVRAM中。
當路由器被首次引導或重新裝載時,會出現的信息:
System Bootstrap, Version 11.0(10c), SOFTWARE
Copyright (c) 1986-1996 by cisco Systems
2500 processor with 14336 Kbytes of main memory
這是一臺2501路由器啓動時的信息
第一行寫了,IOS版本是11.0
第二行是CISCO的版權信息
第三行行是內存的大小
路由器啓動以後,會出現一個提示
Would you like to enter the initial configuration dialog? [yes/no]: n
如果選擇yes,將進入setup模式,選擇No我們將進入擴展設置模式。
Setup模式只配置購管理系統使用的連接性能,而擴展設置會允許你配置更多的內容。
命令行界面
正式因爲命令行界面(CLI)是如此的靈活方便,所以他是配置路由器的最佳方式。
要使用CLI,只需要在初始化配置對話框窗口中輸入NO。
登陸到路由器
Router> 這就是用戶模式,通常用來查看統計信息的
在特許模式中你可以查看並修改Cisco路由器的配置,但要進入此模式需要使用enable命令
具體步驟如下:
Router>
Router>enable
Router#
---------------------
現在得到一個Router#提示符,表明已經在特許模式中了,在這裏可以修改路由器的配置。
在這裏可以通過使用disable命令,從特許模式中返回用戶模式。
Router#disable
Router>
在用戶模式裏,可以用logout命令來退出控制檯操作:
Router>logout
Router con0 is now available
Press RETURN to get started.
也可以在特許模式下鍵入logout或exit來退出:
Router>enable
Router#logout
Router con0 is now available
Press RETURN to get started.
路由器模式概述
要從CLI上進行配置,可能會需要用configure terminal命令進入全局模式才能修改當權運行配置中的內容。你也可以在特許模式下鍵入config,然後按Enter鍵以默認方式進入全局模式。
Router#config
Configuring from terminal, memory, or network [terminal]? (Enter)
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#
CLI提示符
在配置路由器時,理解所遇到的不同提示符的含義,是非常重要的。
接口
在修改接口配置,需要在全局模式下使用interface命令:
Router(config)#interface ?
Async Async interface
BVI Bridge-Group Virtual Interface
CTunnel CTunnel interface
Dialer Dialer interface
Ethernet IEEE 802.3
Group-Async Async Group interface
Lex Lex interface
Loopback Loopback interface
Multilink Multilink-group interface
Null Null interface
Serial Serial
Tunnel Tunnel interface
Vif PGM Multicast Host interface
Virtual-Template Virtual Template interface
Virtual-TokenRing Virtual TokenRing
range interface range command
Router(config)#int Serial 0
Router(config-if)#
Router(config-if)# 當提示符改變成這個的時候,說明你已經處在接口配置模式中了。
子接口
子接口允許尼在路由器中創建邏輯接口。在子接口中,提示符會改變爲Router(config-subif)#
Router(config)#int s0.?
<0-4294967295> Serial interface number
行命令
要配置用戶模式口令,是用Line命令
Router(config)#line ?
<0-6> First Line number
aux Auxiliary line
console Primary terminal line
vty Virtual terminal
路由協議配置
要配置rip或igrp這樣的路由協議,需要使用(config-router)#提示符:
Router(config)#router ?
bgp Border Gateway Protocol (BGP)
egp Exterior Gateway Protocol (EGP)
eigrp Enhanced Interior Gateway Routing Protocol (EIGRP)
igrp Interior Gateway Routing Protocol (IGRP)
isis ISO IS-IS
iso-igrp IGRP for OSI networks
mobile Mobile routes
odr On Demand stub Routes
ospf Open Shortest Path First (OSPF)
rip Routing Information Protocol (RIP)
Router(config)#router rip
Router(config-router)#
編輯和幫助功能
可以使用Cisco高級的編輯功能來幫助配置路由器。
在任意提示符下鍵入一個問號。(?),都將會得到在當前提示符下所有命令的清單。
下面是查找以某個字母開頭的快捷方式命令:
Router(config)#i?
interface ip ipx isis
在一個命令串中找下一個命令,可以先鍵入前面的命令然後輸入一個問號:
Router(config)#interface ?
Async Async interface
BVI Bridge-Group Virtual Interface
CTunnel CTunnel interface
Dialer Dialer interface
Ethernet IEEE 802.3
Group-Async Async Group interface
Lex Lex interface
Loopback Loopback interface
Multilink Multilink-group interface
Null Null interface
Serial Serial
Tunnel Tunnel interface
Vif PGM Multicast Host interface
Virtual-Template Virtual Template interface
Virtual-TokenRing Virtual TokenRing
range interface range command
Router(config)#interface serial ?
<0-1> Serial interface number
Router(config)#interface serial 0 ?
<cr>
Router(config-if)#
 
增強的編輯命令
命令 含義
CTRL+A 移動光標到本行的開始處
CTRL+E 移動光標到本行的結尾處
ESC+B 往回移動一個字
CTRL+F 向前移動一個字符
ESC+F 向前移動一個字
CTRL+D 刪除某個單一字符
BACKSPACE 刪除某個單一字符
CTRL+R 重新顯示一行
CTRL+U 刪除一行
CTRL+W 刪除一個字
CTRL+Z 結束配置模式並返回執行(EXEC)模式
TAB 完成輸入一個命令
獲取基本的路由信息
Router#sh version
Cisco Internetwork Operating System Software
IOS (tm) 2500 Software (C2500-JS-L), Version 12.2(27), RELEASE SOFTWARE (fc3)
Copyright (c) 1986-2004 by cisco Systems, Inc.
Compiled Tue 02-Nov-04 22:01 by kellmill
Image text-base: 0x0307D390, data-base: 0x00001000
ROM: System Bootstrap, Version 5.2(8a), RELEASE SOFTWARE
BOOTLDR: 3000 Bootstrap Software (IGS-RXBOOT), Version 10.2(8a), RELEASE SOFTWARE (fc1)
Router uptime is 17 minutes
System returned to ROM by power-on
System p_w_picpath file is "flash:c2500-js-l.122-27.bin"
cisco 2500 (68030) processor (revision D) with 16384K/2048K bytes of memory.
Processor board ID 02096577, with hardware revision 00000000
Bridging software.
X.25 software, Version 3.0.0.
SuperLAT software (copyright 1990 by Meridian Technology Corp).
TN3270 Emulation software.
1 Ethernet/IEEE 802.3 interface(s)
2 Serial network interface(s)
32K bytes of non-volatile configuration memory.
16384K bytes of processor board System flash (Read ONLY)
Configuration register is 0x2142

設置口令
啓用口令
可以在全局配置模式下設置啓用口令:
Router(config)#enable ?
last-resort Define enable action if no TACACS servers respond
password Assign the privileged level password
secret Assign the privileged level secret
use-tacacs Use TACACS to check enable passwords
輔助口令
要配置輔助接口口令,需要進入到全局配置模式並輸入Line aux ?。
Router(config)#line aux ?
<0-0> First Line number
Router(config)#line aux 0
Router(config-line)#password 12345
Router(config-line)#login
Router(config-line)#
控制檯口令
要設置控制檯口令,使用line console 0命令。
Router(config)#line console 0
Router(config-line)#password 12345
Router(config-line)#login
Telnet口令
要爲Telnet訪問路由器設置用戶模式口令,是用line vty命令。
Router(config)#line vty 0 ?
<1-197> Last Line number
<cr>
Router(config)#line vty 0 4
Router(config-line)#password 12345
Router(config-line)#login
Router(config-line)#
加密你的口令
在默認時只有啓用加密口令是加密的,爲了安全,需要手工配置用戶模式口令和啓用口令。
要實現口令加密,需要在全局模式下使用service password-encryption命令。
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#service password-encryption
Router(config)#
標誌區
使用標誌區是爲那些撥號到你的互聯網絡中的用戶提供了一個安全的提示。
在Cisco路由器上設置一個標誌區,這樣當任一用戶登錄到路由器上或遠程訪問路由器時,標誌區顯示你希望他們看到的信息。
設置標誌區,是用banner motd命令
Router(config)#banner motd #
Enter TEXT message. End with the character '#'.
Welcome to Hu Lian Shen Zhou
#
Router(config)#exit
現在顯示出來的就是剛纔設置的標誌區:
Welcome to Hu Lian Shen Zhou
User Access Verification
Password:
路由器接口
接口配置是路由器很重要的配置,沒有接口,路由器整個是沒用的。
不同的路由器使用不同的方式來選擇接口的使用。
Router(config)#int ?
Async Async interface
BVI Bridge-Group Virtual Interface
CTunnel CTunnel interface
Dialer Dialer interface
Ethernet IEEE 802.3
Group-Async Async Group interface
Lex Lex interface
Loopback Loopback interface
Multilink Multilink-group interface
Null Null interface
Serial Serial
Tunnel Tunnel interface
Vif PGM Multicast Host interface
Virtual-Template Virtual Template interface
Virtual-TokenRing Virtual TokenRing
range interface range command
以上是我們實驗室2501路由器的接口。
激活接口
使用shutdown來關閉接口,用no shutdown命令打開一個接口
下列顯示瞭如何打開一個接口:
Router(config)#int s0
Router(config-if)#no shut
在接口上配置IP地址
即使在路由器上不需要直接使用IP,但是人們還是要經常使用它。
要在接口上配置IP地址,是用ip address命令:
Router(config)#int s0
Router(config-if)#ip address 192.168.0.1 255.255.255.0
Router(config-if)#no shut
最後一定要記住使用no shutdown命令來打開接口。
串行接口命令
接口將被接到一個CSU/DSU類型的設備上,它要爲線路提供時鐘。如果是用背對背的配置模式,DCE的連接端必須提供式中。默認時,Cisco的路由器都是數據終端設備(DTE)。
配置DEC串行接口使用clock rate命令:
Router#config t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int s0
Router(config-if)#clock rate 64000
主機名
使用hostname命令來設置路由器的標識。它只在局部有作用,並不影響路由器的名稱查找或路由器在互聯網上的工作。
舉例:
Router(config)#hostname SZ_Lab
SZ_Lab(config)#hostname Cisco
Cisco(config)#
描述
在接口上設置描述非常有意義,以免忘記了哪個接口是連接到哪裏的這些。
和主機名一樣,它是隻在本地有意思的設置。
Cisco(config)#int s0
Cisco(config-if)#description WAN to school
以下是show run信息
!
interface Serial0
description WAN to school
ip address 192.168.0.1 255.255.255.0
!
查看並保存配置
使用copy running-config startup-config命令,將配置從DRAM中手工保存到NVRAM中。
Cisco#copy run start
Destination filename [startup-config]? [ENTER]
Building configuration...
[OK]
要刪除啓動配置文件,使用erase startup-config命令
Cisco#erase startup-config
Erasing the nvram filesystem will remove all configuration files! Continue? [confirm][ENTER]
[OK]
Erase of nvram: complete
Cisco#reload(從啓路由器命令)
驗證配置
show interface命令
sh ip interface命令
sh ip interface brief命令
sh controllers命令。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章