天天看點

CISCO 技術大集合

CISCO 技術大集合

二、指令狀态

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指令也可進入此狀态,這時可通過對話方式對路由器進行設定。 

傳回目錄

三、設定對話過程 

1. 顯示提示資訊

2. 全局參數的設定

3. 接口參數的設定

4. 顯示結果

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

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

--- 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 p_w_picpaths. 

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的備份和更新 

5. 網絡指令 

登入遠端主機 telnet hostname|IP address 

網絡偵測 ping hostname|IP address 

路由跟蹤 trace hostname|IP address 

6. 基本設定指令 

全局設定 config terminal 

設定通路使用者及密碼 username username password password 

設定特權密碼 enable secret password 

設定路由器名 hostname name 

設定靜态路由 ip route destination subnet-mask next-hop 

啟動IP路由 ip routing 

啟動IPX路由 ipx routing 

端口設定 interface type slot/number 

設定IP位址 ip address address subnet-mask 

設定IPX網絡 ipx network network 

激活端口 no shutdown 

實體線路設定 line type number 

啟動登入程序 login [local|tacacs server] 

設定登入密碼 password password 

五、配置IP尋址 

1. IP位址分類

IP位址分為網絡位址和主機位址二個部分,A類位址前8位為網絡位址,後24位為主機位址,B類位址16位為網絡位址,後16位為主機位址,C類位址前24位為網絡位址,後8位為主機位址,網絡位址範圍如下表所示:

種類 網絡位址範圍 

A  1.0.0.0 到126.0.0.0有效 0.0.0.0 和127.0.0.0保留 

B 128.1.0.0到191.254.0.0有效 128.0.0.0和191.255.0.0保留 

C 192.0.1.0 到223.255.254.0有效 192.0.0.0和223.255.255.0保留 

D 224.0.0.0到239.255.255.255用于多點廣播 

E 240.0.0.0到255.255.255.254保留 255.255.255.255用于廣播 

2. 配置設定接口IP位址

接口設定 interface type slot/number 

為接口設定IP位址 ip address ip-address mask 

掩瑪(mask)用于識别IP位址中的網絡位址位數,IP位址(ip-address)和掩碼(mask)相與即得到網絡位址。

3. 使用可變長的子網路遮罩

通過使用可變長的子網路遮罩可以讓位于不同接口的同一網絡編号的網絡使用不同的掩碼,這樣可以節省IP位址,充分利用有效的IP位址空間。

如下圖所示:

Router1和Router2的E0端口均使用了C類位址192.1.0.0作為網絡位址,Router1的E0的網絡位址為192.1.0.128, 掩碼為255.255.255.192, Router2的E0的網絡位址為192.1.0.64,掩碼為255.255.255.192,這樣就将一個C類網絡位址配置設定給了二個網,既劃分了二個 子網,起到了節約位址的作用。

4. 使用網絡位址翻譯(NAT)

NAT(Network Address Translation)起到将内部私有位址翻譯成外部合法的全局位址的功能,它使得不具有合法IP位址的使用者可以通過NAT通路到外部Internet.

當建立内部網的時候,建議使用以下位址組用于主機,這些位址是由Network Working Group(RFC 1918)保留用于私有網絡位址配置設定的.

l Class A:10.1.1.1 to 10.254.254.254

l Class B:172.16.1.1 to 172.31.254.254

l Class C:192.168.1.1 to 192.168.254.254

指令描述如下: 

定義一個标準通路清單 access-list access-list-number permit source [source-wildcard] 

定義一個全局位址池 ip nat pool name start-ip end-ip {netmask netmask | prefix-length prefix-length} [type rotary] 

建立動态位址翻譯 ip nat inside source {list {access-list-number | name} pool name [overload] | static local-ip global-ip} 

指定内部和外部端口 ip nat {inside | outside} 

如下圖所示,

路由器的Ethernet 0端口為inside端口,即此端口連接配接内部網絡,并且此端口所連接配接的網絡應該被翻譯,Serial 0端口為outside端口,其擁有合法IP位址(由NIC或服務提供商所配置設定的合法的IP位址),來自網絡10.1.1.0/24的主機将從IP位址池 c2501中選擇一個位址作為自己的合法位址,經由Serial 0口通路Internet。指令ip nat inside source list 2 pool c2501 overload中的參數overload,将允許多個内部位址使用相同的全局位址(一個合法IP位址,它是由NIC或服務提供商所配置設定的位址)。指令 ip nat pool c2501 202.96.38.1 202.96.38.62 netmask 255.255.255.192定義了全局位址的範圍。 

設定如下:

ip nat pool c2501 202.96.38.1 202.96.38.62 netmask 255.255.255.192 

interface Ethernet 0 

ip address 10.1.1.1 255.255.255.0 

ip nat inside 

interface Serial 0 

ip address 202.200.10.5 255.255.255.252 

ip nat outside 

ip route 0.0.0.0 0.0.0.0 Serial 0 

access-list 2 permit 10.0.0.0 0.0.0.255 

! Dynamic NAT 

ip nat inside source list 2 pool c2501 overload 

line console 0 

exec-timeout 0 0 

line vty 0 4 

end 

六、配置靜态路由

通過配置靜态路由,使用者可以人為地指定對某一網絡通路時所要經過的路徑,在網絡結構比較簡單,且一般到達某一網絡所經過的路徑唯一的情況下采用靜态路由。

建立靜态路由 ip route prefix mask {address | interface} [distance] [tag tag] [permanent] 

Prefix :所要到達的目的網絡 

mask :子網路遮罩 

address :下一個跳的IP位址,即相鄰路由器的端口位址。 

interface :本地網絡接口 

distance :管理距離(可選) 

tag tag :tag值(可選) 

permanent :指定此路由即使該端口關掉也不被移掉。

以下在Router1上設定了通路192.1.0.64/26這個網下一跳位址為192.200.10.6,即當有目的位址屬于192.1.0.64 /26的網絡範圍的資料報,應将其路由到位址為192.200.10.6的相鄰路由器。在Router3上設定了通路192.1.0.128/26及 192.200.10.4/30這二個網下一跳位址為192.1.0.65。由于在Router1上端口Serial 0位址為192.200.10.5,192.200.10.4/30這個網屬于直連的網,已經存在通路192.200.10.4/30的路徑,是以不需要 在Router1上添加靜态路由。

Router1: 

ip route 192.1.0.64 255.255.255.192 192.200.10.6 

Router3: 

ip route 192.1.0.128 255.255.255.192 192.1.0.65 

ip route 192.200.10.4 255.255.255.252 192.1.0.65 

同時由于路由器Router3除了與路由器Router2相連外,不再與其他路由器相連,是以也可以為它賦予一條預設路由以代替以上的二條靜态路由,

ip route 0.0.0.0 0.0.0.0 192.1.0.65

即隻要沒有在路由表裡找到去特定目的位址的路徑,則資料均被路由到位址為192.1.0.65的相鄰路由器。

一、HDLC 

HDLC是CISCO路由器使用的預設協定,一台新路由器在未指定封裝協定時預設使用HDLC封裝。

1. 有關指令

端口設定 

設定HDLC封裝 encapsulation hdlc 

設定DCE端線路速度 clockrate speed 

複位一個硬體接口 clear interface serial unit 

顯示接口狀态 show interfaces serial [unit] 1 

注:1.以下給出一個顯示Cisco同步序列槽狀态的例子. 

Router#show interface serial 0 

Serial 0 is up, line protocol is up 

Hardware is MCI Serial 

Internet address is 150.136.190.203, subnet mask is 255.255.255.0 

MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec, rely 255/255, load 1/255 

Encapsulation HDLC, loopback not set, keepalive set (10 sec) 

Last input 0:00:07, output 0:00:00, output hang never 

Output queue 0/40, 0 drops; input queue 0/75, 0 drops 

Five minute input rate 0 bits/sec, 0 packets/sec 

Five minute output rate 0 bits/sec, 0 packets/sec 

16263 packets input, 1347238 bytes, 0 no buffer 

Received 13983 broadcasts, 0 runts, 0 giants 

2 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 2 abort 

22146 packets output, 2383680 bytes, 0 underruns 

0 output errors, 0 collisions, 2 interface resets, 0 restarts 

1 carrier transitions 

2. 舉例

設定如下: 

interface Serial0 

ip address 192.200.10.1 255.255.255.0 

clockrate 1000000 

Router2: 

ip address 192.200.10.2 255.255.255.0 

3. 舉例使用E1線路實作多個64K專線連接配接.

相關指令: 

進入controller配置模式 controller {t1 | e1} number 

選擇幀類型 framing {crc4 | no-crc4} 

選擇line-code類型 linecode {ami | b8zs | hdb3} 

建立邏輯通道組與時隙的映射 channel-group number timeslots range1 

顯示controllers接口狀态 show controllers e1 [slot/port]2 

注: 1. 當鍊路為T1時,channel-group編号為0-23, Timeslot範圍1-24; 當鍊路為E1時, channel-group編号為0-30, Timeslot範圍1-31. 

2.使用show controllers e1觀察controller狀态,以下為幀類型為crc4時controllers正常的狀态. 

Router# show controllers e1 

e1 0/0 is up. 

Applique type is Channelized E1 - unbalanced 

Framing is CRC4, Line Code is HDB3 No alarms detected. 

Data in current interval (725 seconds elapsed): 

0 Line Code Violations, 0 Path Code Violations 

0 Slip Secs, 0 Fr Loss Secs, 0 Line Err Secs, 0 Degraded Mins 

0 Errored Secs, 0 Bursty Err Secs, 0 Severely Err Secs, 0 Unavail Secs 

Total Data (last 24 hours) 0 Line Code Violations, 0 Path Code Violations, 

0 Slip Secs, 0 Fr Loss Secs, 0 Line Err Secs, 0 Degraded Mins, 

以下例子為E1連接配接3條64K專線, 幀類型為NO-CRC4,非平衡鍊路,路由器具體設定如下:

shanxi#wri t

Building configuration...

Current configuration:

!

version 11.2

no service udp-small-servers

no service tcp-small-servers

hostname shanxi

enable secret 5 $1$XN08$Ttr8nfLoP9.2RgZhcBzkk/

enable password shanxi

ip subnet-zero

controller E1 0 

framing NO-CRC4 

channel-group 0 timeslots 1 

channel-group 1 timeslots 2 

channel-group 2 timeslots 3 

interface Ethernet0

ip address 133.118.40.1 255.255.0.0

media-type 10BaseT

interface Ethernet1

no ip address

shutdown

interface Serial0:0 

ip address 202.119.96.1 255.255.255.252

no ip mroute-cache

interface Serial0:1 

ip address 202.119.96.5 255.255.255.252

interface Serial0:2 

ip address 202.119.96.9 255.255.255.252

no ip classless

ip route 133.210.40.0 255.255.255.0 Serial0:0

ip route 133.210.41.0 255.255.255.0 Serial0:1

ip route 133.210.42.0 255.255.255.0 Serial0:2

line con 0

line aux 0

line vty 0 4

password shanxi

login

end

廣域網設定:

二、PPP 

PPP(Point-to-Point Protocol)是SLIP(Serial Line IP protocol)的繼承者,它提供了跨過同步和異步電路實作路由器到路由器(router-to-router)和主機到網絡(host-to- network)的連接配接。

CHAP(Challenge Handshake Authentication Protocol)和PAP(Password Authentication Protocol) (PAP)通常被用于在PPP封裝的串行線路上提供安全性認證。使用CHAP和PAP認證,每個路由器通過名字來識别,可以防止未經授權的通路。

CHAP和PAP在RFC 1334上有詳細的說明。

設定PPP封裝 encapsulation ppp1 

設定認證方法 ppp authentication {chap | chap pap | pap chap | pap} [if-needed][list-name | default] [callin] 

指定密碼 username name password secret 

注:1、要使用CHAP/PAP必須使用PPP封裝。在與非Cisco路由器連接配接時,一般采用PPP封裝,其它廠家路由器一般不支援Cisco的HDLC封裝協定。 

路由器Router1和Router2的S0口均封裝PPP協定,采用CHAP做認證,在Router1中應建立一個使用者,以對端路由器主機名作為使用者 名,即使用者名應為router2。同時在Router2中應建立一個使用者,以對端路由器主機名作為使用者名,即使用者名應為router1。所建的這兩使用者的 password必須相同。

hostname router1 

username router2 password xxx 

ppp authentication chap 

hostname router2 

username router1 password xxx 

ppp authentication chap

三、x.25

1. X25技術

X.25規範對應OSI三層,X.25的第三層描述了分組的格式及分組交換的過程。X.25的第二層由LAPB(Link Access Procedure, Balanced)實作,它定義了用于DTE/DCE連接配接的幀格式。X.25的第一層定義了電氣和實體端口特性。

X.25網絡裝置分為資料終端裝置(DTE)、資料電路終端裝置(DCE)及分組交換裝置(PSE)。DTE是X.25的末端系統,如終端、計算機或網絡 主機,一般位于使用者端,Cisco路由器就是DTE裝置。DCE裝置是專用通信裝置,如數據機和分組交換機。PSE是公共網絡的主幹交換機。

X.25定義了資料通訊的電話網絡,每個配置設定給使用者的x.25 端口都具有一個x.121位址,當使用者申請到的是SVC(交換虛電路)時,x.25一端的使用者在通路另一端的使用者時,首先将呼叫對方x.121位址,然後 接收到呼叫的一端可以接受或拒絕,如果接受請求,于是連接配接建立實作資料傳輸,當沒有資料傳輸時挂斷連接配接,整個呼叫過程就類似我們撥打普通電話一樣,其不同 的是x.25可以實作一點對多點的連接配接。其中x.121位址、htc均必須與x.25服務提供商配置設定的參數相同。X.25 PVC(永久虛電路),沒有呼叫的過程,類似DDN專線。

2. 有關指令:

設定X.25封裝 encapsulation x25 [dce] 

設定X.121位址 x25 address x.121-address 

設定遠方站點的位址映射 x25 map protocol address [protocol2 address2[...[protocol9 address9]]] x121-address [option] 

設定最大的雙向虛電路數 x25 htc citcuit-number1 

設定一次連接配接可同時建立的虛電路數 x25 nvc count2 

設定x25在清除空閑虛電路前的等待周期 x25 idle minutes 

重新啟動x25,或清一個svc,啟動一個pvc相關參數 clear x25 {serial number | cmns-interface mac-address} [vc-number] 3 

清x25虛電路 clear x25-vc 

顯示接口及x25相關資訊 show interfaces serial show x25 interface show x25 map show x25 vc 

注:1、虛電路号從1到4095,Cisco路由器預設為1024,國内一般配置設定為16。 

2、虛電路計數從1到8,預設為1。 

3、在改變了x.25各層的相關參數後,應重新啟動x25(使用clear x25 {serial number | cmns-interface mac-address} [vc-number]或clear x25-vc指令),否則新設定的參數可能不能生效。同時應對照服務提供商對于x.25交換機端口的設定來配置路由器的相關參數,若出現參數不比對則可能 會導緻連接配接失敗或其它意外情況。 

3. 執行個體:

3.1. 在以下執行個體中每二個路由器間均通過svc實作連接配接。

路由器設定如下: 

encapsulation x25 

x25 address 110101 

x25 htc 16 

x25 nvc 2 

x25 map ip 192.200.10.2 110102 broadcast 

x25 map ip 192.200.10.3 110103 broadcast 

x25 address 110102 

x25 map ip 192.200.10.1 110101 broadcast 

Router: 

ip address 192.200.10.3 255.255.255.0 

x25 address 110103 

相關調試指令: 

clear x25-vc 

show interfaces serial 

show x25 map 

show x25 route 

show x25 vc 

3.2. 在以下執行個體中路由器router1和router2均通過svc與router連接配接,但router1和router2不通過svc直接連接配接,此三個路由 器的序列槽運作RIP路由協定,使用了子接口的概念。由于使用子接口,router1和router2均學習到了通路對方區域網路的路徑,若不使用子接 口,router1和router2将學不到到對方區域網路的路由。

子接口(Subinterface)是一個實體接口上的多個虛接口,可以用于在同一個實體接口上連接配接多個網。我們知道為了避免路由循環,路由器支援split horizon法則,它隻允許路由更新被配置設定到路由器的其它接口,而不會再配置設定路由更新回到此路由被接收的接口。

無論如何,在廣域網環境使用基于連接配接的接口(象 X.25和Frame Relay),同一接口通過虛電路(vc)連接配接多台遠端路由器時,從同一接口來的路由更新資訊不可以再被發回到相同的接口,除非強制使用分開的實體接口連 接不同的路由器。Cisco提供子接口(subinterface)作為分開的接口對待。你可以将路由器邏輯地連接配接到相同實體接口的不同子接口, 這樣來自不同子接口的路由更新就可以被配置設定到其他子接口,同時又滿足split horizon法則。

router rip 

network 192.200.10.0 

ip address 192.200.11.2 255.255.255.0 

x25 map ip 192.200.11.3 110103 broadcast 

network 192.200.11.0 

interface Serial0.1 point-to-point 

interface Serial0.2 point-to-point 

ip address 192.200.11.3 255.255.255.0 

x25 map ip 192.200.11.2 110102 broadcast 

幀中繼是一種高性能的WAN協定,它運作在OSI參考模型的實體層和資料鍊路層。它是一種資料包交換技術,是X.25的簡化版本。它省略了X.25的一些 強健功能,如提供視窗技術和資料重發技術,而是依靠高層協定提供糾錯功能,這是因為幀中繼工作在更好的WAN裝置上,這些裝置較之X.25的WAN裝置具 有更可靠的連接配接服務和更高的可靠性,它嚴格地對應于OSI參考模型的最低二層,而X.25還提供第三層的服務,是以,幀中繼比X.25具有更高的性能和更 有效的傳輸效率。 

幀中繼廣域網的裝置分為資料終端裝置(DTE)和資料電路終端裝置(DCE),Cisco路由器作為 DTE裝置。 

幀中繼技術提供面向連接配接的資料鍊路層的通信,在每對裝置之間都存在一條定義好的通信鍊路,且該鍊路有一個鍊路識别碼。這種服務通過幀中繼虛電路實作,每個 幀中繼虛電路都以資料鍊路識别碼(DLCI)辨別自己。DLCI的值一般由幀中繼服務提供商指定。幀中繼即支援PVC也支援SVC。 

幀中繼本地管理接口(LMI)是對基本的幀中繼标準的擴充。它是路由器和幀中繼交換機之間信令标準,提供幀中繼管理機制。它提供了許多管理複雜網際網路絡的特性,其中包括全局尋址、虛電路狀态消息和多目發送等功能。 

2. 有關指令: 

設定Frame Relay封裝 encapsulation frame-relay[ietf] 1

設定Frame Relay LMI類型 frame-relay lmi-type {ansi | cisco | q933a}2

設定子接口 interface interface-type interface-number.subinterface-number [multipoint|point-to-point] 

映射協定位址與DLCI frame-relay map protocol protocol-address dlci [broadcast]3

設定FR DLCI編号 frame-relay interface-dlci dlci [broadcast] 

注:1.若使Cisco路由器與其它廠家路由裝置相連,則使用Internet工程任務組(IETF)規定的幀中繼封裝格式。 

2.從Cisco IOS版本11.2開始,軟體支援本地管理接口(LMI)“自動感覺”, “自動感覺”使接口能确定交換機支援的LMI類型,使用者可以不明确配置LMI接口類型。 

3.broadcast選項允許在幀中繼網絡上傳輸路由廣播資訊。

3. 幀中繼point to point配置執行個體: 

interface serial 0 

encapsulation frame-relay 

interface serial 0.1 point-to-point 

ip address 172.16.1.1 255.255.255.0 

frame-reply interface-dlci 105 

interface serial 0.2 point-to-point 

ip address 172.16.2.1 255.255.255.0 

frame-reply interface-dlci 102 

interface serial 0.3 point-to-point 

ip address 172.16.4.1 255.255.255.0 

frame-reply interface-dlci 104 

ip address 172.16.2.2 255.255.255.0 

frame-reply interface-dlci 201 

ip address 172.16.3.1 255.255.255.0 

frame-reply interface-dlci 203 

show frame-relay lmi 

show frame-relay map 

show frame-relay pvc 

show frame-relay route 

go top 

4. 幀中繼 Multipoint 配置執行個體:

encapsulation frame-reply 

interface serial 0.1 multipoint 

ip address 172.16.1.2 255.255.255.0 

frame-reply map ip 172.16.1.1 201 broadcast 

frame-reply map ip 172.16.1.3 301 broadcast 

frame-reply map ip 172.16.1.4 401 broadcast 

frame-reply map ip 172.16.1.2 102 broadcast 

frame-reply map ip 172.16.1.3 102 broadcast 

frame-reply map ip 172.16.1.4 102 broadcast 

五、ISDN 

1. 綜合數字業務網(ISDN)

綜合數字業務網(ISDN)由數字電話和資料傳輸服務兩部分組成,一般由電話局提供這種服務。ISDN的基本速率接口(BRI)服務提供2個B信道和1個 D信道(2B+D)。BRI的B信道速率為64Kbps,用于傳輸使用者資料。D信道的速率為16Kbps,主要傳輸控制信号。在北美和日本,ISDN的主 速率接口(PRI)提供23個B信道和1個D信道,總速率可達1.544Mbps,其中D信道速率為64Kbps。而在歐洲、澳洲等國家,ISDN的 PRI提供30個B信道和1個64Kbps D信道,總速率可達2.048Mbps。我國電話局所提供ISDN PRI為30B+D。

2. 基本指令

設定ISDN交換類型 isdn switch-type switch-type1 

接口設定 interface bri 0 

設定PPP封裝 encapsulation ppp 

設定協定位址與電話号碼的映射 dialer map protocol next-hop-address [name hostname] [broadcast] [dial-string] 

啟動PPP多連接配接 ppp multilink 

設定啟動另一個B通道的門檻值 dialer load-threshold load 

顯示ISDN有關資訊 show isdn {active | history | memory | services | status [dsl | interface-type number] | timers} 

注:1.交換機類型如下表,國内交換機一般為basic-net3。 

按區域分關鍵字 交換機類型 

Australia 

basic-ts013 Australian TS013 switches 

Europe 

basic-1tr6 German 1TR6 ISDN switches 

basic-nwnet3 Norway NET3 switches (phase 1) 

basic-net3 NET3 ISDN switches (UK, Denmark, and other nations); covers the Euro-ISDN E-DSS1 signalling system 

primary-net5 NET5 switches (UK and Europe) 

vn2 French VN2 ISDN switches 

vn3 French VN3 ISDN switches 

Japan 

ntt Japanese NTT ISDN switches 

primary-ntt Japanese ISDN PRI switches 

North America 

basic-5ess AT&T basic rate switches 

basic-dms100 NT DMS-100 basic rate switches 

basic-ni1 National ISDN-1 switches 

primary-4ess AT&T 4ESS switch type for the U.S. (ISDN PRI only) 

primary-5ess AT&T 5ESS switch type for the U.S. (ISDN PRI only) 

primary-dms100 NT DMS-100 switch type for the U.S. (ISDN PRI only) 

New Zealand 

basic-nznet3 New Zealand Net3 switches 

3. ISDN實作DDR(dial-on-demand routing)執行個體:

Router1:

user router2 password cisco 

isdn switch-type basic-net3 

interface bri 0 

encapsulation ppp 

dialer map ip 192.200.10.2 name router2 572 

dialer load-threshold 80 

ppp multilink 

dialer-group 1 

! 

dialer-list 1 protocol ip permit 

user router1 password cisco 

dialer map ip 192.200.10.1 name router1 571 

Cisco路由器同時支援回撥功能,我們将路由器Router1作為Callback Server,Router2作為Callback Client。

與回撥相關指令: 

映射協定位址和電話号碼,并在接口上使用在全局模式下定義的PPP回撥的映射類别。 dialer map protocol address name hostname class classname dial-string 

設定接口支援PPP回撥 ppp callback accept 

在全局模式下為PPP回撥設定映射類别 map-class dialer classname 

通過查找注冊在dialer map裡的主機名來決定回撥. dialer callback-server [username] 

設定接口要求PPP回撥 ppp callback request 

dialer map ip 192.200.10.2 name router2 class s3 572 

ppp callback accept 

map-class dialer s3 

dialer callback-server username 

ppp callback request 

debug dialer 

debug isdn event 

debug isdn q921 

debug isdn q931 

debug ppp authentication 

debug ppp error 

debug ppp negotiation 

debug ppp packet 

show dialer 

show isdn status 

舉例:執行debug dialer指令觀察router2呼叫router1,router1回撥router2的過程. 

router1#debug dialer 

router2#ping 192.200.10.1 

router1# 

00:03:50: %LINK-3-UPDOWN: Interface BRI0:1, changed state to up 

00:03:50: BRI0:1:PPP callback Callback server starting to router2 572 

00:03:50: BRI0:1: disconnecting call 

00:03:50: %LINK-3-UPDOWN: Interface BRI0:1, changed state to down 

00:03:51: %LINK-3-UPDOWN: Interface BRI0:2, changed state to up 

00:03:52: callback to router2 already started 

00:03:52: BRI0:2: disconnecting call 

00:03:52: %LINK-3-UPDOWN: Interface BRI0:2, changed state to down 

00:04:05: : Callback timer expired 

00:04:05: BRI0:beginning callback to router2 572 

00:04:05: BRI0: Attempting to dial 572 

00:04:05: Freeing callback to router2 572 

00:04:05: %LINK-3-UPDOWN: Interface BRI0:1, changed state to up 

00:04:05: BRI0:1: No callback negotiated 

00:04:05: %LINK-3-UPDOWN: Interface Virtual-Access1, changed state to up 

00:04:05: dialer Protocol up for Vi1 

00:04:06: %LINEPROTO-5-UPDOWN: Line protocol on Interface BRI0:1, changed state 

to up 

00:04:06: %LINEPROTO-5-UPDOWN: Line protocol on Interface Virtual-Access1, chang 

ed state to up 

00:04:11: %ISDN-6-CONNECT: Interface BRI0:1 is now connected to 572 

#router1 

4. ISDN通路首都線上263網執行個體: 

本地局部網位址為10.0.0.0/24,屬于保留位址,通過NAT位址翻譯功能,區域網路使用者可以通過ISDN上263網通路Internet。263的ISDN電話号碼為2633,使用者為263,密碼為263,所涉及的指令如下表:

指定接口通過PPP/IPCP位址協商獲得IP位址 ip address negotiated 

使用ppp/pap作認證 ppp authentication pap callin 

指定接口屬于撥号組1 dialer-group 1 

定義撥号組1允許所有IP協定 dialer-list 1 protocol ip permit 

設定撥号,号碼為2633 dialer string 2633 

設定登入263的使用者名和密碼 ppp pap sent-username 263 password 263 

設定預設路由 ip route 0.0.0.0 0.0.0.0 bri 0 

設定符合通路清單2的所有源位址被翻譯為bri 0所擁有的位址 ip nat inside source list 2 interface bri 0 overload 

設定通路清單2,允許所有協定 access-list 2 permit any 

具體配置如下:

hostname Cisco2503 

ip subnet-zero 

no ip domain-lookup 

ip routing 

ip address 10.0.0.1 255.255.255.0 

no shutdown 

shutdown 

no description 

no ip address 

interface Serial 1 

ip address negotiated 

ppp authentication pap callin 

dialer hold-queue 10 

dialer string 2633 

dialer idle-timeout 120 

ppp pap sent-username 263 password 263 

no cdp enable 

no ip split-horizon 

ip classless 

! Static Routes 

ip route 0.0.0.0 0.0.0.0 bri 0 

! Access Control List 2 

access-list 2 permit any 

ip nat inside source list 2 interface bri 0 overload 

snmp-server community public ro 

5. Cisco765M通過ISDN撥号上263

由于Cisco765的設定指令與我們常用的Cisco路由器的指令不同,是以以下列舉了通過Cisco765上263通路Internet的具體指令行設定步驟。

>set system c765

c765> set multidestination on

c765> set switch net3

c765> set ppp multilink on

c765> cd lan

c765:LAN> set ip routing on

c765:LAN> set ip address 10.0.0.1

c765:LAN> set ip netmask 255.0.0.0

c765:LAN> set briding off

c765:LAN>cd

c765> set user remotenet

New user remotenet being created

c765:remotenet> set ip routing on

c765:remotenet> set bridging off

c765:remotenet> set ip framing none

c765:remotenet> set ppp clientname 263

c765:remotenet> set ppp password client

Enter new Password: 263

Re-Type new Password: 263

c765:remotenet> set ppp authentication out none

c765:remotenet> set ip address 0.0.0.0

c765:remotenet> set ip netmask 0.0.0.0

c765:remotenet> set ppp address negotiation local on

c765:remotenet> set ip pat on

c765:remotenet> set ip route destination 0.0.0.0/0 gateway 0.0.0.0

c765:remotenet> set number 2633

c765:remotenet> set active

設定路由器系統名稱 set system c765 

允許路由器呼叫多個目的地 set multidestination on 

設定ISDN交換機類型為NET3 set switch net3 

允許點到點間多條通道連接配接實作負載均衡 set ppp multilink on 

關掉橋接 set briding off 

建立使用者預制檔案用于設定撥接上網參數- 可以設定多個使用者預制檔案用于相同的實體端口對應于不同的連接配接。 set user remotenet 

使用PPP/IPCP set ip framing none 

設定上網使用者帳号 set ppp clientname 263 

設定上網密碼 set ppp password client Enter new Password: 263 Re-Type new Password: 263 

不用PPP/CHAP或PAP做認證 set ppp authentication out none 

允許位址磋商 set ppp address negotiation local on 

設定位址翻譯 set ip pat on 

設定預設路由 set ip route destination 0.0.0.0/0 gateway 0.0.0.0 

設定ISP的電話号碼 set number 2633 

激活使用者預制檔案 set active 

六、PSTN

電話網絡(PSTN)是目前普及程度最高、成本最低的公用通訊網絡,它在網絡互連中也有廣泛的應用。電話網絡的應用一般可分為兩種類型,一種是同等級别機構之間以按需撥号(DDR)的方式實作互連,一種是ISP為撥号上網為使用者提供的遠端通路服務的功能。

1. 遠端通路

1.1.Access Server基本設定:

選用Cisco2511作為通路伺服器,采用IP位址池動态配置設定位址.遠端工作站使用WIN95撥号網絡實作連接配接。 

全局設定:

設定使用者名和密碼 username username password password 

設定使用者的IP位址池 ip local pool {default | pool-name low-ip-address [high-ip-address]} 

指定位址池的工作方式 ip address-pool [dhcp-proxy-client | local] 

基本接口設定指令: 

設定封裝形式為PPP encapsulation ppp 

啟動異步口的路由功能 async default routing 

設定異步口的PPP工作方式 async mode {dedicated | interactive} 

設定使用者的IP位址 peer default ip address {ip-address | dhcp | pool [pool-name]} 

設定IP位址與Ethernet0相同 ip unnumbered ethernet0 

line撥号線設定: 

設定modem的工作方式 modem {inout|dialin} 

自動配置modem類型 modem autoconfig discovery 

設定撥号線的通訊速率 speed speed 

設定通訊線路的流控方式 flowcontrol {none | software [lock] [in | out] | hardware [in | out]} 

連通後自動執行指令 autocommand command 

通路伺服器設定如下:

enable secret 5 $1$EFqU$tYLJLrynNUKzE4bx6fmH// 

interface Ethernet0 

ip address 10.111.4.20 255.255.255.0 

interface Async1 

ip unnumbered Ethernet0 

keepalive 10 

async mode interactive 

peer default ip address pool Cisco2511-Group-142 

ip local pool Cisco2511-Group-142 10.111.4.21 10.111.4.36 

exec-timeout 0 0

password cisco

line 1 16 

modem InOut 

modem autoconfigure discovery 

flowcontrol hardware 

transport input all

show interface 

show line 

1.2. Access Server通過Tacacs伺服器實作安全認證:

使用一台WINDOWS NT伺服器作為Tacacs伺服器,位址為10.111.4.2,運作Cisco2511随機帶的Easy ACS 1.0軟體實作使用者認證功能.

相關設定:

激活AAA通路控制 aaa new-model 

使用者登入時預設起用Tacacs+做AAA認證 aaa authentication login default tacacs+ 

清單名為no_tacacs使用ENABLE密碼做認證 aaa authentication login no_tacacs enable 

在運作PPP的串行線上采用Tacacs+做認證 aaa authentication ppp default tacacs+ 

由TACACS+伺服器授權運作EXEC aaa authorization exec tacacs+ 

由TACACS+伺服器授權與網絡相關的服務請求。 aaa authorization network tacacs+ 

為EXEC會話運作記帳.程序開始和結束時發通告給TACACS+伺服器。 aaa accounting exec start-stop tacacs+ 

為與網絡相關的服務需求運作記帳包括SLIP,PPP,PPP NCPs,ARAP等.在程序開始和結束時發通告給TACACS+伺服器。 aaa accounting network start-stop tacacs+ 

指定Tacacs伺服器位址 tacacs-server host 10.111.4.2 

在Tacacs+伺服器和通路伺服器設定共享的關鍵字,通路伺服器和Tacacs+伺服器使用這個關鍵字去加密密碼和響應資訊。這裡使用tac作為關鍵字。 tacacs-server key tac 

hostname router

aaa new-model

aaa authentication login default tacacs+

aaa authentication login no_tacacs enable

aaa authentication ppp default tacacs+

aaa authorization exec tacacs+

aaa authorization network tacacs+

aaa accounting exec start-stop tacacs+

aaa accounting network start-stop tacacs+

enable secret 5 $1$kN4g$CvS4d2.rJzWntCnn/0hvE0

ip address 10.111.4.20 255.255.255.0

interface Serial0

interface Serial1

interface Group-Async1

ip unnumbered Ethernet0

encapsulation ppp

async mode interactive

peer default ip address pool Cisco2511-Group-142

no cdp enable

group-range 1 16

ip local pool Cisco2511-Group-142 10.111.4.21 10.111.4.36

tacacs-server host 10.111.4.2

tacacs-server key tac

login authentication no_tacacs 

line 1 16

login authentication tacacs

modem InOut

modem autoconfigure type usr_courier

autocommand ppp

stopbits 1

rxspeed 115200

txspeed 115200

flowcontrol hardware

2. DDR(dial-on-demand routing)執行個體

此例通過Cisco 2500系列路由器的aux端口實作異步撥号DDR連接配接。Router1撥接上網到Router2。其中采用PPP/CHAP做安全認證,在 Router1中應建立一個使用者,以對端路由器主機名作為使用者名,即使用者名應為Router2。同時在Router2中應建立一個使用者,以對端路由器主機 名作為使用者名,即使用者名應為Router1。所建的這兩使用者的password必須相同。 

相關指令如下: 

設定路由器與modem的接口指令 chat-script script-name EXPECT SEND EXPECT SEND (etc.) 

設定端口在挂斷前的等待時間 dialer idle-timeout seconds 

設定協定位址與電話号碼的映射 dialer map protocol next-hop-address [name hostname] [broadcast] [modem-script modem-regexp] [system-script system-regexp] [dial-string] 

設定電話号碼 dialer string dial-string 

指定在特定線路下路由器預設 使用的chat-script script {dialer|reset} script-name 

hostname Router1 

enable secret 5 $1$QKI7$wXjpFqC74vDAyKBUMallw/ 

username Router2 password cisco 

chat-script cisco-default "" "AT" TIMEOUT 30 OK "ATDT \T" TIMEOUT 30 CONNECT \c 

async default routing 

async mode dedicated 

dialer in-band 

dialer idle-timeout 60 

dialer map ip 192.200.10.2 name Router2 modem-script cisco-default 573 

ip route 10.0.1.0 255.255.255.0 192.200.10.2 

line con 0 

line aux 0 

hostname Router2 

enable secret 5 $1$F6EV$5U8puzNt2/o9g.t56PXHo. 

username Router1 password cisco 

ip address 10.0.1.1 255.255.255.0 

dialer map ip 192.200.10.1 name Router1 

ip route 10.0.0.0 255.255.255.0 192.200.10.1 

3. 異步撥号備份DDN專線:

此例主連接配接采用DDN專線,備份線路為電話撥号。當DDN專線連接配接正常時,主端口S0狀态為up,line protocol亦為up,則備份線路狀态為standby,line protocol為down,此時所有通信均通過主接口進行。當主接口連接配接發生故障時,端口狀态為down,則激活備份接口,完成資料通信。此方法不适合 為X.25做備份。因為,配置封裝為X.25的接口隻要和X.25交換機之間的連接配接正常其接口及line protocol的狀态亦為 up,它并不考慮其它地方需與之通信的路由器的狀态如何,是以若本地路由器狀态正常,而對方路由器連接配接即使發生故障,本地也不會激活備份線路。例4将會描 述如何為X.25做撥号備份。

以下是相關指令: 

指定主線路改變後,次線路狀态發生改變的延遲時間 backup delay {enable-delay | never} {disable-delay | never} 

指定一個接口作為備份接口 backup interface type number 

hostname c2522rb

enable secret 5 $1$J5vn$ceYDe2FwPhrZi6qsIIz6g0

enable password cisco

username c4700 password 0 cisco

chat-script cisco-default "" "AT" TIMEOUT 30 OK "ATDT \T" TIMEOUT 30 CONNECT \c

chat-script reset atz

ip address 16.122.51.254 255.255.255.0

backup delay 10 10

backup interface Serial2

ip address 16.250.123.18 255.255.255.252

no fair-queue

interface Serial2

physical-layer async

ip address 16.249.123.18 255.255.255.252

async mode dedicated

dialer in-band

dialer idle-timeout 60

dialer map ip 16.249.123.17 name c4700 6825179

dialer-group 1

interface Serial3

interface Serial4

interface Serial5

interface Serial6

interface Serial7

interface Serial8

interface Serial9

interface BRI0

router eigrp 200

network 16.0.0.0

ip classless

dialer-list 1 protocol ip permit

line 2

script dialer cisco-default

script reset reset

modem autoconfigure discovery

rxspeed 38400

txspeed 38400

c2522rb#

4. 異步撥号備份X.25:

設定X.25的撥号備份,首先X.25連接配接的端口必須運作動态路由協定,異步撥号口必須使用靜态路由.本例選擇EIGRP作為路由選擇協定,将靜态路由的 Metric的值設定為200,由于EIGRP的預設Metric為90,是以當同時有兩條路徑通往同一網段時,其中Metric值小的路徑生效,而當 X.25連接配接出現問題時,路由器無法通過路由協定學習到路由表,則此時靜态路由生效,通路通過撥号端口實作。當X.25連接配接恢複正常時,路由器又可以學習 到路由表,則由于 Metric值的不同,靜态路由自動被動态路由所代替,這樣就實作了備份的功能。

路由器Router1配置如下:

hostname router1

enable secret 5 $1$UTvD$99YiY2XsRMxHudcYeHn.Y.

username router2 password cisco

ip address 202.96.38.100 255.255.255.0

ip address 202.96.0.1 255.255.255.0

encapsulation x25

x25 address 10112227

x25 htc 16

x25 map ip 202.96.0.2 10112225 broadcast

interface Async 1

ip address 202.96.1.1 255.255.255.252

dialer map ip 202.96.1.2 name router2 modem-script cisco-default 2113470

redistribute connected

network 202.96.0.0

ip route 202.96.37.0 255.255.255.0 202.96.1.2 200

路由器Router2配置如下:

hostname router2

enable secret 5 $1$T4IU$2cIqak8f/E4Ug6dLT0k.J0

username router1 password cisco

ip address 202.96.37.100 255.255.255.0

ip address 202.96.0.2 255.255.255.0

x25 address 10112225

x25 map ip 202.96.0.1 10112227 broadcast

interface Async1

ip address 202.96.1.2 255.255.255.252

keepalive 30

async default routing

dialer wait-for-carrier-time 120

dialer map ip 202.96.1.1 name router1 modem-script cisco-default 2113469

redistribute static

ip route 202.96.38.0 255.255.255.0 202.96.1.1 200

路由協定:

一、RIP協定 

RIP(Routing information Protocol)是應用較早、使用較普遍的内部網關協定(Interior Gateway Protocol,簡稱IGP),适用于小型同類網絡,是典型的距離向量(distance-vector)協定。文檔見RFC1058、 RFC1723。 

RIP通過廣播UDP封包來交換路由資訊,每30秒發送一次路由資訊更新。RIP提供跳躍計數(hop count)作為尺度來衡量路由距離,跳躍計數是一個包到達目标所必須經過的路由器的數目。如果到相同目标有二個不等速或不同帶寬的路由器,但跳躍計數相 同,則RIP認為兩個路由是等距離的。RIP最多支援的跳數為15,即在源和目的網間所要經過的最多路由器的數目為15,跳數16表示不可達。

指定使用RIP協定 router rip 

指定RIP版本 version {1|2}1 

指定與該路由器相連的網絡 network network 

注:1.Cisco的RIP版本2支援驗證、密鑰管理、路由彙總、無類域間路由(CIDR)和變長子網路遮罩(VLSMs) 

version 2 

network 192.20.10.0 

show ip protocol 

show ip route

二、IGRP協定 

IGRP (Interior Gateway Routing Protocol)是一種動态距離向量路由協定,它由Cisco公司八十年代中期設計。使用組合使用者配置尺度,包括延遲、帶寬、可靠性和負載。 

預設情況下,IGRP每90秒發送一次路由更新廣播,在3個更新周期内(即270秒),沒有從路由中的第一個路由器接收到更新,則宣布路由不可通路。在7個更新周期即630秒後,Cisco IOS 軟體從路由表中清除路由。 

1. 有關指令 

指定使用RIP協定 router igrp autonomous-system1 

指定與該路由器相鄰的節點位址 neighbor ip-address 

注:1、autonomous-system可以随意建立,并非實際意義上的autonomous-system,但運作IGRP的路由器要想交換路由更新資訊其autonomous-system需相同。

2.舉例

router igrp 200 

三、OSPF協定 

OSPF(Open Shortest Path First)是一個内部網關協定(Interior Gateway Protocol,簡稱IGP),用于在單一自治系統(autonomous system,AS)内決策路由。與RIP相對,OSPF是鍊路狀态路有協定,而RIP是距離向量路由協定。 

鍊路是路由器接口的另一種說法,是以OSPF也稱為接口狀态路由協定。OSPF通過路由器之間通告網絡接口的狀态來建立鍊路狀态資料庫,生成最短路徑樹,每個OSPF路由器使用這些最短路徑構造路由表。 

文檔見RFC2178。 

1.有關指令 

全局設定 

指定使用OSPF協定 router ospf process-id1 

指定與該路由器相連的網絡 network address wildcard-mask area area-id2 

注:1、OSPF路由程序process-id必須指定範圍在1-65535,多個OSPF程序可以在同一個路由器上配置,但最好不這樣做。多個OSPF 程序需要多個OSPF資料庫的副本,必須運作多個最短路徑算法的副本。process-id隻在路由器内部起作用,不同路由器的process-id可以 不同。 

2、wildcard-mask 是子網路遮罩的反碼, 網絡區域ID area-id在0-4294967295内的十進制數,也可以是帶有IP位址格式的x.x.x.x。當網絡區域ID為0或0.0.0.0時為主幹域。不同網絡區域的路由器通過主幹域學習路由資訊。

2.基本配置舉例:

interface ethernet 0 

ip address 192.1.0.129 255.255.255.192 

ip address 192.200.10.5 255.255.255.252 

router ospf 100 

network 192.200.10.4 0.0.0.3 area 0 

network 192.1.0.128 0.0.0.63 area 1 

ip address 192.1.0.65 255.255.255.192 

ip address 192.200.10.6 255.255.255.252 

router ospf 200 

network 192.1.0.64 0.0.0.63 area 2 

ip address 192.1.0.130 255.255.255.192 

router ospf 300 

Router4: 

ip address 192.1.0.66 255.255.255.192 

router ospf 400 

network 192.1.0.64 0.0.0.63 area 1 

debug ip ospf events 

debug ip ospf packet 

show ip ospf 

show ip ospf database 

show ip ospf interface 

show ip ospf neighbor 

show ip route 

3. 使用身份驗證 

為了安全的原因,我們可以在相同OSPF區域的路由器上啟用身份驗證的功能,隻有經過身份驗證的同一區域的路由器才能互相通告路由資訊。 

在預設情況下OSPF不使用區域驗證。通過兩種方法可啟用身份驗證功能,純文字身份驗證和消息摘要(md5)身份驗證。純文字身份驗證傳送的身份驗證密碼 為純文字,它會被網絡探測器确定,是以不安全,不建議使用。而消息摘要(md5)身份驗證在傳輸身份驗證密碼前,要對密碼進行加密,是以一般建議使用此種 方法進行身份驗證。 

使用身份驗證時,區域内所有的路由器接口必須使用相同的身份驗證方法。為起用身份驗證,必須在路由器接口配置模式下,為區域的每個路由器接口配置密碼。 

指定身份驗證 area area-id authentication [message-digest] 

使用純文字身份驗證 ip ospf authentication-key password 

使用消息摘要(md5)身份驗證 ip ospf message-digest-key keyid md5 key 

以下列舉兩種驗證設定的示例,示例的網絡分布及位址配置設定環境與以上基本配置舉例相同,隻是在Router1和Router2的區域0上使用了身份驗證的功能。:

例1.使用純文字身份驗證 

ip ospf authentication-key cisco 

area 0 authentication 

例2.消息摘要(md5)身份驗證: 

ip ospf message-digest-key 1 md5 cisco 

area 0 authentication message-digest 

debug ip ospf adj 

四、重新配置設定路由 

在實際工作中,我們會遇到使用多個IP路由協定的網絡。為了使整個網絡正常地工作,必須在多個路由協定之間進行成功的路由再配置設定。

以下列舉了OSPF與RIP之間重新配置設定路由的設定範例: 

Router1的Serial 0端口和Router2的Serial 0端口運作OSPF,在Router1的Ethernet 0端口運作RIP 2,Router3運作RIP2,Router2有指向Router4的192.168.2.0/24網的靜态路由,Router4使用預設靜态路由。需 要在Router1和Router3之間重新配置設定OSPF和RIP路由,在Router2上重新配置設定靜态路由和直連的路由。 

範例所涉及的指令 

重新配置設定直連的路由 redistribute connected 

重新配置設定靜态路由 redistribute static 

重新配置設定ospf路由 redistribute ospf process-id metric metric-value 

重新配置設定rip路由 redistribute rip metric metric-value 

ip address 192.168.1.1 255.255.255.0 

redistribute rip metric 10 

redistribute ospf 100 metric 1 

network 192.168.1.0 

interface loopback 1 

ip address 192.168.3.2 255.255.255.0 

ip address 192.168.0.2 255.255.255.0 

redistribute connected subnet 

redistribute static subnet 

ip route 192.168.2.0 255.255.255.0 192.168.0.1 

ip address 192.168.1.2 255.255.255.0 

ip address 192.168.0.1 255.255.255.0 

interface ethernet 1 

ip address 192.168.2.1 255.255.255.0 

ip route 0.0.0.0 0.0.0.0 192.168.0.2 

五、IPX協定設定 

IPX協定與IP協定是兩種不同的網絡層協定,它們的路由協定也不一樣,IPX的路由協定不象IP的路由協定那樣豐富,是以設定起來比較簡單。但IPX協定在以太網上運作時必須指定封裝形式。 

1. 有關指令 

設定IPX網絡及以太網封裝形式 ipx network network [encapsulation encapsulation-type]1 

指定路由協定,預設為RIP ipx router {eigrp autonomous-system-number | nlsp [tag] | rip} 

注:1.network 範圍是1 到FFFFFFFD. 

IPX封裝類型清單 

接口類型 封裝類型 IPX幀類型 

Ethernet novell-ether (預設) arpa sap snap Ethernet_802.3 Ethernet_II Ethernet_802.2 Ethernet_Snap 

Token Ring sap (預設) snap Token-Ring Token-Ring_Snap 

FDDI snap (預設) sap novell-fddi Fddi_Snap Fddi_802.2 Fddi_Raw 

舉例:

在此例中,WAN的IPX網絡為3a00,Router1所連接配接的區域網路IPX網絡号為2a00,在此區域網路有一台Novell伺服器,IPX網絡号也是 2a00, 路由器接口的IPX網絡号必須與在同一網絡的Novell伺服器上設定的IPX網絡号相同。路由器通過監聽SAP來建立已知的服務及自己的網絡位址表,并 每60秒發送一次自己的SAP表。

ipx routing 

ipx network 2a00 encapsulation sap 

ipx network 3a00 

ipx router eigrp 10 

network 3a00 

network 2a00 

ipx network 2b00 encapsulation sap 

network 2b00 

debug ipx packet 

debug ipx routing 

debug ipx sap 

debug ipx spoof 

debug ipx spx 

show ipx eigrp interfaces 

show ipx eigrp neighbors 

show ipx eigrp topology 

show ipx interface 

show ipx route 

show ipx servers 

show ipx spx-spoof 

4、、、章 服務品質及通路控制

一、協定優先級設定 

設定優先級表項目 priority-list list-number protocol protocol {high | medium | normal | low} queue-keyword keyword-value 

使用指定的優先級表 priority-group list-number 

2.舉例 

priority-list 1 protocol ip high tcp telnet 

priority-list 1 protocol ip low tcp ftp 

priority-list 1 default normal 

priority-group 1

二、隊列定制 

設定隊清單中包含協定 queue-list list-number protocol protocol-name queue-number queue-keyword keyword-value 

設定隊清單中隊列的大小 queue-list list-number queue queue-number byte-count byte-count-number 

使用指定的隊清單 custom-queue-list list 

queue-list 1 protocol ip 0 tcp telnet 

queue-list 1 protocol ip 1 tcp www 

queue-list 1 protocol ip 2 tcp ftp 

queue-list 1 queue 0 byte-count 300 

queue-list 1 queue 1 byte-count 200 

queue-list 1 queue 2 byte-count 100 

custom-queue-list 1

三、通路控制 

設定通路表項目 access-list list {permit | deny} address mask 

使用指定的通路表 ip access-group list {in | out} 

access-list 1 deny 192.1.3.0 0.0.0.255 

access-list 1 permit any 

ip access-group 1 in

虛拟區域網路(VLAN)路由 

一、虛拟區域網路(VLAN)

目前在我們構造企業網絡時所采用的主幹網絡技術一般都是基于交換和虛拟網絡的。交換技術将共享媒體改為獨占媒體,大大提高網絡速度。虛拟網絡技術打破了地 理環境的制約,在不改動網絡實體連接配接的情況下可以任意将工作站在工作組或子網之間移動,工作站組成邏輯工作組或虛拟子網,提高資訊系統的運作性能,均衡網 絡資料流量,合理利用硬體及資訊資源。同時,利用虛拟網絡技術,大大減輕了網絡管理和維護工作的負擔,降低網絡維護費用。随着虛拟網絡技術的應用,随之必 然産生了在虛拟網間如何通訊的問題.

二、交換機間鍊路(ISL)協定

ISL(Interior Switching Link)協定用于實作交換機間的VLAN中繼。它是一個資訊包标記協定,在支援ISL接口上發送的幀由一個标準以太網幀及相關的VLAN資訊組成。如下圖所示,在支援ISL的接口上可以傳送來自不同VLAN的資料。

三、虛拟區域網路(VLAN)路由執行個體

3.1. 例一:

裝置選用Catalyst5500交換機1台,安裝WS-X5530-E3管理引擎,多塊WS-X5225R及WS-X5302路由交換子產品,WS- X5302被直接插入交換機,通過二個通道與系統背闆上的VLAN 相連,從使用者角度看認為它是1個1接口的子產品,此接口支援ISL。在交換機内劃有3個虛拟網,分别名為default、qbw、rgw,通過WS- X5302實作虛拟網間路由。 

以下加重下橫線部分,如set system name 5500C為需設定的指令。

Catalyst 5500配置:

begin

set password $1$FMFQ$HfZR5DUszVHIRhrz4h6V70

set enablepass $1$FMFQ$HfZR5DUszVHIRhrz4h6V70

set prompt Console>

set length 24 default

set logout 20

set banner motd ^C^C

#system

set system baud 9600

set system modem disable

set system name 5500C 

set system location

set system contact 

#ip

set interface sc0 1 10.230.4.240 255.255.255.0 10.230.4.255 

set interface sc0 up

set interface sl0 0.0.0.0 0.0.0.0

set interface sl0 up

set arp agingtime 1200

set ip redirect enable

set ip unreachable enable

set ip fragmentation enable

set ip route 0.0.0.0 10.230.4.15 1 

set ip alias default 0.0.0.0

#Command alias

#vtp

set vtp domain hne 

set vtp mode server 

set vtp v2 disable

set vtp pruning disable

set vtp pruneeligible 2-1000

clear vtp pruneeligible 1001-1005

set vlan 1 name default type ethernet mtu 1500 said 100001 state active 

set vlan 777 name rgw type ethernet mtu 1500 said 100777 state active 

set vlan 888 name qbw type ethernet mtu 1500 said 100888 state active 

set vlan 1002 name fddi-default type fddi mtu 1500 said 101002 state active

set vlan 1004 name fddinet-default type fddinet mtu 1500 said 101004 state active bridge 0x0 stp ieee

set vlan 1005 name trnet-default type trbrf mtu 1500 said 101005 state active bridge 0x0 stp ibm

set vlan 1003 name token-ring-default type trcrf mtu 1500 said 101003 state active parent 0 ring 0x0 mode srb aremaxhop 7 stemaxhop 7

#set boot command

set boot config-register 0x102

set boot system flash bootflash:cat5000-sup3.4-3-1a.bin

#module 1 : 2-port 1000BaseLX Supervisor

set module name 1 

set vlan 1 1/1-2

set port enable 1/1-2

#module 2 : empty

#module 3 : 24-port 10/100BaseTX Ethernet

set module name 3 

set module enable 3

set vlan 1 3/1-22 

set vlan 777 3/23 

set vlan 888 3/24 

set trunk 3/1 on isl 1-1005 

#module 4 empty

#module 5 empty

#module 6 : 1-port Route Switch

set module name 6 

set port level 6/1 normal

set port trap 6/1 disable

set port name 6/1

set cdp enable 6/1

set cdp interval 6/1 60

set trunk 6/1 on isl 1-1005 

#module 7 : 24-port 10/100BaseTX Ethernet

set module name 7 

set module enable 7

set vlan 1 7/1-22 

set vlan 888 7/23-24 

set trunk 7/1 on isl 1-1005 

set trunk 7/2 on isl 1-1005 

#module 8 empty

#module 9 empty

#module 10 : 12-port 100BaseFX MM Ethernet

set module name 10 

set module enable 10

set vlan 1 10/1-12

set port channel 10/1-4 off

set port channel 10/5-8 off

set port channel 10/9-12 off

set port channel 10/1-2 on

set port channel 10/3-4 on

set port channel 10/5-6 on

set port channel 10/7-8 on

set port channel 10/9-10 on

set port channel 10/11-12 on

#module 11 empty

#module 12 empty

#module 13 empty

#switch port analyzer

!set span 1 1/1 both inpkts disable

set span disable

#cam

set cam agingtime 1-2,777,888,1003,1005 300

5500C> (enable)

WS-X5302路由子產品設定:

Router#wri t

no service password-encryption

hostname Router

enable secret 5 $1$w1kK$AJK69fGOD7BqKhKcSNBf6.

interface Vlan1 

ip address 10.230.2.56 255.255.255.0 

interface Vlan777 

ip address 10.230.3.56 255.255.255.0 

interface Vlan888 

ip address 10.230.4.56 255.255.255.0 

password router

Router#

3.1. 例二:

交換裝置仍選用Catalyst5500交換機1台,安裝WS-X5530-E3管理引擎,多塊WS-X5225R在交換機内劃有3個虛拟網,分别名為default、qbw、rgw,通過Cisco3640路由器實作虛拟網間路由。交換機設定與例一類似。

路由器Cisco3640,配有一塊NM-1FE-TX子產品,此子產品帶有一個快速以太網接口可以支援ISL。Cisco3640快速以太網接口與交換機上的某一支援ISL的端口實作連接配接,如交換機第3槽第1個接口(3/1口)。

Building configuration... 

interface FastEthernet1/0

interface FastEthernet1/0.1 

encapsulation isl 1 

interface FastEthernet1/0.2 

encapsulation isl 777 

interface FastEthernet1/0.3 

encapsulation isl 888 

參考參考: 

1、Cisco路由器密碼恢複 

當Cisco路由器的密碼被錯誤修改或忘記時,可以按如下步驟進行操作:

1. 開機時按<Ctrl+Break>使進入ROM監控狀态

2. 按o 指令讀取配置寄存器的原始值

> o 一般值為0x2102

3. 作如下設定,使忽略NVRAM引導

>o/r0x**4* Cisco2500系列指令 

rommon 1 >confreg 0x**4* Cisco2600、1600系列指令

一般正常值為0x2102 

4. 重新啟動路由器

>I 

rommon 2 >reset 

5. 在“Setup”模式,對所有問題回答No

6. 進入特權模式

Router>enable

7. 下載下傳NVRAM

Router>configure memory 

8. 恢複原始配置寄存器值并激活所有端口

“hostname”#configure terminal

“hostname”(config)#config-register 0x“value”

“hostname”(config)#interface xx 

“hostname”(config)#no shutdown 

9. 查詢并記錄丢失的密碼

“hostname”#show configuration (show startup-config)

10. 修改密碼

“hostname”#configure terminal 

“hostname”(config)line console 0

“hostname”(config-line)#login

“hostname”(config-line)#password xxxxxxxxx

“hostname”(config-line)#<ctrl+z>

“hostname”(config-line)#write memory(copy running-config startup-config) 

2、IP位址配置設定 

位址類 網絡主機 網絡位址範圍 标準二進制掩碼

A N.H.H.H 1-126 1111 1111 0000 0000 0000 0000 0000 0000

B N.N.H.H 128-191 1111 1111 1111 1111 0000 0000 0000 0000

C N.N.N.H 192-223 1111 1111 1111 1111 1111 1111 0000 0000

子網位個數 子網路遮罩 子網數 主機數

B類位址 

2 255.255.192.0 2 16382

3 255.255.224.0 6 8198

4 255.255.240.0 14 4894

5 255.255.248.0 30 2846

6 255.255.252.0 62 1822

7 255.255.254.0 126 518

8 255.255.255.0 254 254

9 255.255.255.128 518 126

10 255.255.255.192 1822 62

11 255.255.255.224 2846 30

12 255.255.255.240 4894 14

13 255.255.255.248 8198 6

14 255.255.255.252 16382 2

C類位址 

2 255.255.255.192 2 62

3 255.255.255.224 6 30

4 255.255.255.240 14 14

5 255.255.255.248 30 6

6 255.255.255.252 62 2

繼續閱讀