天天看點

路由基本配置(上)

路由器配置基礎 

一、基本設定方式 

一般來說,可以用5種方式來設定路由器: 

1. Console口接終端或運作終端仿真軟體的微機; 

2. AUX口接MODEM,通過電話線與遠方的終端或運作終端仿真軟體的微機相連; 

3. 通過Ethernet上的TFTP伺服器; 

4. 通過Ethernet上的TELNET程式; 

5. 通過Ethernet上的SNMP網管工作站。 

但路由器的第一次設定必須通過第一種方式進行,此時終端的硬體設定如下: 

波特率 :9600 

資料位 :8 

停止位 :1 

奇偶校驗: 無

指令狀态 

1. router> 

路由器處于使用者指令狀态,這時使用者可以看路由器的連接配接狀态,通路其它網絡和主機,但不能看到和更改路由器的設定内容。 

2. router# 

在router>提示符下鍵入enable,路由器進入特權指令狀态router#,這時不但可以執行所有的使用者指令,還可以看到和更改路由器的設定内容。 

3. router(config)# 

在router#提示符下鍵入configure terminal,出現提示符router(config)#,此時路由器處于全局設定狀态,這時可以設定路由器的全局參數。 

4. router(config-if)#; 

router(config-line)#; 

router(config-router)#;… 

路由器處于局部設定狀态,這時可以設定路由器某個局部的參數。 

5. > 

路由器處于RXBOOT狀态,在開機後60秒内按ctrl-break可進入此狀态,這時路由器不能完成正常的功能,隻能進行軟體更新和手工引導。 

6. 設定對話狀态 

這是一台新路由器開機時自動進入的狀态,在特權指令狀态使用SETUP指令也可進入此狀态,這時可通過對話方式對路由器進行設定。 

三、設定對話過程 

利用設定對話過程可以避免手工輸入指令的煩瑣,但它還不能完全代替手工設定,一些特殊的設定還必須通過手工輸入的方式完成。 

進入設定對話過程後,路由器首先會顯示一些提示資訊: 

--- System Configuration Dialog --- 

At any point you may enter a question mark '?' for help. 

Use ctrl-c to abort configuration dialog at any prompt. 

Default settings are in square brackets '[]'. 

這是告訴你在設定對話過程中的任何地方都可以鍵入“?”得到系統的幫助,按ctrl-c可以退出設定過程,預設設定将顯示在‘[]’中。然後路由器會問是否進入設定對話: 

Would you like to enter the initial configuration dialog? [yes]: 

如果按y或回車,路由器就會進入設定對話過程。首先你可以看到各端口目前的狀況: 

First, would you like to see the current interface summary? [yes]: 

Any interface listed with OK? value "NO" does not have a valid configuration 

Interface IP-Address OK? Method Status Protocol 

Ethernet0 unassigned NO unset up up 

Serial0 unassigned NO unset up up 

……… ……… … …… … … 

然後,路由器就開始全局參數的設定: 

Configuring global parameters: 

1. 設定路由器名: 

Enter host name [Router]: 

2. 設定進入特權狀态的密文(secret),此密文在設定以後不會以明文方式顯示: 

The enable secret is a one-way cryptographic secret used 

instead of the enable password when it exists. 

Enter enable secret: cisco 

3. 設定進入特權狀态的密碼(password),此密碼隻在沒有密文時起作用,并且在設定以後會以明文方式顯示: 

The enable password is used when there is no enable secret 

and when using older software and some boot images. 

Enter enable password: pass 

4. 設定虛拟終端通路時的密碼: 

Enter virtual terminal password: cisco 

5. 詢問是否要設定路由器支援的各種網絡協定: 

Configure SNMP Network Management? [yes]: 

Configure DECnet? [no]: 

Configure AppleTalk? [no]: 

Configure IPX? [no]: 

Configure IP? [yes]: 

Configure IGRP routing? [yes]: 

Configure RIP routing? [no]: 

……… 

6. 如果配置的是撥号通路伺服器,系統還會設定異步口的參數: 

Configure Async lines? [yes]: 

1) 設定線路的最高速度: 

Async line speed [9600]: 

2) 是否使用硬體流控: 

Configure for HW flow control? [yes]: 

3) 是否設定modem: 

Configure for modems? [yes/no]: yes 

4) 是否使用預設的modem指令: 

Configure for default chat script? [yes]: 

5) 是否設定異步口的PPP參數: 

Configure for Dial-in IP SLIP/PPP access? [no]: yes 

6) 是否使用動态IP位址: 

Configure for Dynamic IP addresses? [yes]: 

7) 是否使用預設IP位址: 

Configure Default IP addresses? [no]: yes 

8) 是否使用TCP頭壓縮: 

Configure for TCP Header Compression? [yes]: 

9) 是否在異步口上使用路由表更新: 

Configure for routing updates on async links? [no]: y 

10) 是否設定異步口上的其它協定。 

接下來,系統會對每個接口進行參數的設定。 

1.Configuring interface Ethernet0: 

1) 是否使用此接口: 

Is this interface in use? [yes]: 

2) 是否設定此接口的IP參數: 

Configure IP on this interface? [yes]: 

3) 設定接口的IP位址: 

IP address for this interface: 192.168.162.2 

4) 設定接口的IP子網路遮罩: 

Number of bits in subnet field [0]: 

Class C network is 192.168.162.0, 0 subnet bits; mask is /24 

在設定完所有接口的參數後,系統會把整個設定對話過程的結果顯示出來: 

The following configuration command script was created: 

hostname Router 

enable secret 5 $1$W5Oh$p6J7tIgRMBOIKVXVG53Uh1 

enable password pass 

………… 

請注意在enable secret後面顯示的是亂碼,而enable password後面顯示的是設定的内容。 

顯示結束後,系統會問是否使用這個設定: 

Use this configuration? [yes/no]: yes 

如果回答yes,系統就會把設定的結果存入路由器的NVRAM中,然後結束設定對話過程,使路由器開始正常的工作。 

四、常用指令 

1. 幫助 

在IOS操作中,無論任何狀态和位置,都可以鍵入“?”得到系統的幫助。 

2. 改變指令狀态 

任務 指令 

進入特權指令狀态 enable 

退出特權指令狀态 disable 

進入設定對話狀态 setup 

進入全局設定狀态 config terminal 

退出全局設定狀态 end 

進入端口設定狀态 interface type slot/number 

進入子端口設定狀态 interface type number.subinterface [point-to-point | multipoint] 

進入線路設定狀态 line type slot/number 

進入路由設定狀态 router protocol 

退出局部設定狀态 exit 

3. 顯示指令 

檢視版本及引導資訊 show version 

檢視運作設定 show running-config 

檢視開機設定 show startup-config 

顯示端口資訊 show interface type slot/number 

顯示路由資訊 show ip router 

4. 拷貝指令 

用于IOS及CONFIG的備份和更新

      本文轉自xubenxin  51CTO部落格,原文連結:http://blog.51cto.com/windows/13458,如需轉載請自行聯系原作者

繼續閱讀