在全局配置模式下切換router接口,輸入interface命令,?用于提示可選參數,為如下: Router(config)#interface ? (略) Serial Serial 前半部分為參數,后半部分為描述,接著輸入serial 0,進入router接口配置模式,如下: Router(config)#interface serial 0 Router(config-if)#
Subinterfaces
在router的某個接口劃分邏輯子接口(subinterface),輸入命令進入子接口模式,如下,注重提示符: Router(config)#interface fa0/0.? <0-4294967295> FastEhernet interface number Router(config)#interface fa0/0.1 Router(config-subif)#
一些特寫: 1.在命令行下輸入?,將得到該模式下可以使用的命令列表以及其描述 2.假如你不確定1個命令是如何寫的,比如你只記得是字母c開頭,你可以輸入c加1個?,將得到該模式下可以使用的所有命令: Router#c? clear clock configuration connect copy Router#clock ? set Set the time and date 3.假如你輸入的命令不完整,將得到1個錯誤提示:Imcomplete command,這樣有助于分析命令哪出錯了 4.router支持命令縮寫,比如show可以縮寫為sh,sho,但是假如你像如下那樣輸入了不完整的縮寫,將得到錯誤提示:Ambiguous command Router#sh te % Ambiguous command: sh te Router#sh te? tech-support template terminal
其他的一些關于歷史的命令: 1.show history:顯示最后輸入的10條命令,默認是10條,可以修改該值 2.terminal history size:修改顯示最后輸入過的的命令的數量,默認是10條,最大是256條 3.show terminal:顯示命令歷史緩存大小,如下: Router#sh terminal (略) History is enabled,history size is 10 (略) Router#terminal history size ? <0-256> Size of history buffer Router#terminal history size 25 Router#sh terminal (略) History is enabled,history size is 25 (略)
Gather Basic Routing Information
show version:顯示系統硬件的基本配置和軟件版本,以及配置文件的名字和來源,還有啟動鏡象,最后是configuration register的值
enable password:給console和AUX口加密,防止未授權用戶進入特權模式,但是密碼是非加密形式 enable secret:給console和AUX口加密,防止未授權用戶進入特權模式,密碼是加密形式,并且一旦起用了這個密碼,將凌駕于enable password之上,假如同時設置了enable password和enable secret的情況下,必須輸入不同的密碼,如下: Router(config)#enable password 123 Router(config)#enable secret 123 The enable password you have chosen is the same as your enable secret.This is not recommended.Re-enter the enable password Router(config)#enable secret 321
假如VTY線路的密碼沒有設置,你將無法使用telnet來連上它
Auxiliary Password
配置AUX密碼: Router#conf t Router(config)#line aux ? <0-0> First line number Router(config)#line aux 0 Router(config-line)#login Router(config-line)#password 123
Console Password
配置console密碼以及一些輔助命令: Router#conf t Router(config)#line console ? <0-0> First line number Router(config)#line console 0 Router(config-line)#login Router(config-line)#password 123 Router(config-line)#exec-timeout ? <0-35791> Timeout in minutes Router(config-line)#exec-timeout 0 ? <0-2147483> Timeout in seconds Router(config-line)#exec-timeout 0 0 Router(config-line)#logging synchonous exec-timeout命令:假如X分鐘X秒不活動的話將自動退出,默認是10分鐘,0 0代表永遠不自動退出 logging synchronous:光標跟隨
Telnet Password
配置VTY密碼:假如你的IOS不是企業版(Enterprise edition),默認你只能有5條VTY線路,線路0到4.配置如下: Router(config-line)#line vty 0 ? <1-4> Last Line Number Router(config-line)#line vty 0 4 Router(config-line)#login Router(config-line)#password 123
banner類似標語,問候語.最常用的是MOTD(message of the day),分界符用于分隔信息,但是分隔符不能出現在MOTD信息中,如下: Router(config)#banner motd # The Router is mine # Router(config)#^Z(Ctrl+Z) Router#exit Router con0 is now available Press RETURN to get started The Router is mine Router>
配置router的接口,一般命令模式采用:interface type number的格式,比如: Router(config)#int ethernet 0 但是Cisco的2600,3600,4000和7000等系列采用了物理卡槽和模塊化的端口機制.因此,命令變化為:interface type slot/port,比如: Router(config)#int fastethernet 0 % Imcomplete command Router(config)#int fastethernet 0? / Router(config)#int fastethernet 0/? <0-1> Fastethernet interface number Router(config)#int fastethernet 0/1
配置連接器的介質類型,使用media-type命令,不過這個一般是自動檢測,如下: Router(config)#int fa 0/0 Router(config-if)#media-type ? 100BaseX Use RJ45 for -TX; SC F0 for –FX MII Use MII connector
Bring Up an Interface
打開和關閉1個接口,分別使用shutdown和no shutdown命令,當你關閉某個接口的時候,使用sh interfaces命令可以查看接口狀態,并且你將看到以下輸出: Router#sh int e0 Ethernet0 is administratively down,line protocol is down (略) 接口是關閉的,所以你要手動打開它,如下: Router#conf t Router(config)#int e0 Router(config-if)#no shut Router(config-if)#^Z Router#sh int e0 Ethernet is up,line protocol is up (略)
假如你需要在1個接口添加第二個子網地址,在末尾使用secondary參數,這將替換現有IP地址,如下: Router(config)#int e0 Router(config-if)#ip address 172.16.20.2 255.255.255.0 secondary Router(config-if)#^Z 來驗證下: Router#sh run (略) ! interface Ethernet0 ip address 172.16.20.2 255.255.255.0 secondary ip address 172.16.10.2 255.255.255.0 !
Serial Interface Commands
Serial口一般是連接在CSU/DSU等類型的提供時鐘頻率的設備上.但是,假如你在個實驗環境里采用了背對背配置,那么1端將作為DCE設備提供時鐘頻率.默認Cisco的router都是DTE,所以你必須讓1個serial接口來提供時鐘頻率,采用的命令是:clock rate,如下: Router(config)#int s0 Router(config-if)#clock rate ? Speed (bits per second) 1200 (略) 56000 64000 (略) Router(config-if)#clock rate 64000 % Error: This commands applies only to DCE interfaces Router(config-if)#int s1 Router(config-if)#clock rate 64000
確定serial接口是否是DCE線纜使用sh controllers命令,如下: Router>sh controllers s 0 HD unit 0, idb=0x297DE8, driver strUCture at 0x29F3A0 Buffer size 1524 HD unit 0, V.35 DCE cable
show ip interface:提供router接口的層3信息,包括: 1.接口狀態 2.IP地址和掩碼 3.訪問列表(access-list)信息 4.一些其他的基本的IP信息
Using the show ip interface brief Command
show ip interface brief:和show ip interface類似,只是提供簡潔點的總結信息
Using the show controllers Command
sh controllers:顯示物理接口的信息,還提供serial口線纜信息,如下: Router#sh controllers serial 0/0 (略) buffer size 1524 HD unit 0, V.35 DTE cable (略) Router#sh controllers serial 0/1 (略) buffer size 1524 HD unit 1, V.35 DCE cable (略)