CISCO配置命令大全

路由器的基本配置
  1 網(Ethernet 口:
  # conf t
  從終端配置路由器。
  # int e0
  指定E0口。
  # ip addr ABCD XXXX
  ABCD爲以太網地址,XXXX爲子網掩碼。
  # ip addr ABCD XXXX secondary
  E0口同時支持兩個地址類型。如果第一個
  爲A類地址,則第二個爲BC類地址。
  # no shutdown
  激活E0口。
  # exit
  2X.25的配置
  # conf t
  # int S0
  指定S0.
  # ip addr ABCD XXXX
  ABCD爲以太網S0IP地址,XXXX爲子網掩碼.
  # encap X25-ABC
  封裝X.25協議。ABC指定X.25DTCDCE操作,缺省爲DTE
  # x25 addr ABCD
  ABCDS0X.25端口地址,由郵電局提供。
  # x25 map ip ABCD XXXX br
  映射的X.25地址.ABCD爲對方路由器(:S0)
  IP地址,XXXX爲對方路由器(:S0)X.25端口地址。
  # x25 htc X
  配置最高雙向通道數.X的取值範圍1-4095,
  要根據郵電局實際提供的數字配置。
  # x25 nvc X
  配置虛電路數。X不可超過據郵電局實際
  提供的數,否則,將影響數據的正常傳輸。
  # exit
  ---- 3 置:
  # conf t
  # int S2
  指定S2口。
  # ip addr ABCD XXXX
  ABCDS2IP地址,XXXX爲子網掩碼。
  # exit
  4.幀中繼的配置
  # conf t
  # int s0
  # ip addr ABCD XXXX
  ABCDS0IP地址,XXXX爲子網掩碼。
  # encap frante_relay
  封裝frante_relay協議。
  # no nrzi_encoding
  NRZI=NO
  # frame_relay lmi_type q933a
  LMI使用Q933A標準.LMILocal management Interface)有3種:ANSIT1.617CCITTYQ933ACISCO特有的標準。
  # fram-relay intf-typ ABC
  ABC爲幀中繼設備類型,它們分別是DTE設備,DCE交換機或NNI(網絡接點接口)支持。
  # frame_relay interface_dlci 110 br
  配置DLCI(數據鏈路連接標識符)
  # frame-relay map ip ABCD XXXX broadcast
  建立幀中繼映射。ABCD爲對方ip地址,XXXX爲本地DLCI號,broadcast允許廣播向前轉發或更新路由。
  # no shutdown
  激活本端口.
  # exit
  ---- 5 置:
  # conf t
  # int s0.1 point-to-point
  對應S0的子接口1,點對點方式。
  # ip addr ABCD XXXX
  ABCD爲子口1IP地址,XXXX爲子網掩碼。
  # frame-relay intreface-dlci 100 br
  6.配置撥號備份
  (1).配置備份主口
  # conf t
  # int s0
  S0爲主口.
  # backup int asy 1
  A1口爲備份口.
  # backup delay 0 1
  延時1秒.
  (2).配置虛擬接口
  # conf t
  # ip addr ABCD XXXX
  ABCD爲虛擬接口IP地址,XXXX爲子網掩碼。
  # encap ppp
  封裝ppp協議.
  # dialer in-band
  激活隨叫隨撥功能.
  # dialer idle-timeout 7200
  # dialer map ip ABCD modem-script call broadcast 6225481 br 映射對應的撥號口.
  ABCD爲對方撥號口的ip地址,6225481爲對應的電話號碼。
  # dialer_group 1 定義撥號組成員.
  (3).配置防火牆
  # dialer_list 1 pro ip permit
  允許ip協議通過。
  (4).配置連接口令
  # user name ABCD pass XXXX
  ABCD爲對方主機名,XXXX爲連接口令.
  (5).配置撥號字符串
  # conf t
  # chat-script call ABORT BUSY ABORT ERROR"" atdt 6335481 TIMEOUT 45 "CONNECT"
  6335481爲對方電話號碼。
  (6).配置撥號連接密碼
  # conf t
  # username ROU1 pass XXXX
  ROU1爲對方路由器名,XXXX爲連接密碼。
  (7).配置線路
  # conf t
  # line aux 0
  # modem inout
  MODEM雙向傳輸。
  # modem autoconfigure discovery
  # transport input all
  # rxspeed 51200
  MODEM的收發速率爲51200
  # exit
  7.配置同步/異步口 (適用於2522
  # conf t
  # int s2
  # ph asyn
  配置S2爲異步口.
  # ph sync
  配置S2爲同步口.
  8.動態路由的配置
  # conf t
  # router eigrp 20
  使用EIGRP路由協議。常用的路由協議有RIPIGRPIS-IS等。
  # passive-interface serial0
  若S0X.25相連,則輸入本條指令。
  # passive-interface serial1
  若S1X.25相連,則輸入本條指令。
  # network ABCD
  ABCD爲本機的以太網地址。
  # network XXXX
  XXXXS0ip地址。
  # no auto-summary
  # exit
  9.靜態路由的配置
  # ip router ABCD XXXX YYYY 90
  ABCD爲對方路由器的以太網地址;XXXX爲子網掩碼.YYYY爲對方對應的廣域網端口地址。
  # dialer-list 1 protocol ip permail
  10.備份配置文件到硬盤
  # copy run tftp
  在硬盤上建立一個空文件且有讀寫權限,才能備份成功.
  11.恢復備份配置文件到路由器
  # copy tftp run
  12.在路由器上建一個備份
  # copy run start
  路由器的配置參數較多,可根據實際需要增減,
  限於篇幅,本文僅給出了一般的常用配置。
  ---- 調
   ---- 1. Ethernet 使 活, 口, No Shutdown
   ---- 2. 由( Ethernet 址), UNIX 行:router add defaule XXXX 1XXXX E0 址)。 由, 則, 訊。
   ---- 3. Ping Ethernet 口( 通:(1Ethetnet 活(2 上)、 口( 通: 由), 口( 通: 誤)、 Ethernet 口( 通: 誤)、 Ethernet 口( 通: 由)。
   ---- 4. (X.25) 關( 由), UNIX 行:router add X.X.X.X Y.Y.Y.Y 1 X.X.X.X Ethernet 址;Y.Y.Y.Y 址。
   ---- 5. 使 Tracert 蹤, 段。
  WAN的配置
  1 配置DDR
  Dial-on-demand routing(DDR)是用公共電話網提供了網絡連接.通常的,廣域網大多數用專線連接的,路由器連接到類似modemISDN TAs的數據終端DCE設備上,它們支持同步V.25bis協議,你可以用scriptsdialer命令設定撥號串.DDR比較適用於用戶對數率要求 不高,偶爾有數據傳輸或只是在特定時候傳輸數據,比如銀行每晚傳送報表等等情況下.當一個感興趣的包到達路由器時,產生一個DDR請求.路由器發送呼叫建 立信息給指定的串口的DCE設備.這個呼叫就把本地和遠程的設備連接起來.一旦沒有數據傳輸,空閒時間開始計時,超過設置的空閒時間,這一次連接終 .DDR現在都用靜態路由來傳輸數據包,避免路由交換引起的DDR撥號.AppleTalk,Banyan VINES, CLNS, DECnet, IP, IPX, XNS可以通過DDR路由尋址.同步串口,異步串口和ISDN端口可以配置成到一個或多個目的地DDR連接.在配置DDR過程中,我們可以把一個或幾個 物理接口配置成一個邏輯撥號接口,它可以是同步V.25方式,同步DTR啓動撥號或異步chat script方式.在端口配置模式下:
  
  功能命令
  在一個端口上激活 Dial-on-demand routing dialer in-band
  指定一個端口爲撥號訪問組 dialer-group group-number
  指定一個單一電話號碼 dialer string dial-string
  斷線前空閒等待時間 dialer idle-time seconds
  定義一個或多個目的電話號碼錶 dialer map protocol net-hop-address dialer-string
  限定傳輸的access-list表或特定協議 dialer-list dialer-group list access-list-number
  或 dialer-list dialer-group protocol protocol-name {permit|deny|list acce ss-list-number}
  其中dialer stringdialer map兩條命令任選一,dialer string是在只有一個電話號碼時用,dialer map是一個電話號碼錶
 
 
配置撥號備份
  撥號備份提供了一種保護,使得當廣域網上主幹線出現故障時,啓動一條備份線路,使通信正常運轉.
  啓動備份有兩種情況:
  主幹線斷掉
  傳輸流量超過了定義的最大值
  需作的定義如下:
  在主幹線路端口上設置它的備份端口 backup interface interface-name
  定義備份負載 backup load {enable-threshold | never} {disable-load |never}
  定義主幹線updown的響應時間 backup delay {enable-delay | never) {disable-delay | never}
  其中: enable-threshold --- 表示主幹線超過總傳輸量的百分比,啓動備份線路
  disable-load --- 表示傳輸量減少百分之多少就斷開備份線路.
  enable-delay --- 表示主幹線斷開多長時間後,啓動備份線路.
  disable-delay --- 表示主幹線又重新恢復多長時間後,斷開備份線路.
  2 配置幀中繼
  幀中繼是一種由ANSICCITT標準化的協議,它能爲現今突發性業務流量(LAN互連及SNA業務)提供顯著的性能價格優勢.幀中繼是客戶端設 (CPE),諸如路由器或前端處理器,和一個向遠程CPE發送數據的廣域網之間的一種接口協議.它有以下幾個特點:低時延,時延是指一個給定待發送幀穿 過網絡到達遠程用戶設備所用的時間.當網絡時延增大時,性能會下降;尤其對於敏感協議(SNADECnet),所有幀被髮送後必須等待應答的協議( Novell IPX),以及利用短交易式的應用.可靠性,在給定時延條件下,吞吐量隨着網絡的可靠性變化而變化,可靠性好,超時等待重發幀越少,吞吐量就會大大增加. 更低的聯網開銷可預測性在許多網絡環境中,SNA CICS,不僅要求時延低,而且需要可預測性.公平性。Ciscos Frame Relay目前支持IP,DECnet,AppleTalk, Xerox Network Service(XNS), Novell IPX, International Organization for Standards (ISO) Connectionless Network Service (CLNS), Banyan VINES, transparent bridging在幀中繼中傳輸.
  配置幀中繼的工作表:
  在一個端口上作幀中繼打包
  定義動態或靜態的地址映射
  定義LMI
  配置幀中繼交換虛電路
  幀中繼交換
  監控幀中繼連接
  在一個端口上作幀中繼打包
  某一端口上配置幀中繼打包走幀中繼協議,global配置模式下:
  功
  指定走幀中繼的端口並進入端口配置模式 interface serial number
  指定幀中繼打包方式 encapsulation frame-relay [ietf]
  Cisco的幀中繼與RFC 1490的打包方式一致,允許不同廠家的產品互相通信.當與其它廠家路由器連接時,請用IETF打包.
  定義動態或靜態的地址映射
  動態地址映射
  動態地址映射用幀中繼的翻轉ARP協議發送請求下一個希望到達的地址(next hopprotocol address)(假設知道DLCI),當有應答翻轉ARP協議請求時,保存在address-to-DLCI映射表中,這張表就用來提供下一個希望到達 的地址或出去的DLCI地址翻轉ARP協議默認是打開的,故動態地址映射不需要做任何配置.
  靜態地址映射
  一個靜態地址映射是人爲的指定下一個希望到達的地址(next hop protocol address)DLCI的對應關係.當指定了靜態地址映射時,翻轉ARP協議自動關閉.
  建立靜態地址映射表需完成:
  功
  定義一個端口或子端口的DLCI地址 frame-relay interface-dlci dlci
  指定一個next hop protocol addressDLCI之間對應 frame-relay map protocol protocol-address dlci [broadcast] [ietf] [cisco]相應地,關鍵字protocol支持的協議:
  IP---ip
  DECnet---decnet
  
  AppleTalk---appletalk
  XNS---xns
  Novell IPX---ipx
  VINES---vines
  ISO CLNS---clns
  如果是一點對一點,可用interface-dlci命令,若是一點對多點則設定 frame-relay map 一系列的dlciip address 對應表.
  定義LMII
  在Cisco IOS Release 11.2版本以上,支持本地管理接口LMI(Local managementInterface)自動識別,即由交換機端口決定LMI的類型.當然,我們也可以明確配置
  LMI類型.
  功
  建立路由器間keepalive時間 frame-relay keepalive number
  定義N391的間隔時間 frame-relay lmi-n391-dte keep-exchanges
  配置幀中繼交換虛電路
  目前,訪問幀中繼網是56K45M數率,幀中繼是在兩個節點間建立面向連接的,包交換的虛電路.
  在一個物理端口上配置SVCs
  在子端口上配置SVCs
  在一個幀中繼端口上配置SVC操作
   
  功
  指定物理端口 interface serial number
  如果需要,配置IP地址 ip address ip-address mask
  在這個端口上配置幀中繼打包 encapsulation frame-relay
  在這個端口上激活幀中繼SVC frame-relay svc
   
  在子端口上配置SVCs
   
  功
  在主端口上指定一個子端口 interface serial number.subinterface-number {multipoint | point-to-point}
  如果需要,配置IP地址 ip address ip-address mask
  參閱下面"Configure subinterface Example"的例子.
   
  幀中繼交換
   
  當一個幀中繼網要通過IP網與另一個幀中繼網互連,就要用到幀中繼交換.IP
  看作幀中繼包的隧道通過去.
  實現幀中繼交換,配置如下:
  功
  把路由器作爲幀中繼交換機 frame-relay switching
  在路由器上設置靜態路由 frame-relay route in-dlci out-interface out-dlci
  定義網絡功能 frame-relay intf-type {dte| dce| nni}
  請參閱"Frame Relay Switching Example"配置實例.
  監控幀中繼連接
  在EXEC模式下:
  功
  顯示幀中繼DLCILMI信息 show interface serial number
  顯示LMI狀態 show frame-relay lmi [type number]
  顯示PVC狀態 show frame-relay pvc [type number [dlci]]
  顯示配置靜態路由 show frame-relay route
  顯示幀中繼傳輸狀態 show frame-relay traffic
  3、配置DDN
  DDN(Digital Data Network)是一種點對點的同步數據通信鏈路.它支持PPP,SLIP,HDLCSDLC等鏈路層通信協議.允許IP, Novell IPX, Bridging,CLNS,AppleTalk,DECnet等多種上層協議在上面運行.
   
  基本配置
  壓縮技術
  E1端口配置
  基本配置
   
  功
  進入指定端口 interface serial number
  定義該端口IP地址 ip address ip-address mask
  指定該端口打包方式 encapsulation {PPP| HDLC }
   
  壓縮技術
   
  通常在串口中傳輸的數據是不壓縮的,它允許數據包頭在每次傳輸時正常交換,但每次將浪費帶寬.目前支持的壓縮有PPP,Frame Relay, X.25, TCP等等.
   
  Cisco的壓縮是通過軟件完成的,將影響系統性能.故建議路由器CPU佔用超過65%,就不要使用壓縮.(show process cpu EXEC命令查看當前CPU使用情況)
   
  功
  TCP傳輸頭壓縮 ip tcp head-compression [passive]
  X.25壓縮 X25 compress
  PPP壓縮 ppp compress [predictir|stac]
   
  注: "passive"表示只有輸入包是壓縮時,輸出包才壓縮.
   
  E1端口配置
   
  在Cisco 4500,4700,70007500系列裏面均支持E1(2.048Mbps)數率的接口.每一個E1端口可以按時隙分成3064K數據線路和2路信號線路.3064K數據線路每一路均可以當作一條64K的專線.
   
  功
  在配置模式下,定義Controller E1 controller e1 slot/port
  定義line code linecode {ami |hdb3}
  定義字符幀 framing {crc4 |no-crc4}
  定義E1 channel-group number timeslots range [speed {48| 56| 64}]
  指定串口屬於那一個channel-group interface serial slot/port:channel-group
  注:slot/port----是針對70007500系列的,故區分槽口號和端口號.
  linecode----默認是HDB3.
  framing----默認是crc4,要與電信局參數匹配.
  channel-group----每個E1可以分成30channel-group,channel-group和時間槽對應起來.channel-group0-30,timeslots1-31.
  interface serial----在定義完E1 channel-group,我們把group賦予成一個虛擬串口.
  具體的請參閱"Channelized E1 Interface Example"實例.
  4、配置X.25
   
  X.25配置完成如下工作:
  功
  設置X.25模式 encapsulation x25 [dte|dce]
  設置最大虛電路數 x25 htc max-vc-number
  設置X.121地址 x25 address x121-address
  建立IP地址與X.121地址對應 x25 map ip ip-address x121-addres [broadcast]
  htc----htc是最大的虛電路數,因爲許多X.25交換機是從高到低建立虛電路的,max-vc-number不能超過申請的最大值.
  請參閱"X.25 Example"的配置實例.
  5、配置HDLC:
  HDLCCISCO路由器使用的缺省協議,一臺新路由器在未指定封裝協議時默認使用HDLC封裝。
  A.有關命令
  端口設置:
  任務 命令
  設置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
  B. 舉例:
  設置如下:
  Router1:
  
  interface Serial0
  ip address 192.200.10.1 255.255.255.0
  clockrate 1000000
  Router2:
  
  interface Serial0
  ip address 192.200.10.2 255.255.255.0
  !
  C. 舉例使用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狀態,以下爲幀類型爲crc4controllers正常的狀態.
  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,
  0 Errored Secs, 0 Bursty Err Secs, 0 Severely Err Secs, 0 Unavail Secs
  以下例子爲E1連接364K專線, 幀類型爲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
  no ip mroute-cache
  !
  interface Serial0:2
  ip address 202.119.96.9 255.255.255.252
  no ip mroute-cache
  !
  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
 
 
6、配置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封裝的串行線路上提供安全性認證。使用CHAPPAP認證,每個路由器通過名字來識別,可以防止未經授權的訪問。
  
  CHAPPAPRFC 1334上有詳細的說明。
  
  A. 有關命令
  端口設置
  任務 命令
  設置PPP封裝 encapsulation ppp1
  設置認證方法 ppp authentication {chap | chap pap | pap chap | pap} [if-needed] [list-name | default] [callin]
  指定口令 username name password secret
  設置DCE端線路速度 clockrate speed
  注:1、要使用CHAP/PAP必須使用PPP封裝。在與非Cisco路由器連接時,一般採用PPP封裝,其它廠家路由器一般不支持CiscoHDLC封裝協議。
  2. 舉例
  路由器Router1Router2S0口均封裝PPP協議,採用CHAP做認證,在Router1中應建立一個用戶,以對端路由器主機名作爲用 戶名,即用戶名應爲router2。同時在Router2中應建立一個用戶,以對端路由器主機名作爲用戶名,即用戶名應爲router1。所建的這兩用戶 password必須相同。
  設置如下:
  Router1:
  
  hostname router1
  username router2 password xxx
  interface Serial0
  ip address 192.200.10.1 255.255.255.0
  clockrate 1000000
  ppp authentication chap
  !
  Router2:
  
  hostname router2
  username router1 password xxx
  interface Serial0
  ip address 192.200.10.2 255.255.255.0
  ppp authentication chap
  
  7、廣域網配置實例
   
  DDR Example
  Dial Backup Example
  Configure subinterface Example
  Frame Relay Switching Example
  Channelized E1 Interface Example
  X.25 Example
  DDR Example
  
   例:
  
  Configuration for RouterA:
   
  ip route 131.108.29.0 131.108.126.2
  ip route 131.108.1.0 131.108.126.2
  dialer-list 1 protocol ip permit
  dialer-list 1 protocol ipx deny
  !
  interface serial 0
  ip address 131.108.126.1 255.255.255.0
  dialer in-band
  dialer-group 1
  !
  dialer map ip 131.108.126.2 5551234
  !
  dialer idle-timeout 300
   
  Dial Backup Example
   
  A)同步V.25 bits方式
   
  Configuration for RouterA:
   
  interface Serial0:0
  backup delay 0 10
  backup interface Serial10
  ip address 16.217.30.2 255.255.255.252
  !
  interface Serial10
  ip address 16.30.16.81 255.255.255.0
  encapsulation ppp
  dialer in-band
  dialer string 8292
  dialer-group 1
  pulse-time 1
  !
  dialer-list 1 protocol ip permit
   
  B)輔助口作撥號備份
   
  Configuration for RouterA:
   
  chat-script MYDIAL "" "atdt 8292" TIMEOUT 60 "CONNECT"
  !
  interface Serial0
  backup delay 0 0
  backup interface Async1
  ip address 16.3.1.1 255.255.255.0
  
  encapsulation ppp
  !
  interface Async1
  ip address 16.3.2.1 255.255.255.0
  encapsulation ppp
  keepalive 9
  async default routing
  async dynamic address
  async dynamic routing
  async mode dedicated
  dialer in-band
  dialer string 8292
  dialer-group 1
  !
  dialer-list 1 protocol ip permit
  !
  line aux 0
  script dialer MYDIAL
  modem InOut
  transport output none
  stopbits 1
  flowcontrol hardware
  speed 9600
   
  Subinterface Example(Frame Relay)
   
   
  Configuration for RouterA:
   
  interface serial 0
  encapsulation frame-relay
  interface s 0.1 multipoint
  ip address 11.10.11.1 255.255.255.0
  frame-relay interface-dlci 41
  frame-relay interface-dlci 42
   
  Configuration for RouterC:
   
  interface serial 0
  encapsulation frame-relay
  interface s 0.1 point-to-point
  ip address 11.10.16.2 255.255.255.0
  frame-relay interface-dlci 46
   
  Configuration for RouterB:
   
  interface serial 0
  encapsulation frame-relay
  interface s 0.1 multipoint
  ip address 11.10.11.3 255.255.255.0
  frame-relay interface-dlci 43
  frame-relay interface-dlci 44
  !
  interface s 0.2 point-to-point
  ip address 11.10.13.1 255.255.255.0
  frame-relay interface-dlci 48
   
  Frame Relay Switching Example
   
   
  Configuration for RouterA:
   
  frame-relay switching
  !
  int s 0
  no ip address
  frame-relay encapsulation
  frame-relay route 167 tun0 43
  frame-relay intf-type dce
  !
  int s 1
  ip address 131.108.100.1 255.255.255.0
  !
  int tu 0
  tunnel source serial 1
  tunnel destination 131.108.13.2
   
  Configuration for RouterB:
   
  frame-relay switching
  !
  int s 0
  no ip address
  frame-relay encapsulation
  frame-relay route 9 tun0 43
  frame-relay intf-type dce
  !
  int s 1
  ip address 131.108.13.2 255.255.255.0
  !
  int tu 0
  tunnel source serial 1
  tunnel destination 131.108.100.1
   
  Channelized E1 Interface Example
   
  假設是7500系列路由器,E1接口(MIP)在插槽4上面.一個channel-group可對應多個時間槽,本例中serial4/0:15*64Kbps的數率. 
  Configuration for Router:
   
  controller E1 0
  framing NO-CRC4
  channel-group 0 timeslots 1
  channel-group 1 timeslots 2,7-9,20 speed 64
  !
  interface Serial4/0:0
  ip address 16.217.30.2 255.255.255.252
  encapsulation ppp
  !
  interface Serial4/0:1
  ip address 16.205.30.5 255.255.255.252
   
  X.25 Example
   
  在配置X.25,爲減少路由交換引起的呼叫,通常用靜態路由.而當一對多情況下,
  不在一個子網中用subinterface配置.
   
  Configuration for Router:
   
  interface serial 0
  ip address 131.108.100.1 255.255.255.0
  encapsulation x25
  x25 address 041673226839
  x25 htc 16
  x25 map ip 131.108.100.2 041675222222
  int s 0.1
  ip address 131.108.101.1 255.255.255.0
  x25 map ip 131.108.101.2 041674222222
  !
  ip route 131.108.100.0 255.255.255.0 131.108.100.2
  ip route 131.108.101.0 255.255.255.0 131.108.101.2
 
 
 
路由協議設置
  一、RIP協議
  RIP(Routing information Protocol)是應用較早、使用較普遍的內部網關協議(Interior Gateway Protocol,簡稱IGP),適用於小型同類網絡,是典型的距離向量(distance-vector)協議。文檔見RFC1058 RFC1723
  RIP通過廣播UDP報文來交換路由信息,每30秒發送一次路由信息更新。RIP提供跳躍計數(hop count)作爲尺度來衡量路由距離,跳躍計數是一個包到達目標所必須經過的路由器的數目。如果到相同目標有二個不等速或不同帶寬的路由器,但跳躍計數相 同,則RIP認爲兩個路由是等距離的。RIP最多支持的跳數爲15,即在源和目的網間所要經過的最多路由器的數目爲15,跳數16表示不可達。
  1. 有關命令
  任務 命令
  指定使用RIP協議 router rip
  指定RIP版本 version {1|2}1
  指定與該路由器相連的網絡 network network
  注:1.CiscoRIP版本2支持驗證、密鑰管理、路由彙總、無類域間路由(CIDR)和變長子網掩碼(VLSMs)
  2. 舉例
  Router1:
  
  router rip
  version 2
  network 192.200.10.0
  network 192.20.10.0
  !
  相關調試命令:
  show ip protocol
  show ip route
  
  二、IGRP協議
  IGRP (Interior Gateway Routing Protocol)是一種動態距離向量路由協議,它由Cisco公司八十年代中期設計。使用組合用戶配置尺度,包括延遲、帶寬、可靠性和負載。
  缺省情況下,IGRP90秒發送一次路由更新廣播,在3個更新週期內(270),沒有從路由中的第一個路由器接收到更新,則宣佈路由不可訪問。在7個更新週期即630秒後,Cisco IOS 軟件從路由表中清除路由。
  1. 有關命令
  任務 命令
  指定使用RIP協議 router igrp autonomous-system1
  指定與該路由器相連的網絡 network network
  指定與該路由器相鄰的節點地址 neighbor ip-address
  注:1autonomous-system可以隨意建立,並非實際意義上的autonomous-system,但運行IGRP的路由器要想交換路由更新信息其autonomous-system需相同。
  2.舉例
  
  Router1:
  router igrp 200
  network 192.200.10.0
  network 192.20.10.0
  !
  
  三、OSPF協議
  OSPF(Open Shortest Path First)是一個內部網關協議(Interior Gateway Protocol,簡稱IGP),用於在單一自治系統(autonomous system,AS)內決策路由。與RIP相對,OSPF是鏈路狀態路由協議,而RIP是距離向量路由協議。
  鏈路是路由器接口的另一種說法,因此OSPF也稱爲接口狀態路由協議。OSPF通過路由器之間通告網絡接口的狀態來建立鏈路狀態數據庫,生成最短路徑樹,每個OSPF路由器使用這些最短路徑構造路由表。
  1.有關命令
  全局設置
  任務 命令
  指定使用OSPF協議 router ospf process-id1
  指定與該路由器相連的網絡 network address wildcard-mask area area-id2
  指定與該路由器相鄰的節點地址 neighbor ip-address
  注:1OSPF路由進程process-id必須指定範圍在1-65535,多個OSPF進程可以在同一個路由器上配置,但最好不這樣做。多個 OSPF進程需要多個OSPF數據庫的副本,必須運行多個最短路徑算法的副本。process-id只在路由器內部起作用,不同路由器的process- id可以不同。
  2wildcard-mask 是子網掩碼的反碼, 網絡區域ID area-id0-4294967295內的十進制數,也可以是帶有IP地址格式的x.x.x.x。當網絡區域ID00.0.0.0時爲主幹域。不 同網絡區域的路由器通過主幹域學習路由信息。
  2.基本配置舉例:
  Router1:
  interface ethernet 0
  ip address 192.1.0.129 255.255.255.192
  !
  interface serial 0
  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
  !
  Router2:
  
  interface ethernet 0
  ip address 192.1.0.65 255.255.255.192
  !
  interface serial 0
  ip address 192.200.10.6 255.255.255.252
  !
  router ospf 200
  network 192.200.10.4 0.0.0.3 area 0
  network 192.1.0.64 0.0.0.63 area 2
  !
  Router3:
  
  interface ethernet 0
  ip address 192.1.0.130 255.255.255.192
  !
  router ospf 300
  network 192.1.0.128 0.0.0.63 area 1
  !
  Router4:
  
  interface ethernet 0
  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
  以下列舉兩種驗證設置的示例,示例的網絡分佈及地址分配環境與以上基本配置舉例相同,只是在Router1Router2的區域0上使用了身份驗證的功能。:
  1.使用純文本身份驗證
  Router1:
  
  interface ethernet 0
  ip address 192.1.0.129 255.255.255.192
  !
  interface serial 0
  ip address 192.200.10.5 255.255.255.252
  ip ospf authentication-key cisco
  !
  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
  area 0 authentication
  !
  Router2:
  
  interface ethernet 0
  ip address 192.1.0.65 255.255.255.192
  !
  interface serial 0
  ip address 192.200.10.6 255.255.255.252
  ip ospf authentication-key cisco
  !
  router ospf 200
  network 192.200.10.4 0.0.0.3 area 0
  network 192.1.0.64 0.0.0.63 area 2
  area 0 authentication
  !
  例2.消息摘要(md5)身份驗證:
  Router1:
  
  interface ethernet 0
  ip address 192.1.0.129 255.255.255.192
  !
  interface serial 0
  ip address 192.200.10.5 255.255.255.252
  ip ospf message-digest-key 1 md5 cisco
  !
  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
  area 0 authentication message-digest
  !
  Router2:
  
  interface ethernet 0
  ip address 192.1.0.65 255.255.255.192
  !
  interface serial 0
  ip address 192.200.10.6 255.255.255.252
  ip ospf message-digest-key 1 md5 cisco
  !
  router ospf 200
  network 192.200.10.4 0.0.0.3 area 0
  network 192.1.0.64 0.0.0.63 area 2
  area 0 authentication message-digest
  !
  相關調試命令:
  debug ip ospf adj
  debug ip ospf events
  
  四、重新分配路由
  在實際工作中,我們會遇到使用多個IP路由協議的網絡。爲了使整個網絡正常地工作,必須在多個路由協議之間進行成功的路由再分配。
  以下列舉了OSPFRIP之間重新分配路由的設置範例:
  Router1Serial 0端口和Router2Serial 0端口運行OSPF,在Router1Ethernet 0端口運行RIP 2Router3運行RIP2Router2有指向Router4192.168.2.0/24網的靜態路由,Router4使用默認靜態路由。需 要在Router1Router3之間重新分配OSPFRIP路由,在Router2上重新分配靜態路由和直連的路由。
  範例所涉及的命令
  任務 命令
  重新分配直連的路由 redistribute connected
  重新分配靜態路由 redistribute static
  重新分配ospf路由 redistribute ospf process-id metric metric-value
  重新分配rip路由 redistribute rip metric metric-value
  Router1:
  
  interface ethernet 0
  ip address 192.168.1.1 255.255.255.0
  !
  interface serial 0
  ip address 192.200.10.5 255.255.255.252
  !
  router ospf 100
  redistribute rip metric 10
  network 192.200.10.4 0.0.0.3 area 0
  !
  router rip
  version 2
  redistribute ospf 100 metric 1
  network 192.168.1.0
  !
  Router2:
  
  interface loopback 1
  ip address 192.168.3.2 255.255.255.0
  !
  interface ethernet 0
  ip address 192.168.0.2 255.255.255.0
  !
  interface serial 0
  ip address 192.200.10.6 255.255.255.252
  !
  router ospf 200
  redistribute connected subnet
  redistribute static subnet
  network 192.200.10.4 0.0.0.3 area 0
  !
  ip route 192.168.2.0 255.255.255.0 192.168.0.1
  !
  Router3:
  
  interface ethernet 0
  ip address 192.168.1.2 255.255.255.0
  !
  router rip
  version 2
  network 192.168.1.0
  !
  Router4:
  
  interface ethernet 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 routing
  設置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
  在此例中,WANIPX網絡爲3a00,Router1所連接的局域網IPX網絡號爲2a00,在此局域網有一臺Novell服務器,IPX網絡號 也是2a00, 路由器接口的IPX網絡號必須與在同一網絡的Novell服務器上設置的IPX網絡號相同。路由器通過監聽SAP來建立已知的服務及自己的網絡地址表,並 60秒發送一次自己的SAP表。
  Router1:
  
  ipx routing
  interface ethernet 0
  ipx network 2a00 encapsulation sap
  !
  interface serial 0
  ipx network 3a00
  !
  ipx router eigrp 10
  network 3a00
  network 2a00
  !
  Router2:
  
  ipx routing
  interface ethernet 0
  ipx network 2b00 encapsulation sap
  !
  interface serial 0
  ipx network 3a00
  !
  ipx router eigrp 10
  network 2b00
  network 3a00
  !
  相關調試命令:
  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
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章