找回密码
 注册

QQ登录

只需一步,快速开始

查看: 2450|回复: 2

CISCO路由器配置命令详解

[复制链接]
发表于 2014-3-22 22:13:06 | 显示全部楼层 |阅读模式
CISCO路由器配置手册
第一章 路由器配置基础
一、基本设置方式
9 V3 B: M3 r5 x$ y一般来说,可以用5种方式来设置路由器:
2 F3 E$ b$ g4 ]) r4 b2 N
3 K5 G4 a- {9 \! f* }4 V5 @2 N1.Console口接终端或运行终端仿真软件的微机; & V& y2 g- E  i4 Y: P
2.AUX口接MODEM,通过电话线与远方的终端或运行终端仿真软件的微机相连;
+ X! `$ Y: l2 o7 m3.通过Ethernet上的TFTP服务器; , B' e8 i0 ?3 b8 D: Z
4.通过Ethernet上的TELNET程序;
# }0 {/ e+ o. e2 t1 g5.通过Ethernet上的SNMP网管工作站。   ' ^# Q8 n6 k8 h1 [
但路由器的第一次设置必须通过第一种方式进行,此时终端的硬件设置如下:
. n. k" Z6 B9 @  [波特率 :9600 1 ]9 k4 U# S% p1 _& m5 Q! w* }5 P3 U
数据位 :8 * ~" F! I1 o, I, r+ @+ k2 v
停止位 :1
' {' V9 R1 b& m奇偶校验: 无   
二、命令状态
# A6 P1 |, F2 V3 ^1.     router>
6 C1 {" @" A! j0 S( J' l, d2 m路由器处于用户命令状态,这时用户可以看路由器的连接状态,访问其它网络和主机,但不能看到和更改路由器的设置内容。 - v6 V: E; \* x; W" D7 [, _
2.     router# ! U- I7 Q  e  y6 S! @' f6 k
在router>提示符下键入enable,路由器进入特权命令状态router#,这时不但可以执行所有的用户命令,还可以看到和更改路由器的设置内容。 : K% K% r$ V  h/ e7 V8 s& r
3.     router(config)# ) _+ |1 \! t5 W$ b. Z
在router#提示符下键入configure terminal,出现提示符router(config)#,此时路由器处于全局设置状态,这时可以设置路由器的全局参数。 : j: i* ?# J8 G& ?
4.     router(config-if)#; router(config-line)#;router(config-router)#;… - g8 M. E. ], u
路由器处于局部设置状态,这时可以设置路由器某个局部的参数。
% H2 K7 |! e, u9 @5.     >
! K4 N+ q, ?, `8 Z4 f: G7 m; }路由器处于RXBOOT状态,在开机后60秒内按ctrl-break可进入此状态,这时路由器不能完成正常的功能,只能进行软件升级和手工引导。 - G2 ?7 f2 n  w0 v3 F4 @& F
6.     设置对话状态 * [, Z  h; \2 J2 P7 i
这是一台新路由器开机时自动进入的状态,在特权命令状态使用SETUP命令也可进入此状态,这时可通过对话方式对路由器进行设置。   
三、设置对话过程 ; w' f- x1 [8 `3 g! J" e
显示提示信息5 B. k* X9 M5 K. c1 n: Q* r9 `
全局参数的设置# r" r$ g, b! A0 E1 i/ ]
接口参数的设置, g, j" l5 m8 g5 R$ B4 h0 e4 s
显示结果
; [/ N) r9 w# ~3 _4 E. O$ ~; h9 H利用设置对话过程可以避免手工输入命令的烦琐,但它还不能完全代替手工设置,一些特殊的设置还必须通过手工输入的方式完成。
! n4 r1 L* b  m进入设置对话过程后,路由器首先会显示一些提示信息:6 ?3 N% x0 k6 m2 U! \- b) b
--- System Configuration Dialog ---
' K2 E/ u* I, QAt any point you may enter a question mark '?' for help. 9 X# o* ~2 e2 R: q! I6 U1 m3 Y  \7 R
Use ctrl-c to abort configuration dialog at any prompt. . B0 V; y4 Y+ W
Default settings are in square brackets '[]'.
" d8 C3 {0 g: U' @- R+ S这是告诉你在设置对话过程中的任何地方都可以键入“?”得到系统的帮助,按ctrl-c可以退出设置过程,缺省设置将显示在‘[]’中。然后路由器会问是否进入设置对话:
6 h% E4 `& X0 d1 HWould you like to enter the initial configuration dialog? [yes]:
/ I! ~8 o+ ^9 r9 S4 v! g% a% ?如果按y或回车,路由器就会进入设置对话过程。首先你可以看到各端口当前的状况: 3 [8 F4 R" \% \. h9 X' ~, }! Y9 @2 p# Y
First, would you like to see the current interface summary? [yes]:
9 H# i9 l) H3 R  w2 `) BAny interface listed with OK? value "NO" does not have a validconfiguration
- j, s5 Z  l4 u' C$ A0 h5 ^; sInterface IP-Address OK? Method Status Protocol $ i6 f) D9 |! e& f7 n$ Z
Ethernet0 unassigned NO unset up up " ^% b" `) B/ @8 Q4 ^2 M
Serial0 unassigned NO unset up up / R* u+ r8 l5 E$ }! Z) z* ?
……… ……… … …… … …
; o1 u/ b8 Q8 b/ C; {然后,路由器就开始全局参数的设置:
0 w* Y" P- y2 AConfiguring global parameters:
( r0 i* p6 u: N% F  f7 Z1.设置路由器名: + h0 T8 v. L$ X" d0 ^5 i0 R
Enter host name [Router]: 3 Y4 w. s5 g2 L2 s1 ^0 ~: Q, X
2.设置进入特权状态的密文(secret),此密文在设置以后不会以明文方式显示:
/ i' s  I# t2 k  C% `3 r- ]% OThe enable secret is a one-way cryptographic secret used
- R, u" E7 D0 ^; H& Q$ j0 e! dinstead of the enable password when it exists.   L( M( ]# S0 R" G$ i
Enter enable secret: cisco
( j7 H! O. z+ T6 q* j+ m) x- X3.设置进入特权状态的密码(password),此密码只在没有密文时起作用,并且在设置以后会以明文方式显示:
, |4 w" e% n( e8 o/ z& k2 z7 {: fThe enable password is used when there is no enable secret 3 V& q" V% ?, V% T
and when using older software and some boot images. & ~9 S5 ?0 J& g% `: P
Enter enable password: pass ' j/ C, V6 P' n4 e
4.设置虚拟终端访问时的密码:
" d' a7 f5 n/ }5 |, Y" HEnter virtual terminal password: cisco   V# Q, ]' \; Q: @0 }- T
5.询问是否要设置路由器支持的各种网络协议: 3 S9 e; ~: P& y1 U0 d4 p' h
Configure SNMP Network Management? [yes]:
) X4 C/ e5 M: w7 S% Q) @1 r- B  eConfigure DECnet? [no]:
7 Q) \6 Y+ q# d! s. I, V! }- c* U; [Configure AppleTalk? [no]: & K# L6 G* h, Z+ ]% ?- p9 I" i
Configure IPX? [no]: + U' D" e. c- k  i$ Q7 }! N
Configure IP? [yes]:
  O5 F0 ^  q" [7 T: B% MConfigure IGRP routing? [yes]: . V5 \% c2 H% M3 m# n
Configure RIP routing? [no]: 5 e  J6 w6 f' U8 P; E# ^
………
& S- x4 B- f; m, T6.如果配置的是拨号访问服务器,系统还会设置异步口的参数:
1 X/ G! z+ b, P" ]. R# Z* T2 q Configure Async lines? [yes]:
6 o: j( a* ^8 x2 x, j( \1)     设置线路的最高速度:
) E2 O: F" R5 t& [, w# FAsync line speed [9600]:
8 n7 D7 ]' f, K; l4 O* Q2)     是否使用硬件流控: " L; ?5 S3 l9 n- F% x3 z  l8 s
Configure for HW flow control? [yes]:
7 c) K( h- D! d- g/ H3)     是否设置modem: ; T# z0 I& Z( P
Configure for modems? [yes/no]: yes 5 q2 Y1 d0 b9 Z
4)     是否使用默认的modem命令:
% f* X& _! Y. c. G0 d$ M1 A   Configure for default chat script? [yes]:
" b& r+ e8 h8 z/ q* o" m8 u5)     是否设置异步口的PPP参数: . a" x8 s% F0 P+ M
Configure for Dial-in IP SLIP/PPP access? [no]: yes
1 w' [; J# n5 }# L4 }6)     是否使用动态IP地址:
& H# Y. _# d* b$ v# J8 P' S7 z/ ^ Configure for Dynamic IP addresses? [yes]:
1 \; m4 w1 _4 l0 V6 h" q7)     是否使用缺省IP地址: / {  _) r' Y9 U) c2 `
Configure Default IP addresses? [no]: yes ) c. b; J/ l0 k0 C' g
8)     是否使用TCP头压缩: 9 U) x6 x1 t! i! L4 F
  Configure for TCP Header Compression? [yes]: 8 B& K4 I3 c7 t' |, d* o# B
9)     是否在异步口上使用路由表更新: * t8 ~" {9 T) J5 ~- S
   Configure for routing updates on async links? [no]: y   R5 ]) h5 Z9 i# o
10)               是否设置异步口上的其它协议。
4 p4 O5 H) Y* f* Y5 R9 k4 d接下来,系统会对每个接口进行参数的设置。 ; m6 `/ C* r  `
1.Configuringinterface Ethernet0:
9 Y) i' r9 j$ Y2 c1)     是否使用此接口:
- B! f8 P/ f) ~/ [# z: m& \ Is this interface in use? [yes]: ; u7 |7 t3 h" W# \
2)     是否设置此接口的IP参数: + l; Y5 Z$ g+ |
Configure IP on this interface? [yes]: ) O. ~! ]' |# g. ]; T) A' ]
3)     设置接口的IP地址: 2 B: r% W, I3 K0 X
     IP address for this interface: 192.168.162.2
9 a) m1 D: c; p- o4)     设置接口的IP子网掩码: # S! n/ i+ G9 p8 O  b6 J4 r
  Number of bits in subnet field [0]:
# t* v. `0 H" |" L8 a( IClass C network is 192.168.162.0, 0 subnet bits; mask is /24
5 m# s4 q/ w* ]4 s5 y在设置完所有接口的参数后,系统会把整个设置对话过程的结果显示出来:
$ Q; r2 f8 {  x, F( JThe following configuration command script was created:
: I6 V4 G0 W& Y# D( q, ]hostname Router * C2 z7 T& [% M5 x0 x1 v. ^
enable secret 5 $1$W5Oh$p6J7tIgRMBOIKVXVG53Uh1
7 l3 Y! O9 Q" k2 xenable password pass ' {7 {& s( H$ I; Y* U  w
………… ' j+ m8 s  Q  u9 z' H: H/ J
请注意在enable secret后面显示的是乱码,而enable password后面显示的是设置的内容。
/ c5 r  p) D( V  q( h: T5 k2 n显示结束后,系统会问是否使用这个设置: 7 N( T; [- v  d/ o* M, b' S
Use this configuration? [yes/no]: yes + T' r% y; f* z4 f3 y( t) m4 e1 a
如果回答yes,系统就会把设置的结果存入路由器的NVRAM中,然后结束设置对话过程,使路由器开始正常的工作。   
四、常用命令 5 Z# z2 D! H) N! t* l$ e
1.        帮助
" \8 c; I9 Q  n在IOS操作中,无论任何状态和位置,都可以键入“?”得到系统的帮助。
4 A( S0 F2 v, U1 V" d$ ~2.        改变命令状态  ) O/ J4 T  s3 U' Y9 Z; Q2 P
任务 命令
' o2 E, v0 x0 h/ e. i' E* a  m进入特权命令状态 enable
0 P: D* h8 P2 m. i退出特权命令状态 disable 5 s2 Z& C* o0 f8 P
进入设置对话状态 setup
" m, L$ M* D* ?5 ^1 \进入全局设置状态 configterminal . L) \! i" W( s0 L
退出全局设置状态 end
2 m$ p$ S& C# }$ A. Z3 M进入端口设置状态interface type slot/number
# T0 Y# }% A$ C) I! M  V1 W4 c: ?* S进入子端口设置状态interface type number.subinterface [point-to-point | multipoint]
. q8 ]* d5 W$ n! [& w! c进入线路设置状态 linetype slot/number
' |! V/ T. v4 n6 {! a. F' d5 a+ A进入路由设置状态 routerprotocol
+ Y) n, ^. j5 ~  I  j% a# L退出局部设置状态 exit
: j  O/ e; {& @0 `+ A# c/ N0 {3.       显示命令
; |/ }& B+ c$ M4 C任务 命令
# W3 ?4 f( o6 X4 a. G/ l6 e5 T查看版本及引导信息 showversion 9 w: G% ]0 P, p
查看运行设置 showrunning-config
3 r7 u/ N( c, x查看开机设置 showstartup-config 2 t- T# i, q" m$ @' {% n& I: \
显示端口信息 showinterface type slot/number 3 k) s2 v1 d& u+ M  F
显示路由信息 show iprouter 3 g* a+ m! N6 Z1 X
4.       拷贝命令
4 g7 Q# R4 ]7 }2 C6 y0 W用于IOS及CONFIG的备份和升级  
7 Z) I6 v) }9 B" k* m+ c) S. c$ M' o0 c" t/ B/ p$ |
5.        网络命令  8 m7 w0 h/ f& t# i
任务 命令 6 |! ]/ ?6 W4 n$ O! U
登录远程主机 telnethostname|IP address $ x" F: [/ W: ~& m
网络侦测 pinghostname|IP address ) `, B  _. Z0 J- y. K: N* l
路由跟踪 tracehostname|IP address $ s0 d8 F7 T  {7 e8 g
 : ^' ~% e  t! h' d1 J+ }5 d
6.     基本设置命令  
6 y5 Q  z' R5 T( G" R0 F) r任务 命令
. {' s9 q  X$ \8 G2 K$ Z9 c全局设置 configterminal 7 l2 n4 j5 P  g8 ^
设置访问用户及密码username username password password
2 X: @% b# l8 D: ~设置特权密码 enablesecret password
8 S! s" g# k% g4 c# k9 o5 C* s设置路由器名 hostnamename
8 F3 Z$ L4 @! [/ `$ c设置静态路由 ip routedestination subnet-mask next-hop
3 o" R/ r. c! U+ q$ ~8 g+ b启动IP路由 ip routing
- E& C( |- J. F启动IPX路由 ipx routing * j% s& [: E$ \2 G1 H# [/ [" m5 a
端口设置 interfacetype slot/number
/ c! k$ ~; U" n* w. ?5 N+ g0 ?设置IP地址 ip address address subnet-mask 2 s% a9 `. {+ w
设置IPX网络 ipx network network 8 Z$ h; K( i& W  W! \; `
激活端口 no shutdown 0 c; _# ~( q' B# t0 m# ^- ?
物理线路设置 line typenumber : n$ c; X6 V* n7 T- c
启动登录进程 login[local|tacacs server]
. e2 }" A6 X& V' K设置登录密码 passwordpassword 2 x! |$ {% \! Q" J" y
 $ S! j: h% @: O- G/ V8 a
五、配置IP寻址
6 ~9 P9 k" O6 x3 p) T7 }' h 
. E4 R4 z5 G4 U2 {& x) N7 ?1.        IP地址分类! B: W7 C4 s7 _# o, _) e, V
IP地址分为网络地址和主机地址二个部分,A类地址前8位为网络地址,后24位为主机地址,B类地址16位为网络地址,后16位为主机地址,C类地址前24位为网络地址,后8位为主机地址,网络地址范围如下表所示:
( M& {7 M1 X5 {4 l4 S. i+ W种类 网络地址范围 ) H4 M+ u$ P0 L+ G, S' \$ P' W. S
A 1.0.0.0 到126.0.0.0有效 0.0.0.0 和127.0.0.0保留
5 T2 ?3 N% r4 ~! Y1 E  b% j, @B 128.1.0.0到191.254.0.0有效 128.0.0.0和191.255.0.0保留 / ^' ?0 B/ ~. c8 `- n2 Z' H' E
C 192.0.1.0 到223.255.254.0有效 192.0.0.0和223.255.255.0保留 ( ]# r* \8 Q# C& f/ A, Q- m
D 224.0.0.0到239.255.255.255用于多点广播
7 h) E4 K7 N$ j4 j- EE 240.0.0.0到255.255.255.254保留 255.255.255.255用于广播
. {# b9 j$ p/ P% o' @2.        分配接口IP地址- I7 k; E9 g: o( P: M( v4 v9 G
任务 命令 $ f/ [& @7 j" R! r7 U; A
接口设置 interfacetype slot/number
. Z+ ]- ]' P+ H# F- i' R为接口设置IP地址 ip address ip-address  mask 6 Y# f) z7 K8 p3 L: U$ W4 |7 l
掩玛(mask)用于识别IP地址中的网络地址位数,IP地址(ip-address)和掩码(mask)相与即得到网络地址。
( x; K& Z! H4 g. D- R7 T6 n1 |3.        使用可变长的子网掩码
0 o* M& ?, L9 [5 i8 F通过使用可变长的子网掩码可以让位于不同接口的同一网络编号的网络使用不同的掩码,这样可以节省IP地址,充分利用有效的IP地址空间。7 k* E) a# ?/ o  ?6 D
如下图所示:; _: i( h; W3 L3 d% n' g* m
$ R- q6 z. b8 e' z1 x! t
  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类网络地址分配给了二个网,既划分了二个子网,起到了节约地址的作用。
) H: W' C; g- Y3 n" g4.        使用网络地址翻译(NAT)
( G/ t( v4 M% ]! ^5 a; Z# f5 eNAT(Network AddressTranslation)起到将内部私有地址翻译成外部合法的全局地址的功能,它使得不具有合法IP地址的用户可以通过NAT访问到外部Internet.( W8 c2 W6 K0 T, X/ O1 a/ v1 F
当建立内部网的时候,建议使用以下地址组用于主机,这些地址是由Network Working Group(RFC 1918)保留用于私有网络地址分配的.8 Y4 ?7 N7 T' p4 V  m% L, U. O) M
;          Class A:10.1.1.1 tol 10.254.254.254
* K# A  Z) G3 Q6 Y4 z- K* j! b;          Class B:172.16.1.1 to 172.31.254.254l  \5 @5 f# J4 I* X4 Z' V
;        l Class C:192.168.1.1 to 192.168.254.254
8 b7 T1 o, `9 ~- ~命令描述如下:
- f2 X, I" _+ K; j. B/ _1 }+ w任务 命令
+ t' |7 S1 S: `3 A1 X8 V定义一个标准访问列表access-list access-list-number permit source                                          [source-wildcard] ) }) o5 b# c9 G: f- l- r7 g
定义一个全局地址池 ip natpool name start-ip end-ip {netmask netmask | prefix-length prefix-length}    [type rotary] : b6 x+ |5 ?# \
建立动态地址翻译 ip natinside source {list {access-list-number | name} pool name [overload] | staticlocal-ip global-ip}
! g' S3 X) h$ S, h9 ^( l指定内部和外部端口 ip nat{inside | outside}
# c& W8 g7 [. y' b如下图所示,8 \+ d) A+ B& W

- Q9 g1 V) c7 N  [4 R6 [路由器的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 poolc2501 overload中的参数overload,将允许多个内部地址使用相同的全局地址(一个合法IP地址,它是由NIC或服务提供商所分配的地址)。命令ip nat pool c2501 202.96.38.1 202.96.38.62 netmask 255.255.255.192定义了全局地址的范围。   5 _* D. s" v' b" \
设置如下:' B) i" N! [' X) p8 k$ G
ip nat pool c2501 202.96.38.1 202.96.38.62 netmask 255.255.255.192 0 V# d7 M( R1 t; Z
interface Ethernet 0 8 T( N: T+ j8 D+ r; f1 U
ip address 10.1.1.1 255.255.255.0 1 y' @' c+ _% r+ p: L8 X( V0 r
ip nat inside . O# g6 ~3 R2 o* Q; [
! & a, Z6 I8 b, o5 u( |
interface Serial 0 5 X) M7 i- i: g" S9 g, N3 k: F
ip address 202.200.10.5 255.255.255.252
0 f5 r5 L' T/ E% J# N3 @) @- D- Yip nat outside ; }. r5 f9 B- _4 U2 G* F3 T* w
!
+ h+ h# R- k& I" ]ip route 0.0.0.0 0.0.0.0 Serial 0
  _% M- H7 {$ i( H$ o. A0 y9 ?access-list 2 permit 10.0.0.0 0.0.0.255 # D) z4 A6 D. v% U( j, _5 b
! Dynamic NAT
/ T5 d6 \1 O$ w$ N# Z' }2 c!
( |0 W2 y$ d1 j; vip nat inside source list 2 pool c2501 overload
) a$ g$ Q! L$ E/ X# ~line console 0 ) |: K: |) k. n
exec-timeout 0 0 - \( @1 @1 v! k1 Y6 F* x- I) Y7 C
! 9 I" ~0 Q2 P+ g' |- Q
line vty 0 4
( R: w! }# M2 O* F! N- I' Jend
六、配置静态路由
通过配置静态路由,用户可以人为地指定对某一网络访问时所要经过的路径,在网络结构比较简单,且一般到达某一网络所经过的路径唯一的情况下采用静态路由。
* R9 r( y' n$ D! B任务 命令 9 K2 ~6 i! T( ]) f
建立静态路由 ip routeprefix mask {address | interface} [distance] [tag tag] [permanent] - R8 |+ k' t) K! Z
Prefix:所要到达的目的网络
9 z+ l) }# d, [7 g, j% Zmask :子网掩码
5 l# o1 q6 a+ ~. @: Zaddress:下一个跳的IP地址,即相邻路由器的端口地址。
$ w7 j3 k! G- P& [) }% Ginterface :本地网络接口
9 W' z/ f5 f3 v; W& \distance:管理距离(可选)
1 b$ L; ^: q4 }& Y# ?, V8 N  xtag tag:tag值(可选)
8 p1 A$ t& N/ \* l( cpermanent:指定此路由即使该端口关掉也不被移掉。
以下在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上添加静态路由。
! D8 |. x& `6 I8 gRouter1:
/ h; c( I0 x  _  Z  _* `. gip route 192.1.0.64 255.255.255.192 192.200.10.6   
/ ]+ \% O0 C7 T9 h) V9 [3 I% lRouter3:
  R3 l, r& p$ c% T0 H. o& `5 [ip route 192.1.0.128 255.255.255.192 192.1.0.65 , V( v# B7 _! s; D
ip route 192.200.10.4 255.255.255.252 192.1.0.65   $ {4 k( L' i7 J2 v0 r: }
同时由于路由器Router3除了与路由器Router2相连外,不再与其他路由器相连,所以也可以为它赋予一条默认路由以代替以上的二条静态路由,
1 m2 `- t' k, K) U- r0 V) M# fip route 0.0.0.0 0.0.0.0 192.1.0.65$ n, J: u- ]+ @! G, w
即只要没有在路由表里找到去特定目的地址的路径,则数据均被路由到地址为192.1.0.65的相邻路由器。
9 x1 `7 a, D, h: h# Z
第二章 广域网协议设置. R1 |* [4 h7 J5 V" h
一、HDLC 5 \( B' t" f. f) `! f. d2 m- J
 # l8 o% Q8 n: I7 F4 M/ G
HDLC是CISCO路由器使用的缺省协议,一台新路由器在未指定封装协议时默认使用HDLC封装。
# W- ~+ w+ |/ G' q: b1 R& z1.        有关命令4 g6 T7 Z4 [8 F" o
端口设置
! b, w8 o: J+ ]! M9 o, p$ b3 a, u任务 命令 $ a: L/ b. e3 @% g0 P
设置HDLC封装 encapsulation hdlc
! G5 T5 n" @( C1 Q设置DCE端线路速度 clockrate speed - ~0 g- g& j+ y' }
复位一个硬件接口 clearinterface serial unit , q" T, r/ B* z. b" Q
显示接口状态 showinterfaces serial [unit] 1
0 X& k( G5 n- f4 }注:1.以下给出一个显示Cisco同步串口状态的例子. 5 Q5 O* j! ?$ y& X
Router#show interface serial 0
" V4 o+ }3 ]5 v% |# Q$ ?# o7 HSerial 0 is up, line protocol is up ( O% r- s2 U# @8 G0 c
Hardware is MCI Serial
0 g6 V8 S% S, iInternet address is 150.136.190.203, subnet mask is 255.255.255.0 ' o2 W. G. b5 o3 T7 b! T; u
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec, rely 255/255, load 1/255 ' {+ f3 j. w& r  P- Q
Encapsulation HDLC, loopback not set, keepalive set (10 sec)
# l' {- h# w% @2 Z8 V8 r/ GLast input 0:00:07, output 0:00:00, output hang never / j; `7 D7 N1 M, x
Output queue 0/40, 0 drops; input queue 0/75, 0 drops   B  ]4 g% N* d# M9 q2 \3 d- R8 n
Five minute input rate 0 bits/sec, 0 packets/sec
, [5 R  _3 m, k. D2 `; R0 xFive minute output rate 0 bits/sec, 0 packets/sec ( F8 g( u; e1 E. ^' P
16263 packets input, 1347238 bytes, 0 no buffer
' c& R' [1 D5 `! ]6 Y: M# gReceived 13983 broadcasts, 0 runts, 0 giants 2 I2 @5 G) y, K6 Y9 E
2 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 2 abort   M4 `% V; J- e  {" l, D
22146 packets output, 2383680 bytes, 0 underruns & |6 [0 k1 M  ]+ l, G. e$ C( }% {
0 output errors, 0 collisions, 2 interface resets, 0 restarts - N# }( x6 W9 |% U
1 carrier transitions        2 P/ B# F* ]3 u' g) U
2.        举例
8 I& p- l7 B7 b6 h$ v1 \5 F6 m. E

5 j2 [/ K  X1 ?/ t; A# L' T 9 S0 n% c3 a% l' h' M) e
 
设置如下:
. q7 I! F2 a" _$ L8 xRouter1:
  ~9 X0 N8 N) w, G9 n3 ^) K& finterface Serial0
$ u* E7 U  t2 u5 v4 Qip address 192.200.10.1 255.255.255.0 7 _/ \& [+ d7 \
clockrate 1000000
; w; n9 o2 m0 |7 s - t% O" x6 W1 d
Router2:
4 m: k) a2 N' g" `5 T/ U% o! ?- j5 Zinterface Serial0
) O  D0 |1 A. R2 m! Lip address 192.200.10.2 255.255.255.0 0 q6 a8 q6 x; ?0 c
! * v8 N% K2 N" E( z
3.      举例使用E1线路实现多个64K专线连接.# v7 f! z$ \$ u
相关命令:
5 P  u0 i  n. }7 ^  a任务 命令
2 e. w: q9 ~) @) ~, Y5 [3 v进入controller配置模式 controller {t1 | e1} number & d* M. y: u5 q* a- S0 C& l" {) g
选择帧类型 framing {crc4| no-crc4}
2 ?; L1 z7 Q7 k0 V  E4 m选择line-code类型 linecode {ami | b8zs | hdb3}
: K5 J+ r( w* U+ B2 \8 \0 C  {建立逻辑通道组与时隙的映射channel-group number timeslots range1 / A1 ]. l2 b5 _( B
显示controllers接口状态 show controllers e1 [slot/port]2
% _1 \' g  @" @+ ^+ s * N3 A. s0 Y$ E+ _* r  r- [% `
注: 1. 当链路为T1时,channel-group编号为0-23, Timeslot范围1-24;当链路为E1时, channel-group编号为0-30, Timeslot范围1-31.  1 [2 t6 M6 R8 R! d7 u; t& ?
2.使用showcontrollers e1观察controller状态,以下为帧类型为crc4时controllers正常的状态.
" P+ C, Z- ]5 j3 l/ y" E2 E
1 y/ d; `; [; U0 \/ r! K' F( n) ERouter# show controllers e1 # e0 X% X3 H3 p8 i+ n0 V
e1 0/0 is up. ( G# w0 t; Q# f
Applique type is Channelized E1 - unbalanced
3 B0 b* `" d. V% d' f6 BFraming is CRC4, Line Code is HDB3  No alarms detected.
0 s0 W# E7 }% t6 L9 [+ W5 [6 }Data in current interval (725 seconds elapsed):
( J8 r7 U3 y; k+ E7 M* o+ a0 Line Code Violations, 0 Path Code Violations 5 V* R, m) s  A3 x, n9 _" o3 @" d; R
0 Slip Secs, 0 Fr Loss Secs, 0 Line Err Secs, 0 Degraded Mins 7 z! ?: I$ E1 X( S8 ]3 C
0 Errored Secs, 0 Bursty Err Secs, 0 Severely Err Secs, 0 Unavail Secs * C+ d3 x" M( y* [
Total Data (last 24 hours)     0 Line Code Violations, 0 Path CodeViolations,
, k4 C6 B7 [3 {1 a# e0 Slip Secs, 0 Fr Loss Secs, 0 Line Err Secs, 0 Degraded Mins, 9 i2 d8 n( v. C6 T
0 Errored Secs, 0 Bursty Err Secs, 0 Severely Err Secs, 0 Unavail Secs
1 @3 z8 m* O5 c$ s8 h
0 c3 X+ t8 O5 }9 f' Q! ?' g1 j/ f" b以下例子为E1连接3条64K专线, 帧类型为NO-CRC4,非平衡链路,路由器具体设置如下:
! w" s# ~, A* a% ]6 mshanxi#wri t
# r) d' T& N, A! a' u, z0 cBuilding configuration...
  q- E; _  ~: O
* ?- X2 v0 [! |& j% aCurrent configuration:
! S# \( Q, p/ o' p' B2 L- g!9 Y0 ]7 o3 J) [' ?% s
version 11.2
( l; e8 B7 W* ]" Y8 J4 s( w  tno service udp-small-servers
) J1 f& v0 v+ v# W- q' `9 y: ~/ Xno service tcp-small-servers3 a% B: N7 x- M
!- G! T  h3 {6 x8 X7 U$ M4 y4 F
hostname shanxi
, Q: j3 V/ }) V, b# X!
. J! P# ?$ a& n! v! o% ~enable secret 5 $1$XN08$Ttr8nfLoP9.2RgZhcBzkk/
( X5 B% S# y/ c4 f0 Lenable password shanxi
6 q- z8 |+ N4 N. W0 W% _6 Q!# X8 y' e0 Z2 m! Z; U
!5 C# t1 |8 @: n. y% g# S
ip subnet-zero4 s+ p) R  x  `+ O9 N
!
' F- x, k# K& c1 }& E, S. Ucontroller E1 0 : H$ r4 f1 X! J% N$ }! P; n
framing NO-CRC4 6 _/ G; x4 J4 k5 K- U6 f, X
channel-group 0 timeslots 1 7 K- _; k: f1 F, u; c
channel-group 1 timeslots 2
) a  i* H9 x6 Y8 Echannel-group 2 timeslots 3 * m. H* v) ?* V
!
! k8 q1 j. Q! F5 Q6 o8 kinterface Ethernet0
; u1 a- P9 ~+ m! zip address 133.118.40.1 255.255.0.0& k4 Z/ @4 B* Z+ ?/ B- r
media-type 10BaseT
/ @: s0 y- T/ M' v!
: \0 }% J. k5 f; i! J- p  z0 Y  s" `interface Ethernet1% C+ A+ l6 D' `( n2 h3 D
no ip address3 l8 s! `( @1 k; |) o! `
shutdown
2 X( }* n$ C2 o0 b' F0 o$ `!
5 u1 {# R0 F  V+ X0 g. q3 F6 _interface Serial0:0 2 v. M$ o) D6 g( w, `
ip address 202.119.96.1 255.255.255.252( ~, |; u" F9 N$ _# S* W; ~- _
no ip mroute-cache" n) m# X# b. c! g7 D
!- A9 S' o: K$ e8 x
interface Serial0:1
# o, e2 V) k8 K$ R" J6 f7 Q% d- Kip address 202.119.96.5 255.255.255.252( ^7 m! W3 u) g4 }4 m
no ip mroute-cache
( k; z+ k! b; {: c) w!
, Z, Z* x: o# J! @; zinterface Serial0:2
+ J; Z4 Z- ]% _2 Lip address 202.119.96.9 255.255.255.2522 i/ W4 C2 X. R0 L- ]7 h
no ip mroute-cache
: y1 G- [0 y3 X& w!
  b  N" F* g1 L# jno ip classless
! L; n4 E) x) v  [+ p7 v9 ?- D  tip route 133.210.40.0 255.255.255.0 Serial0:0  u8 H# J# Y1 W) q: U  G* d0 c; u
ip route 133.210.41.0 255.255.255.0 Serial0:1) B0 {6 m+ h3 ?7 S
ip route 133.210.42.0 255.255.255.0 Serial0:2% a. t% L6 l, h1 j+ U4 W/ \( c- T
!
; k& @% n$ j+ Dline con 00 ]5 P! E5 A/ s4 [" [7 i0 ~1 v) d
line aux 0: ]; E: [: P1 w
line vty 0 40 @; ]5 l+ o! S4 {
password shanxi
8 T, n1 @2 c- c4 P/ @login2 b7 F- e$ s! H+ ?  _. ~1 Y$ Z
!3 z8 Z$ T% B# b: P, H( J0 ]0 [: i
end
二、PPP
0 w$ g& A3 o) w 
% H, U5 ?5 O$ J( RPPP(Point-to-Point Protocol)是SLIP(SerialLine IP protocol)的继承者,它提供了跨过同步和异步电路实现路由器到路由器(router-to-router)和主机到网络(host-to-network)的连接。
' q' I2 L6 X0 X) ~. Y+ jCHAP(Challenge Handshake Authentication Protocol)和PAP(Password Authentication Protocol) (PAP)通常被用于在PPP封装的串行线路上提供安全性认证。使用CHAP和PAP认证,每个路由器通过名字来识别,可以防止未经授权的访问。) I1 d+ u) ~( R/ l! V" h
CHAP和PAP在RFC 1334上有详细的说明。9 _/ k+ }* t0 ]9 J7 D, i
1.        有关命令
0 _; u3 [& d% p6 F) c1 m6 N端口设置
' `0 V7 `0 p. W. ^3 Q任务 命令
5 d  ~6 O( b7 W, Y设置PPP封装 encapsulation ppp1 * p) H) [: ?" U& v  J3 |4 U
设置认证方法 pppauthentication {chap | chap pap | pap chap | pap} [if-needed] [list-name |default] [callin]
5 ^0 u* t9 \; m' Q) r* o' y# k指定口令 usernamename password secret
4 U; U: W6 T6 K$ ^! O) U( |3 ~# f设置DCE端线路速度 clockrate speed 6 N9 Q6 s; D0 x+ W( C6 t
注:1、要使用CHAP/PAP必须使用PPP封装。在与非Cisco路由器连接时,一般采用PPP封装,其它厂家路由器一般不支持Cisco的HDLC封装协议。  
, M" W3 u9 G, l" j2.        举例
% w5 u7 g6 F9 J; e9 O& Y路由器Router1和Router2的S0口均封装PPP协议,采用CHAP做认证,在Router1中应建立一个用户,以对端路由器主机名作为用户名,即用户名应为router2。同时在Router2中应建立一个用户,以对端路由器主机名作为用户名,即用户名应为router1。所建的这两用户的password必须相同。% O* m" ~( c8 N( ^/ C

* b  r$ h+ |5 H1 d设置如下:
# P# P3 r2 b( s. h8 CRouter1: , w( [( Z6 `, z; }, }, p
hostname router1   }" X! a* X8 G% R  }  a1 j, d, b
username router2 password xxx 4 Y/ L) [$ r  w/ v( K; x
interface Serial0
3 D; x4 o; f. Z: ?7 Fip address 192.200.10.1 255.255.255.0 - x; Z  N, G: V; U. {7 I+ u3 F
clockrate 1000000
' |, a2 N: {# O- \+ n  Qppp authentication chap $ r" q% ^3 @" F# H9 F/ H1 ~" c" P
!
' O. B0 t+ k* w0 z. PRouter2: : ~3 X( r( T5 A
hostname router2 + V6 d, [9 Z# w' Q- A
username router1 password xxx
0 }" P: r: [3 H( \/ b; Zinterface Serial0 0 V$ D% l; N- k2 Y3 D
ip address 192.200.10.2 255.255.255.0
' S4 R% e. a/ g+ ^ppp authentication chap
9 j3 I. T( D5 m4 o& N% X9 u' ]- u!
三、x.253 T7 \7 E2 P# d% @1 R
1.        X25技术) J/ h8 S9 q( n) ?8 O
X.25规范对应OSI三层,X.25的第三层描述了分组的格式及分组交换的过程。X.25的第二层由LAPB(Link Access Procedure, Balanced)实现,它定义了用于DTE/DCE连接的帧格式。X.25的第一层定义了电气和物理端口特性。2 y( E' e% S0 D+ ^. ~7 ~- F0 ~) G
X.25网络设备分为数据终端设备(DTE)、数据电路终端设备(DCE)及分组交换设备(PSE)。DTE是X.25的末端系统,如终端、计算机或网络主机,一般位于用户端,Cisco路由器就是DTE设备。DCE设备是专用通信设备,如调制解调器和分组交换机。PSE是公共网络的主干交换机。
; a7 N3 ^% t* ^X.25定义了数据通讯的电话网络,每个分配给用户的x.25 端口都具有一个x.121地址,当用户申请到的是SVC(交换虚电路)时,x.25一端的用户在访问另一端的用户时,首先将呼叫对方x.121地址,然后接收到呼叫的一端可以接受或拒绝,如果接受请求,于是连接建立实现数据传输,当没有数据传输时挂断连接,整个呼叫过程就类似我们拨打普通电话一样,其不同的是x.25可以实现一点对多点的连接。其中x.121地址、htc均必须与x.25服务提供商分配的参数相同。X.25PVC(永久虚电路),没有呼叫的过程,类似DDN专线。
& S: k% a# s' T3 L0 _% e2.        有关命令:
. h: v& x; b& G- M  R任务 命令 ( B( P( J0 x3 o0 s
设置X.25封装 encapsulation x25 [dce]
7 I& E+ g' L, U8 m1 h; f7 d设置X.121地址 x25 address x.121-address ' a! z5 |. T" U$ K6 n6 D9 I% {
设置远方站点的地址映射 x25map protocol address [protocol2 address2[...[protocol9 address9]]] x121-address[option] 9 }# _8 M; W: Y! \& c
设置最大的双向虚电路数 x25htc citcuit-number1
' e4 q5 k9 V4 Q: E设置一次连接可同时建立的虚电路数x25 nvc count2
% o- F  q2 X& [8 M2 [设置x25在清除空闲虚电路前的等待周期 x25 idle minutes % M0 j- Y+ l1 K( y; R' h- V$ }& \0 ^) [7 b
重新启动x25,或清一个svc,启动一个pvc相关参数 clear x25{serial number | cmns-interface mac-address} [vc-number] 3
9 W# D3 E/ `9 c6 s# y4 R4 U8 f! w6 R7 j9 A清x25虚电路 clear x25-vc
- s8 s- y. K: e显示接口及x25相关信息 show interfaces serial show x25interface show x25 map show x25 vc 0 B' q" N: P: D$ x8 _, L2 s6 _
注:1、虚电路号从1到4095,Cisco路由器默认为1024,国内一般分配为16。
( v! `4 |) ]2 c( H* F% ^9 A  2、虚电路计数从1到8,缺省为1。
# {( X0 |  c4 b  3、在改变了x.25各层的相关参数后,应重新启动x25(使用clear x25 {serial number |cmns-interface mac-address} [vc-number]或clear x25-vc命令),否则新设置的参数可能不能生效。同时应对照服务提供商对于x.25交换机端口的设置来配置路由器的相关参数,若出现参数不匹配则可能会导致连接失败或其它意外情况。
+ `6 M  O. p2 A& s3.        实例:# Y7 f$ I+ k( l
3.1. 在以下实例中每二个路由器间均通过svc实现连接。" S5 P) p+ V! r7 |0 @& p8 ?

: i" d7 t, w1 g* w5 k+ }' k   % |7 H' R7 d, v# Q% e; D# Z
路由器设置如下: $ Z$ P/ E1 F3 G- E
Router1:
9 a3 y/ t0 T, Y5 f& J' H+ Ginterface Serial0 6 f, r* i+ r- q  G
   encapsulation x25 7 A: y3 S% z+ T- ]# o
   ip address 192.200.10.1 255.255.255.0 ) t6 \" U2 W( ]8 R- U, \
   x25 address 110101
0 {# u' k0 o% x& X   x25 htc 16
) M( P/ _, S6 M* A   x25 nvc 2
, W/ B* _3 Z5 {8 z( O2 j/ g. l   x25 map ip 192.200.10.2 110102 broadcast
' c* M, F' m9 W% r9 ~+ @   x25 map ip 192.200.10.3 110103 broadcast 5 F7 A; ?& a' e( u7 y1 ^
!
! S6 `6 ?; [' d+ ^; l5 S. w 9 x7 a2 H, k8 A1 g8 i0 t# t1 Z& a
Router2:
8 j9 ^1 v4 A7 c1 jinterface Serial0 # Y, h) x8 @3 g, e( ?
   encapsulation x25 3 A6 G; C7 r: `4 O0 y
   ip address 192.200.10.2 255.255.255.0 , ^) X5 g8 k- u& W; G) R5 h- F
   x25 address 110102 ! U6 P9 X1 n/ E/ g
   x25 htc 16
5 p! c0 G. E* T) S* T. n   x25 nvc 2
5 l6 G, L3 x9 q# I  d. v/ {9 C   x25 map ip 192.200.10.1 110101 broadcast ( \- D  E/ P' \: H
   x25 map ip 192.200.10.3 110103 broadcast
$ E/ u9 L, u9 M7 }6 C! 0 r8 A- c0 B3 a2 ?% u

2 _" n# G+ B- i3 y7 cRouter: ( i7 `! E# }5 i# O9 S
interface Serial0
, Y2 g* _' T$ c9 l   encapsulation x25
/ x* w7 [' U6 j. b; k   ip address 192.200.10.3 255.255.255.0 6 i4 T2 Z+ U6 Q( |# w. P
   x25 address 110103
$ a  K( ~) r$ C% `3 P# J! l   x25 htc 16 ( f+ }1 |. P. l
   x25 nvc 2 # n) y/ x! i0 N! p1 U# ]' K
   x25 map ip 192.200.10.1 110101 broadcast + N8 m, P) x5 o! K% P
   x25 map ip 192.200.10.2 110102 broadcast / s6 t) l7 J, k% L3 @
! 8 C+ ]' i) [/ e- k7 r

; O6 `. Q5 @, a3 \) ^相关调试命令:
- F* L1 m1 B: C9 Y: Lclear x25-vc # i' L% R% _1 l6 I8 H
show interfaces serial
( a8 N" g* f; ]7 n' l  b7 jshow x25 map 8 k5 b1 K& \# _1 i3 E, f7 \
show x25 route 0 q3 ?1 A7 r9 \% y. k; [
show x25 vc
0 s* q3 J. x) ?6 B% K8 G3.2. 在以下实例中路由器router1和router2均通过svc与router连接,但router1和router2不通过svc直接连接,此三个路由器的串口运行RIP路由协议,使用了子接口的概念。由于使用子接口,router1和router2均学习到了访问对方局域网的路径,若不使用子接口,router1和router2将学不到到对方局域网的路由。
4 d5 f& O$ l+ p2 H, Q, d$ l! K" b: R 子接口(Subinterface)是一个物理接口上的多个虚接口,可以用于在同一个物理接口上连接多个网。我们知道为了避免路由循环,路由器支持split horizon法则,它只允许路由更新被分配到路由器的其它接口,而不会再分配路由更新回到此路由被接收的接口。% J; f2 t1 w8 S# V1 j
无论如何,在广域网环境使用基于连接的接口(象 X.25和Frame Relay),同一接口通过虚电路(vc)连接多台远端路由器时,从同一接口来的路由更新信息不可以再被发回到相同的接口,除非强制使用分开的物理接口连接不同的路由器。Cisco提供子接口(subinterface)作为分开的接口对待。你可以将路由器逻辑地连接到相同物理接口的不同子接口, 这样来自不同子接口的路由更新就可以被分配到其他子接口,同时又满足splithorizon法则。
9 r) T# ~- N1 i" L! R! h. h, F- b5 b/ D, A. h" v; Y, [0 }
Router1:
% F0 W! F4 A" W; F3 Minterface Serial0
! J! ~3 E- l3 [  C# }# Tencapsulation x25 : ?- O% D: L# N& l8 a
ip address 192.200.10.1 255.255.255.0 / o' a' B) i) R1 y8 X/ k
x25 address 110101 - u# o+ y3 }7 ^7 ]
x25 htc 16
- o' a  a/ G  V8 m* w3 l$ G6 Ax25 nvc 2 . ?9 b- t( c+ X4 u( ?- B* ]0 U7 G) [
x25 map ip 192.200.10.3 110103 broadcast   Q1 @/ ^0 A( s% F/ J8 i
! ( M6 ]; @7 C# d! L: N
router rip ; v8 E6 K1 g5 g) W! i
network 192.200.10.0
0 ?9 f1 X6 J/ u. C" ]3 v. Z" G+ n!
* i4 _! ^! Q: m % }% M" p0 @# J  w6 R' p5 w  U
Router2: 0 ], r; J. N; F9 g0 N) ]/ m0 e
interface Serial0 ) f2 G2 w! r% f* f4 u9 k( z! j$ |
encapsulation x25 . v+ m! f# ?6 H' S$ w2 M
ip address 192.200.11.2 255.255.255.0 - }4 K% W/ s; ?. f
x25 address 110102 $ B8 v$ O% _$ d/ l$ s9 M
x25 htc 16 7 u9 x, M. u+ U
x25 nvc 2
0 I4 x) s, E6 J2 U4 m: [x25 map ip 192.200.11.3 110103 broadcast * }$ R* x% ~8 z1 Y; d$ l8 n
!
) ^1 z) {% V2 k6 s+ y( f) Grouter rip
  ~# i; N$ ?, b2 K% C$ k1 q; I  G. Wnetwork 192.200.11.0
) r; \6 ^; q: ^1 Q- s( {( ~!
; r, n! q- m0 S  O% b0 D2 `9 z
! R1 n+ ?' \+ r' @Router:
+ U9 w0 a! ?$ Y) I9 Ginterface Serial0 3 P3 C: T& ^0 P) j0 [! G+ W
encapsulation x25
' ?! t" F$ v* R' Q- Q) ux25 address 110103 ( e7 m: C9 z0 w1 q
x25 htc 16   c4 ]6 U9 T; x
x25 nvc 2
1 T# ]5 Y# c3 z, T8 F1 X( _! # `) G) Q6 j$ f  n8 ?! J( H
interface Serial0.1 point-to-point
- N2 G) O8 ?* v0 }ip address 192.200.10.3 255.255.255.0 $ U9 K0 J* ]" D0 K& i- X& y
x25 map ip 192.200.10.1 110101 broadcast
; l, b2 d8 U; f" M' y!
9 S, A7 ^3 V5 w! O) I! einterface Serial0.2 point-to-point ( s" k0 k* l- v. x" J$ m, l
ip address 192.200.11.3 255.255.255.0 , X: d7 W& r( m
x25 map ip 192.200.11.2 110102 broadcast
+ A# D4 l5 i; C% B# u! % A( E. H# {2 H& }% B
router rip
8 R! t9 K9 V7 p3 [) a8 @network 192.200.10.0 5 j4 k( f# J. [) A
network 192.200.11.0
6 R' p- y% ~/ W/ c) A!
; z0 h4 u1 }% C
四、Frame Relay 4 |+ g6 R% T9 n# M
1.      帧中继技术 ! ^& T# `3 S* V8 R# _, I
( m7 r) W7 [" \2 k1 A
帧中继是一种高性能的WAN协议,它运行在OSI参考模型的物理层和数据链路层。它是一种数据包交换技术,是X.25的简化版本。它省略了X.25的一些强健功能,如提供窗口技术和数据重发技术,而是依靠高层协议提供纠错功能,这是因为帧中继工作在更好的WAN设备上,这些设备较之X.25的WAN设备具有更可靠的连接服务和更高的可靠性,它严格地对应于OSI参考模型的最低二层,而X.25还提供第三层的服务,所以,帧中继比X.25具有更高的性能和更有效的传输效率。
- T6 g: r+ o. d: X1 \% Q帧中继广域网的设备分为数据终端设备(DTE)和数据电路终端设备(DCE),Cisco路由器作为 DTE设备。 , P' B, k0 E& d2 q7 D" L' G
帧中继技术提供面向连接的数据链路层的通信,在每对设备之间都存在一条定义好的通信链路,且该链路有一个链路识别码。这种服务通过帧中继虚电路实现,每个帧中继虚电路都以数据链路识别码(DLCI)标识自己。DLCI的值一般由帧中继服务提供商指定。帧中继即支持PVC也支持SVC。
; H7 {9 W  A5 ~5 H1 R帧中继本地管理接口(LMI)是对基本的帧中继标准的扩展。它是路由器和帧中继交换机之间信令标准,提供帧中继管理机制。它提供了许多管理复杂互联网络的特性,其中包括全局寻址、虚电路状态消息和多目发送等功能。  
, B/ }# q( Y# x: Q# z; Q2 h+ E2.        有关命令:  
* M3 _4 D7 s) Z- i7 F% \端口设置
/ U9 t2 K* O& d! O任务 命令
/ H2 v, ~! R1 M8 a4 b* u设置Frame Relay封装 encapsulation frame-relay[ietf] 1
6 r# @/ i6 k  r7 x, A2 b; X设置Frame Relay LMI类型 frame-relay lmi-type {ansi | cisco |q933a}2, ^* S; T! {! f
设置子接口 interfaceinterface-type interface-number.subinterface-number [multipoint|point-to-point]
! p* b( j5 ]+ b; V5 }; s# {+ w映射协议地址与DLCIframe-relay map protocol protocol-address dlci [broadcast]3
+ h- y2 f6 c; n设置FR DLCI编号 frame-relay interface-dlci dlci[broadcast]
$ D; e" b6 Z# F+ Z# `注:1.若使Cisco路由器与其它厂家路由设备相连,则使用Internet工程任务组(IETF)规定的帧中继封装格式。 $ ]! m2 o4 X' k% c& G$ ?& k6 l# }
2.从Cisco IOS版本11.2开始,软件支持本地管理接口(LMI)“自动感觉”, “自动感觉”使接口能确定交换机支持的LMI类型,用户可以不明确配置LMI接口类型。 # V  \: Y  Z4 X1 P, o4 S
3.broadcast选项允许在帧中继网络上传输路由广播信息。$ d4 J9 C( x: @9 _1 F' [/ c. q
3.   帧中继point to point配置实例:  ; Y1 }4 X3 W# b0 v( Y4 G
6 \7 V' B* h2 q' j
Router1:9 ?5 U2 L7 H' t& t: F# A) t
interface serial 0
* L) t" I. V% b! K  q' W' |% `  Y" Pencapsulation frame-relay   a2 j& q/ A) i- t6 L: K5 a
! ( x+ n, M. v' W, a8 E
interface serial 0.1 point-to-point 6 J# s! o- X3 R! R7 j
ip address 172.16.1.1 255.255.255.0 + p3 J4 q# g$ J2 F5 R- a3 i
frame-reply interface-dlci 105
1 H( h. u" r! h0 b* _! 8 h3 g! l1 i5 D$ `/ Z, z
interface serial 0.2 point-to-point
3 D+ S2 `! a% Z: \4 C7 Vip address 172.16.2.1 255.255.255.0 & n' r; n$ b: i4 U& k" E, U
frame-reply interface-dlci 102
8 r" s) p9 A  F, g9 E!
  ]' O$ T: k9 sinterface serial 0.3 point-to-point ) m3 d! r5 h3 Y$ m
ip address 172.16.4.1 255.255.255.0 - G' c0 c/ W! g
frame-reply interface-dlci 104
4 ?. u" ]% R+ Y0 j' Y% Y( e! # }$ E# n( Z5 d1 Z  y& d( V: f" i
Router2: , p6 v  U$ k" n0 x3 ?
interface serial 0 . |; d  e# }  P8 y4 D, m' _
encapsulation frame-relay
( Q; p! Z3 a2 Z2 B! * R- P8 o! {; Q1 @% m1 \5 x( a
interface serial 0.1 point-to-point % M, x, T  D# \! r3 b
ip address 172.16.2.2 255.255.255.0 - m/ T! g1 v, F- t
frame-reply interface-dlci 201
$ c6 B' z/ A4 @3 q7 N, L!
) `7 x6 ~& k* O6 a8 einterface serial 0.2 point-to-point
1 t! K5 G* P7 R  n+ Iip address 172.16.3.1 255.255.255.0 ! q' h4 z' m6 y  c) X- l9 c# P
frame-reply interface-dlci 203 % n8 m. a5 a( ]4 S2 _6 g
! % C9 \1 y1 f+ R0 D7 X" q7 W# i8 k) k
相关调试命令:
+ ~7 Y% t; e6 [( A) I2 dshow frame-relay lmi
' P. n' H* e& {" Q" B6 c( B* Wshow frame-relay map ( `. T! t2 k, O: c
show frame-relay pvc
6 r4 @4 S3 W0 n6 i' q, y9 y/ mshow frame-relay route
# S' C3 G$ J% I0 K* v/ }0 O* _6 ^show interfaces serial , }: v: J+ L0 e0 h
go top
1 ]" [4 q& U7 a! d9 l- m5 A8 I9 m4.        帧中继 Multipoint 配置实例:
. `0 Y2 r/ U3 l4 c3 Z
) o- {8 l8 j; ~. _Router1:
# q* |+ P( D6 ]8 B8 O' q9 uinterface serial 0 ' V8 `  }5 p6 R1 E* n/ m
encapsulation frame-reply
! k7 ]- E3 @  T) |" p. N! 2 F1 m+ k4 m# h$ D) q$ l
interface serial 0.1 multipoint 9 y. o+ t! a, M) b% Q5 w
ip address 172.16.1.2255.255.255.0 . t# x/ |5 }1 ^1 G# E/ V
frame-reply map ip 172.16.1.1 201 broadcast
: e: V, Y+ L9 N% _frame-reply map ip 172.16.1.3 301 broadcast
7 |" t$ d' \2 Z" ?/ Y4 I( Pframe-reply map ip 172.16.1.4 401 broadcast 3 z3 H& L% P7 Y2 Z3 H% ~
!
7 G( C: q+ F* {2 i, W% K" u9 u! WRouter2: . a: ~5 W! S5 {4 Z4 n+ P9 x" u" Z
interface serial 0
  S2 x  l, \5 ]encapsulation frame-reply ' y3 ~: p. X, n- x9 ?* k) r
! 1 e+ i: F  `( E& w% i
interface serial 0.1 multipoint
; w0 w  H  _+ N: f0 ]5 g3 S, Iip address 172.16.1.1255.255.255.0
' b. u# c% b' Dframe-reply map ip 172.16.1.2 102 broadcast
9 Q1 Y- |  B  ?frame-reply map ip 172.16.1.3 102 broadcast . a6 s! A: C- W) v4 w3 a' Z
frame-reply map ip 172.16.1.4 102 broadcast   H6 i; E+ M" h& ]
!" s# r" b" e! I1 m2 }# r: N
五、ISDN
- C$ y0 [/ B3 J( P 5 g2 `7 g+ [- `. o/ r
1.        综合数字业务网(ISDN)* d! c0 ?5 |6 M/ S$ D+ V/ e8 H
综合数字业务网(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。; q( `4 H% x' G1 a( T7 s
2.        基本命令& j- x4 M$ [" h' t) V0 z
任务 命令 0 l# A; @( D* v8 v% o& O7 X
设置ISDN交换类型 isdn switch-type switch-type1   V/ y4 W; r9 Y8 t5 u
接口设置 interfacebri 0
8 v8 r1 p4 g5 N5 k设置PPP封装 encapsulation ppp
( a* I2 ]. U  d, _# {设置协议地址与电话号码的映射dialer map protocol next-hop-address [name hostname] [broadcast] [dial-string] % M) k! e: U/ A7 |
启动PPP多连接 ppp multilink
7 C8 j' {6 V, K3 V设置启动另一个B通道的阈值 dialer load-threshold load + I; \5 f, p6 t4 H( T5 E
显示ISDN有关信息 show isdn {active | history |memory | services | status [dsl | interface-type number] | timers} - l6 s/ r, Q3 p& z' P5 y
注:1.交换机类型如下表,国内交换机一般为basic-net3。
8 C" b6 k  n  W按区域分关键字                 交换机类型
. [2 n0 w  k% h, A6 m, PAustralia  
/ q5 b  `. v( ybasic-ts013 Australian TS013 switches 9 p- e  O9 l/ x3 J
Europe  ' j  p3 E  M/ g  Y
basic-1tr6 German 1TR6 ISDN switches
" @7 \; d1 k' ~( hbasic-nwnet3 Norway NET3 switches (phase 1) ! H# E9 b$ U, V- `/ P" p
basic-net3 NET3 ISDN switches (UK, Denmark, and other nations); covers theEuro-ISDN E-DSS1 signalling system
3 ?  ?% H, Z  a7 x" D' ~primary-net5 NET5 switches (UK and Europe)
7 \0 _9 W( f7 rvn2 French VN2 ISDN switches , Q( Y5 d% d8 I1 R
vn3 French VN3 ISDN switches ' N% e, W) G3 o
Japan  7 B& y1 z# q9 @9 T$ G
ntt Japanese NTT ISDN switches 8 U: d5 ~2 D7 i3 L9 ~
primary-ntt Japanese ISDN PRI switches 7 r" U, j$ g6 d! {3 T+ b
North America  * `) p1 k1 y. U! y" e1 O/ ?
basic-5ess AT&T basic rate switches 2 I  t. S0 l% B! X  O; H1 x6 W* E
basic-dms100 NT DMS-100 basic rate switches   W7 F! X: |( \3 H$ H% E
basic-ni1 National ISDN-1 switches 6 ?1 k" k& v4 l/ r. a
primary-4ess AT&T 4ESS switch type for the U.S. (ISDN PRI only) # R5 E" e. E! j6 R2 @) B
primary-5ess AT&T 5ESS switch type for the U.S. (ISDN PRI only) 2 n  ]7 n$ e7 O+ H0 O7 t
primary-dms100 NT DMS-100 switch type for the U.S. (ISDN PRI only)   v7 V, l9 Q% u% V$ e/ [% W$ o
New Zealand 9 W) ?' t7 M, ^& _
basic-nznet3 New Zealand Net3 switches ( g2 C! Z3 Y: t. w/ I! |$ D
3.        ISDN实现DDR(dial-on-demandrouting)实例:' v! Y' e9 \3 G; o# a) m' i
" y% S; \. M+ |, ]8 q
设置如下:- ~2 t( k" S0 z7 A" a; ~% `
Router1:
3 G2 n- y/ F3 O1 Ohostname router1 2 Z+ {8 |& w/ n* N$ J) ^
user router2 password cisco 4 J3 ?; I# W6 f- y4 b1 g1 D
!
; `: v# w$ X% @; v( Q5 g7 g, Q% Yisdn switch-type basic-net3
5 A7 U! |& e: S7 k. k! - t7 O% [; e8 Z1 H4 u
interface bri 0
' G0 K% |+ O) N. [ip address 192.200.10.1 255.255.255.0 ) z' i8 e$ v$ l4 Z
encapsulation ppp
. O8 k& l+ U  L& \5 l" e, l' d+ |dialer map ip 192.200.10.2 name router2 572 % m0 p5 v) w, E: X/ n
dialer load-threshold 80
* V( e/ w/ K* z" |; Lppp multilink 6 I/ j) k8 a$ o& x
dialer-group 1
5 H$ @) M. s( p$ X( \ppp authentication chap 0 Z; _7 L, N: B& \  {9 m7 A
5 y; j5 q4 n4 @$ @* u( _
dialer-list 1 protocol ip permit + ~2 I5 Y" s4 D) a' ~: h
! 5 k/ i" q  q# r
9 d; S: q' A( V# e
Router2:
( Q4 m+ J; C3 y% |& Z9 S6 E4 _hostname router2 " |) h  s3 v" d7 H1 N
user router1 password cisco
( J4 b4 ?) T% h# k# Y9 f!
: c. ]3 c. i# ]" _isdn switch-type basic-net3 # A- O0 V  w& Q& M
! * u/ D! ]: t3 g8 g+ u2 p8 R& v
interface bri 0
) v: F" j9 Y' y# ~, ]4 Gip address 192.200.10.2 255.255.255.0 ! \/ n' x2 Q, q  f% K: H, f, ~
encapsulation ppp
* l. ^7 D1 y# d/ Ndialer map ip 192.200.10.1 name router1 571 5 z# n# r4 H, k' J0 Z' E# Z4 G
dialer load-threshold 80  / O0 g& y1 _6 V0 c, n
ppp multilink
  E% M3 t+ i6 X: h4 {dialer-group 1 8 L' {+ ?! V* d4 A7 m: F
ppp authentication chap
, c3 b0 a, V2 g6 d0 n% r4 k, F  v" F/ J4 E4 x
dialer-list 1 protocol ip permit % w: N# Q( r/ e" X
!
& z- D- y; X8 M7 {- Z6 V( q$ VCisco路由器同时支持回拨功能,我们将路由器Router1作为CallbackServer,Router2作为Callback Client。
9 L5 |+ k7 J: d# [与回拨相关命令: 4 D$ @; q" K5 H1 ^
任务 命令 # [2 y, s) C, P
映射协议地址和电话号码,并在接口上使用在全局模式下定义的PPP回拨的映射类别。 dialermap protocol address name hostname class classname dial-string # @- ^+ Z" h& J
设置接口支持PPP回拨 ppp callback accept
5 @  m' K  L$ e% n在全局模式下为PPP回拨设置映射类别 map-class dialer classname $ i0 e3 n! c$ X* V% Q0 E$ e/ ~4 r7 P4 E
通过查找注册在dialer map里的主机名来决定回拨. dialer callback-server[username]
5 `& B, n( p4 L: r, k5 W设置接口要求PPP回拨 ppp callback request  
! q% M# G9 G+ o设置如下:
( M3 y) f4 H) DRouter1:
' f) Q1 C9 Y* |) Xhostname router1
6 H# V. e: v2 V- o6 ~7 R- Ouser router2 password cisco
' j% G$ X+ a$ V! 3 H1 d1 Q5 {' A8 A" o/ ~
isdn switch-type basic-net3
% r3 P/ }9 C6 g+ P0 T9 d4 x6 l: [!
3 [9 Q* {8 `5 c, t( V0 @( zinterface bri 0
! w% [$ F. x% {$ d: W- zip address 192.200.10.1 255.255.255.0 3 r% N: R: a0 u1 G& f' s
encapsulation ppp & g) j; R8 a1 [9 V( f' ^
dialer map ip 192.200.10.2 name router2 class s3 572 3 W: X3 J1 n# c0 G- P
dialer load-threshold 80
: c/ C- P/ S- e3 fppp callback accept ! n) e; v9 R9 A, V
ppp multilink : r! E$ C: o0 b$ Y+ K! g& ~
dialer-group 1 1 _+ o, T& ?( \3 ?. p( `
ppp authentication chap
& |  H- T+ p. ^/ C
3 b' o- Y* g/ b' O0 k( S6 L+ D' q+ Mmap-class dialer s3 / Q5 O; L& @* F6 l2 ~
dialer callback-server username
3 c5 v/ Q  m9 V3 Q6 v' J. `0 w& Vdialer-list 1 protocol ip permit $ ^' @9 k4 c. E- H3 Z7 s
! ; c! @! p1 \  ~3 k: U4 K0 b

: Q  r5 S8 R/ M" gRouter2:
) S' Y. k( O' S8 X0 t; ehostname router2
. K8 u! D* A9 m0 }) E6 Auser router1 password cisco
7 N" a2 O- `6 M% V1 Q! 3 a8 S& l1 y5 e! {$ M& u; b0 F
isdn switch-type basic-net3 3 z1 b- |+ K+ W; Y- @5 s
! 8 V5 @; }) S6 H
interface bri 0 ' ]1 K1 [# Z$ v
ip address 192.200.10.2 255.255.255.0 % |  P% J; P6 Q: `& X8 v9 p8 [
encapsulation ppp + Z; L/ S, e) A8 v
dialer map ip 192.200.10.1 name router1 571
' l% N; N+ Z& {( ]/ adialer load-threshold 80 & f, }( d7 s. r# h
ppp callback request  1 ~+ ]' x" D, k
ppp multilink 0 _1 b& d1 w% k) D* h
dialer-group 1 ( q0 d! `+ f4 w4 L6 Z; Q% E
ppp authentication chap
3 K% s. N/ B3 G# l# X. S
, X, G0 F" p  e+ R0 K/ E' ~dialer-list 1 protocol ip permit 6 }* E2 T9 r: R3 k9 a; {
! ; }. F- L# w1 P1 C, l  @
相关调试命令: * B2 ]4 Q2 V& f* c$ q
debug dialer
: q! f+ a2 Y3 L- Fdebug isdn event
1 j# a$ k7 k; H! idebug isdn q921 4 V3 K. \7 l& V
debug isdn q931 $ J, T5 d; w* J9 d( y/ q' N8 e
debug ppp authentication
, Q6 s: r6 b& j% Fdebug ppp error 4 v3 B6 R& s8 k- Z( c) |' l
debug ppp negotiation 7 {0 Q1 P- I% d; |- f
debug ppp packet
2 f# g5 u/ M, l( q" ^# F# Wshow dialer
  t" n$ a7 _5 }show isdn status 4 h4 }4 f: \4 l6 B, k; P
举例:执行debug dialer命令观察router2呼叫router1,router1回拨router2的过程.
. V/ {" P: m8 ^& xrouter1#debug dialer 1 S  |) L- o- Z3 E9 q( p
router2#ping 192.200.10.1
( D- L# V# l2 o1 d8 k7 J# P
8 l9 q" b+ K( q% K6 u7 X( J; vrouter1# ) A+ T) a3 ^* s* W' E* Y7 u9 G
00:03:50: %LINK-3-UPDOWN: Interface BRI0:1, changed state to up
; ^3 Y7 c& ^& ~6 e% j3 S) M* o00:03:50: BRI0:1:PPP callback Callback server starting to router2 572
1 a8 m% _% l  N/ C. K00:03:50: BRI0:1: disconnecting call , U2 b  a1 E" x4 F) N* H+ p9 g
00:03:50: %LINK-3-UPDOWN: Interface BRI0:1, changed state to down
& S1 ]0 V* o# e00:03:50: BRI0:1: disconnecting call / |' O. X- x& b
00:03:50: BRI0:1: disconnecting call 3 U5 m9 I9 s& e
00:03:51: %LINK-3-UPDOWN: Interface BRI0:2, changed state to up - ]$ R1 m* N, p' Z
00:03:52: callback to router2 already started ; }# c! m) d' M: i: n& `9 q
00:03:52: BRI0:2: disconnecting call 5 u& f9 ?; _* y2 A
00:03:52: %LINK-3-UPDOWN: Interface BRI0:2, changed state to down " {* D2 n0 S; F- u, {6 f7 s* z* p
00:03:52: BRI0:2: disconnecting call
9 e2 }% ?6 u; g# E00:03:52: BRI0:2: disconnecting call
5 }- N" L* C. y00:04:05: : Callback timer expired 8 y5 G. n  W( Y9 H5 h
00:04:05: BRI0:beginning callback to router2 572 1 Z1 ]: P. [" x/ |
00:04:05: BRI0: Attempting to dial 572 ! @! Z: i! {7 j
00:04:05: Freeing callback to router2 572 ! N5 u8 f' p6 `9 \; T6 I5 j! O$ Z
00:04:05: %LINK-3-UPDOWN: Interface BRI0:1, changed state to up ' V, O4 r: M' K! Q  ~
00:04:05: BRI0:1: No callback negotiated + d1 @; ?; t: C6 r7 X& ~  x7 g
00:04:05: %LINK-3-UPDOWN: Interface Virtual-Access1, changed state to up 8 {; W: q/ U1 G+ [4 `
00:04:05: dialer Protocol up for Vi1
8 s, H) h( y, D0 f9 C+ b00:04:06: %LINEPROTO-5-UPDOWN: Line protocol on Interface BRI0:1, changed state
  _9 w  n: V- u, Ato up
! m2 Q# ~7 l: i8 K00:04:06: %LINEPROTO-5-UPDOWN: Line protocol on Interface Virtual-Access1,chang
/ c$ U( h+ `. M) Med state to up 6 n5 ]& ~% n/ o- i) `9 }
00:04:11: %ISDN-6-CONNECT: Interface BRI0:1 is now connected to 572 ( z8 ^# H  {7 |7 _4 w; b9 w
#router1 3 H4 u% o: J0 z- P
4.      ISDN访问首都在线263网实例:   N( b; ~: v* U6 J6 E
7 b0 F# D/ K2 z# y5 i$ d
本地局部网地址为10.0.0.0/24,属于保留地址,通过NAT地址翻译功能,局域网用户可以通过ISDN上263网访问Internet。263的ISDN电话号码为2633,用户为263,口令为263,所涉及的命令如下表:: H6 ?2 d+ V1 u: h8 d
任务 命令 9 _1 C- X/ F' g0 V4 @" R& m
指定接口通过PPP/IPCP地址协商获得IP地址 ip address negotiated
) h+ U8 T* O$ J% m  ]0 n指定内部和外部端口 ip nat{inside | outside}
) Q$ h3 n' r2 A( G9 x% _: u' }使用ppp/pap作认证 ppp authentication pap callin
1 w5 E& r0 p7 x: t1 A( n/ @) e5 H( X指定接口属于拨号组1dialer-group 1 ) U  ]: A8 n9 {, M& |
定义拨号组1允许所有IP协议 dialer-list 1 protocol ip permit ( E' C' Z* L0 ~# X3 [
设定拨号,号码为2633dialer string 2633  $ E4 _) C4 a1 ]5 G' y9 e  d% E
设定登录263的用户名和口令 ppp pap sent-username 263password 263
( V5 n4 c  ~5 F7 _: S% B' @设定默认路由 ip route0.0.0.0 0.0.0.0 bri 0 / X2 [$ N. T. K: V* M* u' y- W
设定符合访问列表2的所有源地址被翻译为bri 0所拥有的地址 ip nat inside source list 2interface bri 0 overload
5 d# X' U; C1 d5 C- v设定访问列表2,允许所有协议 access-list 2 permit any   s! Z6 b0 p5 w8 z& h' y% [4 n$ C: G
具体配置如下:7 S+ s2 G9 R. c+ W6 F; U3 N
hostname Cisco2503
( f' V$ c7 Q1 ^, B! 0 A2 t* U5 W  `4 l# E
isdn switch-type basic-net3 / ^7 ]5 m* a. P7 m
!
% Q* ?; Z5 \1 M3 i4 jip subnet-zero " f( K5 b) ?1 d' _1 E
no ip domain-lookup / r- i3 h* T+ L* H- C
ip routing
3 l; k8 y+ V- d& C- Y& z! 4 T. |2 A1 E- ~& c
interface Ethernet 0 + D6 o% d7 C+ X3 {& J7 }3 l# t
ip address 10.0.0.1 255.255.255.0 8 ]5 q: i- i/ b& U& |7 |5 m& h* B
ip nat inside
2 T7 B. t' u" C' k% Gno shutdown
: n4 h& p+ {3 g$ ?3 b2 A! 2 H) n3 J" t4 Y2 o: a1 ?( C
interface Serial 0 0 E* ]' P' `5 g4 x' e
shutdown
1 L) z$ m5 G1 Z9 l( W7 ?, ~% [no description
* c' b+ D$ Q" f# ?5 W, Uno ip address
) O( P; E8 t8 v/ k! v# d5 \, d$ U!
0 e. p- ?+ d# q7 p& Pinterface Serial 1
" j$ q% \8 l1 Hshutdown ( C+ Z* J5 |/ z- T* v, x4 Z* H
no description
9 {+ j$ ?( g5 I% Fno ip address " h+ f) Z# U% n# `* `/ i  q
! 0 _5 P* B; ^) G$ Q/ c7 u) J& {/ f
interface bri 0 - O9 o, a" N- Y3 S. k' B+ F4 F9 F
ip address negotiated
# Q9 s, o6 a' V( Mip nat outside
7 B' l, ^( n4 w3 s( nencapsulation ppp
$ T( U. I. g7 R# Eppp authentication pap callin $ x) M( L( c/ l
ppp multilink
8 f+ K+ A: |3 s% h9 R6 n1 ldialer-group 1
+ E0 y1 F+ W+ R. B6 Rdialer hold-queue 10 4 ^) T$ n9 v; i* H4 c! j. k
dialer string 2633  
" P# R; o# ~! adialer idle-timeout 120
! Y" P9 b8 U7 Z: y, Wppp pap sent-username 263 password 263   t8 y0 Y' _& }" J2 e
no cdp enable
* v# _1 w1 R. Ano ip split-horizon
7 L- m* u2 N; P$ i( Hno shutdown 0 p9 ]9 J  ^6 d
! , s) h, e: O: n# x! P
ip classless + e( q( y. i$ g4 M" r0 g, _: Y
!
( h2 z. h% L/ a6 \% D! Static Routes & Y( \3 K$ N- B( R2 V
! 1 X8 c* r. x* }: x! W. \: P/ C
ip route 0.0.0.0 0.0.0.0 bri 0 ' p. V8 `% r7 i5 R
!
  N* R5 }6 U( _0 H& L  C! Access Control List 2 ) j; V, T8 y8 [0 O! ^! e
! + J6 b7 h9 ?1 B$ \
access-list 2 permit any
# W. w+ H* Z9 P9 ]5 ?0 @% [4 o!
; x& ?' b1 p. B% Fdialer-list 1 protocol ip permit
5 N1 J, d* B2 ^) s! n!
4 V2 t0 E( j0 I+ F2 J$ p9 U! Dynamic NAT
: H6 M* Q* v3 W! [) t$ |!
9 u5 H8 x! i' P% n& `6 G* g+ R4 ~ip nat inside source list 2 interface bri 0 overload 8 r3 O/ K& d& M+ l9 s7 }1 G
snmp-server community public ro ) g' {9 W+ s" F$ d' [% Q. p' f
! ! b8 W( y; @6 T! `* y$ n/ b
line console 0 , V1 C, `1 s5 p; V/ M& J' C
exec-timeout 0 0 ) M6 N4 z; ?4 m: f' ~( z  U
!
4 P* U& U# _( \. Xline vty 0 4 ( _* y- Z/ q$ X, J% n* Q
! : Q7 T. {4 x7 W
end
5 |6 @- D7 O% Z+ \& a" f3 J8 b5.        Cisco765M通过ISDN拨号上263& d0 M  d/ R. f2 }) p- L
由于Cisco765的设置命令与我们常用的Cisco路由器的命令不同,所以以下列举了通过Cisco765上263访问Internet的具体命令行设置步骤。6 }7 D& L4 E1 x& \! z

0 @/ k% U: V7 r: e1 ^>set system c765
4 q, \( Z. t6 c' M+ \& E" B8 rc765> set multidestination on
# k! ]2 @" J! c5 C) K9 qc765> set switch net3
, r! _% s  \* t: b. hc765> set ppp multilink on
; p2 V& S6 ?9 c2 o- F+ J7 f4 K6 f( Mc765> cd lan
- W; q6 x+ O1 Y' a. \! L4 y. ?c765:LAN> set ip routing on
6 S; B6 \" N6 ], Dc765:LAN> set ip address 10.0.0.1
* i) ]1 X* ?9 ic765:LAN> set ip netmask 255.0.0.0/ t( o# ?  Y2 c+ c* G
c765:LAN> set briding off
, A& |  R& N. I; [7 s* x/ S. sc765:LAN>cd3 l+ @  p3 {1 f( v  y0 |
c765> set user remotenet) ^- z9 {  x% q% @4 M  P
New user remotenet being created4 v' j0 U; @0 {; q5 _% I: B
c765:remotenet> set ip routing on
- k3 p' J& j3 T3 a0 uc765:remotenet> set bridging off
$ U6 }! n5 E. O' ?" k$ ?2 ]' dc765:remotenet> set ip framing none
) O' P+ Y' i. gc765:remotenet> set ppp clientname 263
! L$ `2 k  t: v) }( K7 W7 ^c765:remotenet> set ppp password client+ T- p4 s/ ?6 [$ _  j! V
Enter new Password: 263
& P& H; ]- _. M3 {9 j- m  M$ @- IRe-Type new Password: 263
: t9 r$ V6 F7 j/ l% Q/ Yc765:remotenet> set ppp authentication out none
' [) L, p$ v  z3 A6 gc765:remotenet> set ip address 0.0.0.0' T: [2 o5 s0 p7 ~: s6 Q, u' p, s
c765:remotenet> set ip netmask 0.0.0.0: @2 L& t8 ?' L9 S
c765:remotenet> set ppp address negotiation local on
9 A4 ]/ q1 i) r7 U7 Z$ H$ y5 Sc765:remotenet> set ip pat on  `0 [9 ^  J/ Q$ t7 H' _
c765:remotenet> set ip route destination 0.0.0.0/0 gateway 0.0.0.0" {, W, k7 x# c' d2 E' v4 s
c765:remotenet> set number 26334 J3 f4 [1 C% H! B
c765:remotenet> set active
9 d, ]) k6 D% D+ ]5 q9 L命令描述如下:
/ v# F# i( l- v& \% T# U2 N任务 命令
4 M& ^4 p- X- i- M. v设置路由器系统名称 setsystem c765 & N1 u0 d; W8 D- {1 N3 Z
允许路由器呼叫多个目的地 setmultidestination on
$ o4 L- T$ O. X: y  G* _设置ISDN交换机类型为NET3 set switch net3
# H$ ^; o2 B3 R; e% b3 L允许点到点间多条通道连接实现负载均衡 set ppp multilink on ; b/ _& n' e: M9 B6 J0 s8 f) b
关掉桥接 set bridingoff
; @  d: ?- b7 y; y# R3 c建立用户预制文件用于设置拨号连接参数- 可以设置多个用户预制文件用于相同的物理端口对应于不同的连接。 set user remotenet , r: ^- r3 l1 h, y
使用PPP/IPCP set ipframing none . F/ [, m! I2 x3 y
设置上网用户帐号 set pppclientname 263 + R; S6 ~0 Q) Y+ }( Y
设置上网口令 set ppppassword client Enter new Password: 263 Re-Type new Password: 263
  a5 W7 q) m- S! o& I不用PPP/CHAP或PAP做认证 set ppp authentication out none , ], v. r- K$ T( M+ S8 z- y  N
允许地址磋商 set pppaddress negotiation local on
( V+ \7 i9 b, N+ Y设置地址翻译 set ip paton 4 ^9 v& V* T2 L! ?+ i6 B
设置默认路由 set iproute destination 0.0.0.0/0 gateway 0.0.0.0
$ Q4 `* J% r' @0 O6 E( ?% l- [设置ISP的电话号码 set number 2633 9 C% ?9 x4 i- o8 ?, J
激活用户预制文件 setactive

  K! Y  ~1 T; F六、PSTN
& N# R4 t7 t: O  F6 [: ?' v3 ]  电话网络(PSTN)是目前普及程度最高、成本最低的公用通讯网络,它在网络互连中也有广泛的应用。电话网络的应用一般可分为两种类型,一种是同等级别机构之间以按需拨号(DDR)的方式实现互连,一种是ISP为拨号上网为用户提供的远程访问服务的功能。
" y- n' `+ b3 C4 d9 Q* b1.     远程访问( O" d' G7 u# a! W# \' N+ J
, L% d. K8 U' J
1.1.Access Server基本设置:$ Q$ P3 h* P0 p+ m4 E( r1 a; H- _
选用Cisco2511作为访问服务器,采用IP地址池动态分配地址.远程工作站使用WIN95拨号网络实现连接。
% d: \6 R4 u# \# `, i全局设置:
* _: z% D& n6 b; b/ {任务 命令
" q2 v! V1 D6 g3 e设置用户名和密码 usernameusername password password 9 f+ l; S( c1 z5 e
设置用户的IP地址池 ip local pool {default | pool-namelow-ip-address [high-ip-address]}
7 @; c! n. ]. W/ x: R% y9 W# Q指定地址池的工作方式 ipaddress-pool [dhcp-proxy-client | local]
- T! O" z2 S( G; E9 c: y' |基本接口设置命令:
5 X3 l1 c( c8 o' o6 K4 t3 E  _  g任务 命令
3 o1 p! {0 _/ A) D: ^( e8 h7 b设置封装形式为PPPencapsulation ppp
" t  W& G* Q3 z2 j启动异步口的路由功能 asyncdefault routing ( M  n% g+ C: `3 v$ \( d1 }$ z. b
设置异步口的PPP工作方式 async mode {dedicated |interactive}
7 ?  r! C' [0 @! Y设置用户的IP地址 peer default ip address {ip-address| dhcp | pool [pool-name]} ! P2 e% _+ P7 w# V
设置IP地址与Ethernet0相同 ip unnumbered ethernet0 7 I; x4 ?& f( q  M5 r7 c
line拨号线设置:
1 \  k! R" O$ F任务 命令 ( c, }2 p/ P( K( B, G: j% X
设置modem的工作方式 modem {inout|dialin} % o1 J9 x6 I/ |+ v4 [
自动配置modem类型 modem autoconfig discovery ; y5 j/ a- M2 K
设置拨号线的通讯速率 speedspeed
$ h" d5 a) z+ R, K& t9 h, M设置通讯线路的流控方式flowcontrol {none | software [lock] [in | out] | hardware [in | out]}
( [8 r' S# _; V8 n) q+ Y连通后自动执行命令autocommand command
* i% C% i1 C/ w( N访问服务器设置如下:" p8 q3 H0 v/ A) Z% D0 D
Router:
6 i( b6 O3 D, ]. P9 U6 xhostname Router
5 ]# S# T# L4 [2 ?/ [( D7 _( [) Benable secret 5 $1$EFqU$tYLJLrynNUKzE4bx6fmH//
! O/ ?4 c" W: z( T5 d' ^& o! " R1 w% u) ]# G8 D+ d9 |
interface Ethernet0
4 c* l! O/ P) P$ Iip address 10.111.4.20 255.255.255.0   {8 y. T0 h! O! A
!
% A# N' }5 Z. ^interface Async1 ( z9 d/ g3 A( P3 R4 I( S3 a
ip unnumbered Ethernet0 & n$ k2 u# I! s+ T% y
encapsulation ppp 6 t0 u. S1 F% e+ N- {. S
keepalive 10
7 f" j  l; x0 `- Xasync mode interactive
6 O) n/ Q+ o' E, lpeer default ip address pool Cisco2511-Group-142 0 B6 P$ L2 h  T8 n
! 6 }6 y/ ~8 h+ A7 m( _+ [( g1 K9 m
ip local pool Cisco2511-Group-142 10.111.4.21 10.111.4.36 0 Z+ \8 X- b: g/ j* q# x
!
3 |1 T8 ]! F! _$ r: X5 vline con 0- B* y  E, \6 Q: v- ]+ |4 T
exec-timeout 0 0& U/ h; M. g% p1 b. s3 h* i9 L
password cisco
8 O* z) r8 Z, g6 y% A# p" t!' f$ x4 X3 n* ~3 M3 _/ M5 t
line 1 16 + }  k( a2 D$ f1 o& _1 ~) ^: \) Z( K
modem InOut & W; ^9 z# a9 m$ o8 L# m2 O
modem autoconfigure discovery
: u( Z% q; K! M' hflowcontrol hardware
4 k( h8 q# l- {: P6 z. w$ D6 e- t( q! 5 p1 w; w) ]0 p3 s, a( X
line aux 0( X7 f9 {) b8 P7 @6 N; X3 _
transport input all- X" o7 D  [% q5 k4 ]
line vty 0 41 v8 _6 J- V/ M9 L4 O& z" G0 u' P
password cisco
$ F  Y  W2 J- o( ?; W!
3 [7 h: s/ S6 I0 G2 o. T& ^end   
: h6 b+ U1 Q3 p. Q8 l" s# Q5 N相关调试命令: 9 o, u- B/ X4 q
show interface
: f  j2 u) I$ J' x1 P2 z; r1 R9 G) Mshow line
2 C+ c# y( h1 o$ h* Y1.2.       Access Server通过Tacacs服务器实现安全认证:+ u4 V+ }! Z$ ~8 U: g% S) Q
使用一台WINDOWS NT服务器作为Tacacs服务器,地址为10.111.4.2,运行Cisco2511随机带的Easy ACS 1.0软件实现用户认证功能.
* v+ [. ]% y3 R6 d# t8 x相关设置:9 N8 L  a0 e. `) T  m) |" i
任务 命令
3 n) \  q" u( |% r" a1 F2 E: z  y激活AAA访问控制 aaa new-model - ~$ o* u. c8 p
用户登录时默认起用Tacacs+做AAA认证 aaa authentication login default tacacs+
: S4 A" C3 F* T) p  s列表名为no_tacacs使用ENABLE口令做认证 aaa authentication login no_tacacs enable
  a' d4 g7 b( I9 Z6 h" i1 r在运行PPP的串行线上采用Tacacs+做认证 aaa authentication ppp defaulttacacs+ 1 v$ G6 @! N6 q3 ^- w: I& C
由TACACS+服务器授权运行EXEC aaa authorization exectacacs+ 7 q  {1 D1 _; T$ ]4 B9 s
由TACACS+服务器授权与网络相关的服务请求。 aaa authorizationnetwork tacacs+
, E- H$ y) E6 M6 O3 U7 @/ u为EXEC会话运行记帐.进程开始和结束时发通告给TACACS+服务器。 aaa accounting exec start-stop tacacs+ 0 Y( Z  j* f" w0 v) r- ^3 z5 P
为与网络相关的服务需求运行记帐包括SLIP,PPP,PPPNCPs,ARAP等.在进程开始和结束时发通告给TACACS+服务器。 aaa accounting network start-stoptacacs+ , F' _! j" Z$ W$ k
指定Tacacs服务器地址 tacacs-server host 10.111.4.2 $ V4 X9 k$ ]1 C2 y
在Tacacs+服务器和访问服务器设定共享的关键字,访问服务器和Tacacs+服务器使用这个关键字去加密口令和响应信息。这里使用tac作为关键字。 tacacs-server key tac
4 d$ C8 p8 O9 B+ S9 S- f访问服务器设置如下:* D6 l) F2 `' I8 [
hostname router
1 Y2 p( h& d$ F& F/ G!- B9 H, g8 F6 @4 M! e- q
aaa new-model
) H1 }1 |+ l) B" P9 I; Q2 n3 {# vaaa authentication login default tacacs+) [) _, ?. n0 U( z* a: x- M" p
aaa authentication login no_tacacs enable
$ V- l: i8 K# G3 }aaa authentication ppp default tacacs+
4 Q( y. U4 L% C% f5 b( M1 waaa authorization exec tacacs+
* ]4 c3 e8 ^) q0 K+ P! ^# C2 @: P/ zaaa authorization network tacacs+
) K& W" I: s* f8 Y8 @aaa accounting exec start-stop tacacs+& J# t1 K2 \4 u/ M' L( X
aaa accounting network start-stop tacacs+% a0 D% \9 P. j' z( ]/ n
enable secret 5 $1$kN4g$CvS4d2.rJzWntCnn/0hvE0; G$ s, d) p. O( j9 I$ B
!$ H0 \' f3 ^/ j# {- e! G
interface Ethernet0& {6 Q' |6 c6 r$ r+ Y
ip address 10.111.4.20 255.255.255.0
3 L5 m! i8 G( M% d& r9 T!
* M, _6 a* @- A* |  p' n, I; einterface Serial0. y% a+ M% c; L! c) J
no ip address3 A+ V, [2 l4 Z$ O
shutdown3 u6 T1 i; y) c9 M5 _# o2 S" f
interface Serial1% c+ O1 E2 N+ O# m7 P3 J1 `
no ip address
5 }+ _6 X  C2 \6 w! j3 E- x! n; m0 `shutdown, M" Q/ K8 r) k3 A* r) \
!
( _9 ~4 h  l7 S7 F3 J3 }interface Group-Async1+ J, n9 S" C8 Q1 U
ip unnumbered Ethernet0
( T2 P& s) m& v' k3 I3 Gencapsulation ppp
7 Q3 C- N% C  U1 F$ u4 kasync mode interactive
# o% K" R* D) u+ `$ P# z" A2 X/ upeer default ip address pool Cisco2511-Group-142$ f- {) B6 x9 P9 n' G5 B
no cdp enable
* ]1 p. C+ c0 Z: z7 pgroup-range 1 165 r8 R3 S3 w2 V$ z; y4 `% y5 N
!8 T# y+ K% \1 e5 c4 j
ip local pool Cisco2511-Group-142 10.111.4.21 10.111.4.36
5 N" g/ w5 `9 ?1 Htacacs-server host 10.111.4.21 r9 a$ Y& j$ l! |! t
tacacs-server key tac: x) t  N  M' f3 G0 a  a$ a
!0 V6 ?6 j. u2 u8 v8 n7 ~. c7 V$ ~
line con 0& [: R* w7 ]5 ?3 |) I' Y; }& x8 N
exec-timeout 0 0  L$ K+ h5 E1 S
password cisco% A* h, y6 J' V- ~7 o) H8 f) u
login authentication no_tacacs 6 ?; F! i. p  i8 q/ M4 F
line 1 16" {3 f! v, r1 U* I+ W# b
login authentication tacacs
* }" j' K/ U. @6 o6 Gmodem InOut
0 Y3 M1 u, _% B  O3 S: o3 Smodem autoconfigure type usr_courier- b2 _% L# b8 a! {$ h& x& I
autocommand ppp2 i2 C* ?# W2 Y' a
transport input all; `; ?. V6 g7 t+ i
stopbits 1
  B9 T$ B/ \2 M4 r; orxspeed 115200
" `* t! O/ m2 O8 L) y0 ktxspeed 115200
! U- G+ Z4 X1 y3 w( J: v' Fflowcontrol hardware
8 }) p; ^- f7 l3 k. Q  M& }. bline aux 0; {$ o/ z4 `- ~: R- L& U8 P5 l
transport input all2 ]6 M! @1 |, @# A3 J2 ?( i
line vty 0 4. B! L. Q' j* J/ m3 B
password cisco" ?; p! n) h4 P$ t
!2 v8 P: `/ I! u( V+ L" H
end
, d4 [/ b+ O- H8 v6 h- t; v2 r2.      DDR(dial-on-demandrouting)实例) ^$ p: ~" T& R# M+ a- {8 A! l

# ]7 \  A, \6 V此例通过Cisco 2500系列路由器的aux端口实现异步拨号DDR连接。Router1拨号连接到Router2。其中采用PPP/CHAP做安全认证,在Router1中应建立一个用户,以对端路由器主机名作为用户名,即用户名应为Router2。同时在Router2中应建立一个用户,以对端路由器主机名作为用户名,即用户名应为Router1。所建的这两用户的password必须相同。
2 g0 X! g' j( Q* ^6 n" v8 y% D3 q2 i相关命令如下:
8 n/ t: |: _. L# r+ M' ], i3 E1 z任务 命令* `5 I! P8 a, ?8 Y
设置路由器与modem的接口指令 chat-script script-name EXPECTSEND EXPECT SEND (etc.)
1 P' ^; N6 B* t. b8 [设置端口在挂断前的等待时间dialer idle-timeout seconds
  y0 v& P4 j/ a, U0 i设置协议地址与电话号码的映射dialer map protocol next-hop-address [name hostname] [broadcast] [modem-scriptmodem-regexp] [system-script system-regexp] [dial-string]   
3 p5 S6 F6 X0 ?+ D& T4 k+ a* m- S; h设置电话号码 dialerstring dial-string
3 R/ p. d. w4 j; d: Z+ O4 k9 r指定在特定线路下路由器默认 使用的chat-script script {dialer|reset}script-name
0 _( G8 w' _* l2 q/ m% lRouter1:
/ u4 q* b  c" N4 U/ g: uhostname Router1
5 M& j. e2 ^" t! # r( C  a( p: B$ ~4 \
enable secret 5 $1$QKI7$wXjpFqC74vDAyKBUMallw/
! N0 u2 `+ K: j6 V; {3 b4 M7 y! $ O: S, O: \/ k
username Router2 password cisco
% j$ ]4 n) E# l0 }) t1 Z. schat-script cisco-default  "" "AT" TIMEOUT 30 OK"ATDT \T" TIMEOUT 30 CONNECT \c ) v' u$ z7 d/ X6 N5 v/ I2 a
!
* Q$ Y% v7 B3 f  k6 T' R" Dinterface Ethernet0
! i1 \3 p% ~$ k+ p6 P8 ?! Fip address 10.0.0.1 255.255.255.0 ! y/ C! s; t  ~, i6 `: c: J3 E! l9 K
!
2 I4 k& K3 B  s9 ~$ t0 d: R, N6 Cinterface Async1
# z9 }) d0 ~" Eip address 192.200.10.1 255.255.255.0
9 K" F" k( @3 u* Z. rencapsulation ppp
" T' v( E9 {8 m/ A2 tasync default routing
* N. \: j2 J1 Z8 Fasync mode dedicated 8 ~% j) J# Z4 w% C, k
dialer in-band
$ s' U* Z4 C% G5 y6 z" S/ C' jdialer idle-timeout 60
) k7 r: L! u5 Ddialer map ip 192.200.10.2 name Router2 modem-script cisco-default 573% z( e1 F. M* E3 o
dialer-group 1
1 v+ G+ _' f* ^& xppp authentication chap 6 h; @: G, S; Y8 u
! , T: L* |+ P2 z+ X% F/ p# E# Y$ k
ip route 10.0.1.0 255.255.255.0 192.200.10.2 ; R4 B( F' H/ h. V& E9 t3 V4 V) c
dialer-list 1 protocol ip permit
% t9 P$ A, }: F7 K+ N!
( Z( o* X" ~' M" vline con 0
9 A$ D. \% l/ t, _! x: g6 G# oline aux 0
; h: P8 R' p' W% m' xmodem InOut 2 D$ `5 w6 l! K# ?6 ?
modem autoconfigure discovery 7 \2 d! G, O# B
flowcontrol hardware      
Router2: ! b! |8 k5 F. |
hostname Router2
8 s1 d6 Q8 ~8 L* U4 ]9 y4 m) J- _!
- B# z3 k& ]6 I! {, n7 @6 g# C) V: h' w0 cenable secret 5 $1$F6EV$5U8puzNt2/o9g.t56PXHo.
+ }' Q3 t$ Y+ w: ?% H4 M!
7 ]( ]- @9 C6 F8 Q! cusername Router1 password cisco , ~2 s/ r) Q5 y" e' Q! F& T
! / @9 H# W1 N: g% H- ^1 L4 B0 D" T
interface Ethernet0 ' E* e; o0 J+ x, V! X6 y" \' L
ip address 10.0.1.1 255.255.255.0
+ c4 I$ M9 m9 I2 \; y! Z!
* e) a& F! V9 V1 A, Einterface Async1
- d! Q7 M$ c4 Nip address 192.200.10.2 255.255.255.0
$ n2 X9 V& U2 ~! Bencapsulation ppp
% O; {, @7 h: c: r+ t1 y$ X, r# Gasync default routing
! |1 F/ t# y4 L. ]; Z# hasync mode dedicated 6 S' ]0 d% N4 N0 o/ J3 E- C
dialer in-band
" w2 r, E7 ?- I0 q: D! tdialer idle-timeout 60
8 d7 }! ], k1 s6 I2 R. i  Udialer map ip 192.200.10.1 name Router1 8 D7 V+ p7 M1 k
dialer-group 1
% V$ M8 K, B9 w: pppp authentication chap 6 v$ v  j; i, l
! % b6 a* }! r  s, i
ip route 10.0.0.0 255.255.255.0 192.200.10.1 ) i  s5 Z0 b) r+ s# w5 k
dialer-list 1 protocol ip permit % E0 @' v0 {% ~, a+ g0 |
! 0 P8 N( i) {1 @) f' W
line con 0
% F0 R' o$ K& t/ t( u4 B+ Uline aux 0 1 X, q3 V7 q# `
modem InOut 3 |2 {6 M( |1 j# k
modem autoconfigure discovery
: U, `0 L* l3 J3 qflowcontrol hardware
6 n! {0 g. U; U& ]6 E; V!   O4 {- G0 c: h; Q" ]
相关调试命令: & r) D. f! A- I6 C  X. y" ~- b
debug dialer
( D/ q4 t0 g4 V  C; E, I3 b0 Tdebug ppp authentication
& `  o  w, d3 m& j1 s# Ddebug ppp error
. J8 T! k2 M+ T; ~, e' Cdebug ppp negotiation ! x6 D9 X$ D3 ?% Q: z* V4 b
debug ppp packet
/ H- V8 E+ y# ~: ?+ pshow dialer     
+ q0 A5 P2 j3 {- ~3.        异步拨号备份DDN专线:
: }7 }2 g! m3 e* J' X
5 g) w& ?  e6 X' K此例主连接采用DDN专线,备份线路为电话拨号。当DDN专线连接正常时,主端口S0状态为up,line protocol亦为up,则备份线路状态为standby,line protocol为down,此时所有通信均通过主接口进行。   当主接口连接发生故障时,端口状态为down,则激活备份接口,完成数据通信。此方法不适合为X.25做备份。因为,配置封装为X.25的接口只要和X.25交换机之间的连接正常其接口及line protocol的状态亦为 up,它并不考虑其它地方需与之通信的路由器的状态如何,所以若本地路由器状态正常,而对方路由器连接即使发生故障,本地也不会激活备份线路。例4将会描述如何为X.25做拨号备份。  . Q: x4 D* A4 L6 e8 x
以下是相关命令:
8 Q' ]: d: x( q* x3 M2 l7 c任务 命令 $ p- ^+ O5 K: `! ]  r2 h3 p
指定主线路改变后,次线路状态发生改变的延迟时间 backup delay {enable-delay | never} {disable-delay | never}
% i/ _7 J* n; x* K. l指定一个接口作为备份接口backup interface type number 8 v5 O% @; B4 t) }
hostname c2522rb( A0 t5 S1 d  K
!; \2 _; n2 g9 }3 n1 B1 e1 q
enable secret 5 $1$J5vn$ceYDe2FwPhrZi6qsIIz6g0
4 ^$ T% N! j9 o- `8 Uenable password cisco
) p& f$ ~4 t7 _- n!
9 C! M' D0 u" V- ?username c4700 password 0 cisco
9 e# y9 g: p! O# Q8 g: fip subnet-zero
! S! w/ T) C# w3 Echat-script cisco-default "" "AT" TIMEOUT 30 OK "ATDT\T" TIMEOUT 30 CONNECT \c
7 \0 S9 l! N4 o# u; Nchat-script reset atz
7 P$ \" `; O5 D/ {8 Y5 k+ D. D8 p!
4 L2 B7 w9 ?; Qinterface Ethernet0
" V" J& h2 {/ H5 i) u$ P  Qip address 16.122.51.254 255.255.255.0
  H6 Z% T, i& B' b3 S# _no ip mroute-cache
5 g0 X# }: h; G! x!! r; u( K- T+ i6 [" e4 D: H
interface Serial0
/ b3 e) w: E6 g9 P" qbackup delay 10 105 S: ?( B) {# V1 c; H) T. G0 P" S
backup interface Serial2
- I5 w! o4 a% T# C& `1 wip address 16.250.123.18 255.255.255.252
1 j% ~5 D: u- p. Sno ip mroute-cache& G2 Y$ q* M! V6 ^+ X# y# ^
no fair-queue8 z4 j. q) V, ]7 w& m
!3 N5 F8 S- l& S) r: Z
interface Serial14 S/ z  ?' Q3 b4 R
no ip address# l' r, o  c. |6 n1 |
no ip mroute-cache
: O: M2 r2 L6 e; yshutdown
. y; }) h/ D  [& D2 M( G!& C$ Q4 y0 K6 G3 e5 n& ~7 c5 d- z
interface Serial2* S; N' U# @) d8 Y
physical-layer async
" p  G$ d' a' ~7 [3 |ip address 16.249.123.18 255.255.255.252
8 X' s4 s8 I/ l( Vencapsulation ppp
- b; L- W/ j3 I0 a3 e! sasync mode dedicated9 n6 e3 p" m$ @3 A" n
dialer in-band
- P5 t$ m# O! H. S4 W" gdialer idle-timeout 60# U1 |  \- C" ?  t/ I! D: q
dialer map ip 16.249.123.17 name c4700 6825179: e3 ^. L, ^8 g7 x
dialer-group 1
, o7 a% n* D' ]. l- }ppp authentication chap) \2 C6 G+ ]9 s0 n* H6 _
!
3 b" B" o8 c) d) \interface Serial3
4 D( N* s! T4 Y& d  lno ip address5 B: }, O, d6 q0 x4 A
shutdown
6 B+ m. ]5 B! K1 y4 ~# s* y/ Q, Uno cdp enable
6 V* c6 f3 g3 W; M! E!) {6 T( s, C. i
interface Serial4  s  c9 U7 C9 {3 r8 R) Y! g: A
no ip address+ F9 o: v7 H4 d  O' r
shutdown
( G3 ~( H7 X! Q6 Wno cdp enable" |6 W2 @0 a2 N6 j$ e
!
! ?6 Q; Q$ ?# ninterface Serial5
: k3 J3 `+ H* o1 P! L# vno ip address
: B+ z* v* V4 m2 S9 u! \& y; _0 e( nno ip mroute-cache
* [% b; u) }$ |  u) G. e7 m( Ishutdown  a# W+ \, y* K0 V7 G. n9 ~" R  I: ]
!0 V9 Y$ J3 o$ ^; ]& s' n( ]
interface Serial6
( W$ `( O6 g. O& `no ip address
: r6 Z4 f3 w1 pno ip mroute-cache
7 G, L! Z3 w! O+ {2 Vshutdown
4 K; {- C+ o7 H" c!
4 R+ J; e9 v4 M+ F- w9 G- e4 sinterface Serial7
! T4 Y! B' r/ T* x4 eno ip address
# D) R3 R! j+ j/ ?no ip mroute-cache
' Q/ H5 R$ [. t7 p0 w% n" x, c. hshutdown
& v+ a( ?4 }7 N8 x7 ?!
0 q: g5 M5 }; m$ d! ^+ \( W, Iinterface Serial8
* o  l/ u# `7 a! R6 l) m1 Dno ip address
; e5 b3 [1 \, x' H$ c  i' V4 B2 ino ip mroute-cache
) a6 d( X* [1 J1 X" Z- u, |shutdown9 {( e5 @; `& w6 e6 s& V1 q5 h
!8 w1 @# G. f3 w7 f# w
interface Serial94 C, M' m$ Y3 G" E
no ip address
& M9 e2 T2 K! Z9 p: k0 U1 G! u* pno ip mroute-cache
' `9 _5 `, V( B3 `( m, Ushutdown0 H" a: V5 R- S$ A
!8 `+ w2 q+ H; M  j% i5 O0 P' U
interface BRI0
7 V- v1 S2 s' Pno ip address
/ F3 l9 a2 W: w' L# t" C7 Sno ip mroute-cache/ D8 X" d% ?1 D: @/ R( P
shutdown
' l5 X5 A: X4 C+ h' n!% a& Z0 L& i. G$ ^
router eigrp 200! \8 H. G1 F: P% C
network 16.0.0.0; [  |( s" j! Q, J. v; J0 Y
!
3 N9 Z  k; N" E0 Z( u/ Q6 `) S, Aip classless' K* A" n9 \' ?  A6 c. V3 O$ X. s2 B3 j
!9 i) g6 _- A8 w, O
dialer-list 1 protocol ip permit
  N% V# k/ E/ Z! w!
; u. B+ V/ p6 X  gline con 0
; F  P. D6 j) f3 z; `line 22 ?# Q' S0 M' d, M
script dialer cisco-default
$ x* W! C* D+ A0 lscript reset reset$ R* A4 S4 r8 ?2 l2 \9 D
modem InOut
6 c7 y# `+ Y% C% j9 A. l( B4 a) hmodem autoconfigure discovery
% U$ P8 v: a& ?rxspeed 38400" e+ ~( X, V/ W4 E
txspeed 38400! ]* @3 u( K% k2 p
flowcontrol hardware& w7 A* |1 _* f5 `" x7 {
line aux 0$ {; k5 F- G% Y/ n# c9 t2 b$ `9 D
line vty 0 4& m5 O+ O3 m% m& ^
password cisco
2 p7 _" E- }9 h! elogin# s/ W1 A% X- N: P( m0 w' _: v+ i/ \
!% J. @6 E8 Y! K0 Z$ j0 h
end
' V$ T3 H6 Y. v3 A: Q! yc2522rb#
7 @& n8 Q" R* N( Y; x, L" i4.       异步拨号备份X.25:
" Z& I" ]5 a) q6 v$ H, ]! m' ~& ]& h% n$ F7 S9 t, [
设置X.25的拨号备份,首先X.25连接的端口必须运行动态路由协议,异步拨号口必须使用静态路由.本例选择EIGRP作为路由选择协议,将静态路由的Metric的值设置为200,由于EIGRP的默认Metric为90,所以当同时有两条路径通往同一网段时,其中Metric值小的路径生效,而当X.25连接出现问题时,路由器无法通过路由协议学习到路由表,则此时静态路由生效,访问通过拨号端口实现。当X.25连接恢复正常时,路由器又可以学习到路由表,则由于 Metric值的不同,静态路由自动被动态路由所代替,这样就实现了备份的功能。# g5 q* |6 N, O; g
路由器Router1配置如下:/ J7 ~- T. c8 M( D4 D5 v6 }
hostname router1
$ m& b8 a- P* u" q- N: Q!
: g* R9 A7 U) e5 e# u- z, G3 renable secret 5 $1$UTvD$99YiY2XsRMxHudcYeHn.Y.1 @1 y% }) o6 h. y0 L
enable password cisco8 Z1 R* l2 e" i  W0 J+ O
!
, K* P  Z0 C$ S8 l2 o) kusername router2 password cisco
5 g0 X; |0 P- L, ]1 t  Yip subnet-zero
0 [$ z* N1 w3 G$ Nchat-script cisco-default "" "AT" TIMEOUT 30 OK "ATDT\T" TIMEOUT 30 CONNECT \c0 ~$ h, F4 y( |$ H
chat-script reset atz
$ S# k- @. G% xinterface Ethernet02 R3 ?3 F% _7 E) e- {
ip address 202.96.38.100 255.255.255.0: h! @) g  p$ f# s
!2 |, ]; J; F2 w/ y& d& o
interface Serial0# P9 p) i4 G/ \% I3 o* {- ~
ip address 202.96.0.1 255.255.255.00 `: c  y5 F+ g8 [% Z0 l
encapsulation x25; E$ n8 q3 m" T2 @
x25 address 101122279 Z0 s$ k& t$ ?- k1 c+ \
x25 htc 161 T7 M( |3 c2 J9 O( k) ~
x25 map ip 202.96.0.2 10112225 broadcast2 A4 Q8 `* T  s/ {+ |5 O$ E: J3 |
!
5 G# c7 f1 X& ]5 Einterface Serial1
3 ?0 u5 v* _- {- Pno ip address+ U" Z! Z; I8 u) S% r
shutdown
: Q  d/ o) l- ^  R: U( }!
# ~& q) Z& E  D) g6 D' S2 ?!& j3 Z2 g* w$ G# J
interface Async 1
8 I. ?1 o, I" R7 m* u0 Sip address 202.96.1.1 255.255.255.252& v5 {. F  y" M* X
encapsulation ppp
. C& B- W; t0 p8 l( k$ {) @* Zdialer in-band
2 p7 O! V! q( [( R( ?( O: [dialer idle-timeout 60% p# t& @5 Z/ ]" ]
dialer map ip 202.96.1.2 name router2 modem-script cisco-default 2113470* ?+ L3 a* K) K/ \, ~
dialer-group 1! M4 a: m5 m+ ]' }$ F& `2 q1 w
ppp authentication chap! u3 V( X! E& w, c+ G' K: C  x
!) l1 i8 _- q2 m: q/ V& b" h
router eigrp 2006 [8 q: X1 K3 e& `, d6 \1 {
redistribute connected" l  G) B6 c+ o0 Q% c2 f
network 202.96.0.0
0 x6 S* u: u5 i; |4 i" S, q!! `7 h( H% J) s) P" m
ip route 202.96.37.0 255.255.255.0 202.96.1.2 200& J" j# ^: F5 X7 J4 P
dialer-list 1 protocol ip permit
) @, N3 s' y' f. G; p/ M* Wline con 0+ L" C: o! z0 e
line aux 0
0 ?7 ^# b* G$ R; N/ ~5 K. |script dialer cisco-default" E+ `6 @! t  O& Z. H% C
script reset reset+ H+ g) r* g% t# N6 L5 d2 d
modem InOut2 e- i  a  X6 W) ?$ Y/ {) n- t' J+ C
modem autoconfigure discovery
6 N5 ^( T1 m" U$ h. u7 [transport input all; i& p7 \8 @5 F' R7 E
rxspeed 38400
5 c% {$ a9 @9 J4 n/ |2 K; N2 g; Ntxspeed 38400
4 {3 ?7 V9 e; u$ f- r' lflowcontrol hardware8 T7 o  e" m# n7 A- t1 J; Y- j
line vty 0 4" \) `8 b7 \7 i+ N* Y( X! N$ {
password cisco2 V/ F* P; b/ M- M* i3 [4 w- J
login7 Y4 f8 f  k& W) a! m
!& Z, _" E2 I' Z% G' g: `$ n/ F3 @
end/ Y& M4 f  k% ?! [, y& d  f
路由器Router2配置如下:
% C3 B7 A: p% c3 h1 @hostname router2% C3 ]7 t" `9 p5 a" w
!0 V9 e9 ~/ I( V3 D7 U7 t
enable secret 5 $1$T4IU$2cIqak8f/E4Ug6dLT0k.J0- x) Z1 {- ^$ i& N1 r1 \" B
enable password cisco% f0 q$ {! q$ ]! o, W+ E& W1 O$ O
!
$ @/ f, F1 C2 ]0 D  rusername router1 password cisco
6 ~1 m: i7 w( n: N+ ]8 E% ^4 @ip subnet-zero; u9 @, I: P) @2 o9 v/ t
chat-script cisco-default "" "AT" TIMEOUT 30 OK "ATDT\T" TIMEOUT 30 CONNECT \c
" e- ~5 t5 e7 |, M  Ichat-script reset atz* t$ L" s) J' G" H) W0 j
!
7 w" J2 w! K  V% Winterface Ethernet0; h& g5 H. P. H3 ?
ip address 202.96.37.100 255.255.255.0
, _) q* i- u( P  G!1 m+ {* ?- ~! c- |" ^3 H
interface Serial0
6 j. [" e4 e0 s* {) Mip address 202.96.0.2 255.255.255.0) m! j" y2 D/ {  `% l# ?/ u; W
no ip mroute-cache$ [. O  q! ?' c
encapsulation x25
( @: e2 Y% D+ [7 y8 Lx25 address 10112225# o0 m: W1 `0 Q0 }+ J/ `; [
x25 htc 16
3 |5 [8 q# q) K  S& n- |1 {x25 map ip 202.96.0.1 10112227 broadcast: {( v; q9 O" O- J( n% ?1 G
!
0 Z( W$ f4 w( P$ e" j. h5 Jinterface Serial1
6 m5 N: X% k( cno ip address
, q% M# V! }& F" u" o3 oshutdown. R% ^* Y5 k5 S; f* M. B! J
!0 ?* ]+ n% b* s( A( R9 N
interface Async1
: ^: O0 e7 m1 \4 gip address 202.96.1.2 255.255.255.252" S5 V) v2 k8 d* a
encapsulation ppp
8 F- `  U" g% akeepalive 30# _. D; J& ~6 S9 C1 x6 C6 w  B% P
async default routing
8 K, V  {& S+ Z6 X3 ~: L% Y1 b! F' [async mode dedicated
  \& }. G0 p4 }7 Z: D: x3 [dialer in-band  M6 V; x7 g5 A
dialer idle-timeout 60* P# T9 D+ _+ l/ C6 O; p
dialer wait-for-carrier-time 120- j1 h' w2 o% Q: y
dialer map ip 202.96.1.1 name router1 modem-script cisco-default 2113469
; Q3 h! H/ T8 r7 Q3 c8 G% fdialer-group 1
9 Z7 E4 v! a7 T6 o* r7 I; Appp authentication chap9 x  _2 v; R! ~8 r
!
9 U- t/ C2 e! l. G: K1 x# r' Grouter eigrp 200- E: h2 z# [3 R
redistribute static
, |; c" d1 k8 e! Fnetwork 202.96.0.06 |# N( p" [- T! _: E' c# q, I
!
8 k" M" _7 v- Hno ip classless
3 }# |7 p% r/ e' C! _ip route 202.96.38.0 255.255.255.0 202.96.1.1 200, v1 T2 U6 L- l" _
dialer-list 1 protocol ip permit
- [7 d1 P9 I- {( M: R3 C!
7 o9 f, w6 f1 {7 _* I4 ~  k/ k" iline con 0
6 O, e0 T0 G( v1 T& }exec-timeout 0 0
7 b6 h  }% h/ H3 M# a/ {7 sline aux 0
6 Y; N! ~7 Z9 B, }- D# P( c3 a! ascript reset reset& p/ e; `/ O/ _. y% U
modem InOut" c9 c* o4 g; K0 V! l6 B
modem autoconfigure discovery+ `4 [1 q  i$ n8 [, h* P
transport input all. v% s0 b1 ?4 j: e: n
rxspeed 384009 m% `8 ?( A2 D
txspeed 38400
& V: D$ U; z7 h4 J7 qflowcontrol hardware/ G; Q( r7 p7 H
line vty 0 4, Q! a( a' Y. L8 A( r
password cisco
" `5 n3 h3 ~% l% X/ F, @- b$ alogin
+ D* a5 z7 Q; j!( O, Z  d2 @! @3 p9 ~/ T. R
end
) z3 v; z7 V) ^5 D" s2 }
第三章 路由协议设置
4 W& f! H* _  l3 J' b( a, A一、RIP协议 # V' F5 K( u7 b2 Z- h
 
/ t6 P, b& u% @+ i' kRIP(Routing information Protocol)是应用较早、使用较普遍的内部网关协议(Interior Gateway Protocol,简称IGP),适用于小型同类网络,是典型的距离向量(distance-vector)协议。文档见RFC1058、RFC1723。
( |9 x! @; [! p4 r3 FRIP通过广播UDP报文来交换路由信息,每30秒发送一次路由信息更新。RIP提供跳跃计数(hop count)作为尺度来衡量路由距离,跳跃计数是一个包到达目标所必须经过的路由器的数目。如果到相同目标有二个不等速或不同带宽的路由器,但跳跃计数相同,则RIP认为两个路由是等距离的。RIP最多支持的跳数为15,即在源和目的网间所要经过的最多路由器的数目为15,跳数16表示不可达。. j, U! n7 P, C7 [( Y
1.        有关命令
. O2 C" ?- ?- x: h$ p任务 命令
) ]9 P( I/ q4 h$ z/ I% p& e指定使用RIP协议 router rip
  q1 A0 D5 o: d- N# b4 G% u指定RIP版本 version {1|2}1 ; z& B- m  a5 Z6 w! Q0 t
指定与该路由器相连的网络network network , Y8 ^- F0 r* [1 C6 L0 G
注:1.Cisco的RIP版本2支持验证、密钥管理、路由汇总、无类域间路由(CIDR)和变长子网掩码(VLSMs)
( C2 F1 v! s" V5 G& t2.        举例2 S9 g/ x7 D6 T

( D+ t8 v# l6 K5 k, Y2 ~4 [5 XRouter1:9 O; Y% {0 ]) W3 w1 u5 F
router rip
8 E, q- L; |( y- Y) ~version 2 - w9 U: v- z7 N
network 192.200.10.0
6 B* p1 p" S4 a5 x9 ?& @network 192.20.10.0 6 N' O, W( U1 ^' v! P% o
- s9 b; I* T+ d7 h; K  ?5 C2 V
相关调试命令: 8 f0 k& B- s4 I( A
show ip protocol
) ]6 w: ^& M( B8 h. v! rshow ip route
二、IGRP协议
$ I+ B1 g* g( d+ w' X& [ 
. N9 T  G( Y$ mIGRP (Interior Gateway Routing Protocol)是一种动态距离向量路由协议,它由Cisco公司八十年代中期设计。使用组合用户配置尺度,包括延迟、带宽、可靠性和负载。 * t- Q& L) ~3 y* i/ A6 H  C6 h5 H
缺省情况下,IGRP每90秒发送一次路由更新广播,在3个更新周期内(即270秒),没有从路由中的第一个路由器接收到更新,则宣布路由不可访问。在7个更新周期即630秒后,Cisco IOS 软件从路由表中清除路由。   " R9 r1 H5 J' l0 _: O
1.        有关命令  
" |2 w  S8 `* a. l( y任务 命令
( l+ Z$ a% M" z) z: Z& p. F+ V! O% C指定使用RIP协议 router igrp autonomous-system1 1 j3 N! Z# t  X; v
指定与该路由器相连的网络network network
; Y* d. ]4 z8 y" i9 k指定与该路由器相邻的节点地址neighbor ip-address & n6 ?6 I2 X8 [" L
注:1、autonomous-system可以随意建立,并非实际意义上的autonomous-system,但运行IGRP的路由器要想交换路由更新信息其autonomous-system需相同。
; T: w  i# w3 {# q( G1 }6 K0 w2 ~2.举例5 ?0 q2 X! M% |+ [

$ Z% X" d( L( P  cRouter1:
  H, l5 n0 u* p! [/ _router igrp 200
2 I6 v' s  v. jnetwork 192.200.10.0
) X/ k4 X5 K# t3 N# u, |  e& x, Knetwork 192.20.10.0
: E8 |& J6 S( R7 v+ l!
三、OSPF协议
0 ^+ c3 \/ r$ I+ n; T9 |2 ]- m& s 
$ r; z$ g7 M* {# l" }2 g% ]; D% TOSPF(Open Shortest Path First)是一个内部网关协议(Interior Gateway Protocol,简称IGP),用于在单一自治系统(autonomoussystem,AS)内决策路由。与RIP相对,OSPF是链路状态路有协议,而RIP是距离向量路由协议。
0 g) e8 u$ {9 A0 p' y链路是路由器接口的另一种说法,因此OSPF也称为接口状态路由协议。OSPF通过路由器之间通告网络接口的状态来建立链路状态数据库,生成最短路径树,每个OSPF路由器使用这些最短路径构造路由表。
7 O  v' }2 D1 `8 y/ b文档见RFC2178。   - a9 y% z: H3 t+ o$ B- w3 {
1.有关命令  8 E- m) u- [2 i0 X8 c  x
全局设置
5 u, `0 o/ q8 `; b任务 命令 * @: B' {- ^6 J4 |, b
指定使用OSPF协议 router ospf process-id1 % E, R6 B' u5 z# _) M
指定与该路由器相连的网络network address wildcard-mask area area-id2 . \' A% N% s# l+ r3 R
指定与该路由器相邻的节点地址neighbor ip-address
; V$ T9 y/ ?, ?9 U0 x( D% V; e7 `! ]- ?# { 注:1、OSPF路由进程process-id必须指定范围在1-65535,多个OSPF进程可以在同一个路由器上配置,但最好不这样做。多个OSPF进程需要多个OSPF数据库的副本,必须运行多个最短路径算法的副本。process-id只在路由器内部起作用,不同路由器的process-id可以不同。
$ T' Z. Z0 Q& ]. n! `( a5 s4 G4 v   2、wildcard-mask 是子网掩码的反码, 网络区域ID area-id在0-4294967295内的十进制数,也可以是带有IP地址格式的x.x.x.x。当网络区域ID为0或0.0.0.0时为主干域。不同网络区域的路由器通过主干域学习路由信息。: b7 q0 t) Y0 W
2.基本配置举例:
! J7 t2 E- F2 V  
+ r% p# o6 E3 |. b; H1 kRouter1:
* x' e6 n, Y# v5 s8 Uinterface ethernet 0 6 G. L3 G5 k8 Y' ]3 i( [
ip address 192.1.0.129 255.255.255.192 $ |; X) w  l, p
! , n0 F( w+ M+ f4 B! R4 c& E
interface serial 0
+ @8 p, W- u1 q, \) n& g$ v+ E0 Lip address 192.200.10.5 255.255.255.252 5 H* G3 C* f# X( w2 Z
!
$ I1 T5 j  Z1 i. X! p7 Orouter ospf 100 0 b9 c/ G6 B" o
network 192.200.10.4 0.0.0.3 area 0
$ J8 J) V. s, e/ h3 ?network 192.1.0.128 0.0.0.63 area 1   ^) x( M9 o, k  n/ r" ^
! * {& T- w$ e2 I* m) S
Router2: / t+ x* r, d6 _# P% _- n
interface ethernet 0
  O5 |, E2 t# U2 N( b6 U7 ~; B3 r( Vip address 192.1.0.65 255.255.255.192
7 ]  I& X3 o+ `+ W' b! 8 d# ]# Y' l) \0 x. O3 o# J0 ]# Q+ ?
interface serial 0 / w6 I3 a5 Z8 Y
ip address 192.200.10.6 255.255.255.252
+ {  H% s4 S) }2 \  q8 n!
. ~9 r, \& B1 W2 a& [0 ~. yrouter ospf 200
$ C* [0 L$ D8 s4 `  ^network 192.200.10.4 0.0.0.3 area 0 4 q! M2 b9 d" B. V# e1 W
network 192.1.0.64 0.0.0.63 area 2 % K/ W+ p: w+ B6 _: C
!
' H- g7 N; `2 QRouter3:
' N5 C3 [; K/ W7 `8 e: P, finterface ethernet 0 3 z# {5 C7 D: t! e  F
ip address 192.1.0.130 255.255.255.192
2 z( g5 W! n( B  k* d% E$ y1 \! ) V! C6 O/ g  A
router ospf 300
( x3 Z/ e  W+ ]! E+ S* L( T4 I$ Enetwork 192.1.0.128 0.0.0.63 area 1
6 x; x9 p: P" i2 Q7 }- J9 F  P! 2 a! B4 r- Z3 x" M
Router4: - K! @) K: e1 Y, J$ S# g/ B
interface ethernet 0 2 x1 ?6 K, U' X7 Q) G7 X
ip address 192.1.0.66 255.255.255.192
  ^; U3 A# `3 I& M- T% e" j' |!
0 W& J  ^; ?' k& R/ }router ospf 400 8 h0 q, S& A0 ?, B( e2 P
network 192.1.0.64 0.0.0.63 area 1 # W3 }) a  @2 H2 x5 h0 H2 R
!
, m4 s0 ^5 f. z" c( v8 d相关调试命令:
. g9 |1 F! X2 u5 S7 [5 W, Y0 Mdebug ip ospf events
- E$ D* R2 p! x/ i- idebug ip ospf packet
7 \2 a0 Q. Y$ S' c; f* nshow ip ospf . G" ^5 q' u1 J
show ip ospf database 1 k; ^! I4 x" r5 K" ?6 s8 e/ E
show ip ospf interface
5 r' W  E5 p5 e& Z! Z3 G0 J" b0 eshow ip ospf neighbor / a7 u' F; K' ~$ m, c
show ip route   7 J% _) l8 w! U* i0 k: i( p9 R
3. 使用身份验证
+ m; R# l6 W; N# X3 i# z# h为了安全的原因,我们可以在相同OSPF区域的路由器上启用身份验证的功能,只有经过身份验证的同一区域的路由器才能互相通告路由信息。
4 J8 V8 n! n, G( E/ x在默认情况下OSPF不使用区域验证。通过两种方法可启用身份验证功能,纯文本身份验证和消息摘要(md5)身份验证。纯文本身份验证传送的身份验证口令为纯文本,它会被网络探测器确定,所以不安全,不建议使用。而消息摘要(md5)身份验证在传输身份验证口令前,要对口令进行加密,所以一般建议使用此种方法进行身份验证。 , p/ p: {# N6 {* _1 u9 D
使用身份验证时,区域内所有的路由器接口必须使用相同的身份验证方法。为起用身份验证,必须在路由器接口配置模式下,为区域的每个路由器接口配置口令。   ) V$ f6 \% N: |+ x
任务 命令
$ P+ D; S" S( t" C+ O0 e指定身份验证 areaarea-id authentication [message-digest] ( ]  V5 v; ?8 S5 U
使用纯文本身份验证 ip ospfauthentication-key password 9 N/ m8 L" @2 Z% `2 L' i
使用消息摘要(md5)身份验证 ip ospf message-digest-key keyidmd5 key ( d" m, m  l+ o( @
    以下列举两种验证设置的示例,示例的网络分布及地址分配环境与以上基本配置举例相同,只是在Router1和Router2的区域0上使用了身份验证的功能。:/ y  t/ A- l4 D8 v. R- I5 s% D( r
例1.使用纯文本身份验证  
8 U0 v7 _  O4 aRouter1: 8 N- {$ L3 S$ t: k
interface ethernet 0
5 \7 j# ]5 Q6 |. _ip address 192.1.0.129 255.255.255.192 1 |9 K0 @2 ]8 ]  x1 @+ F
! 0 p" D0 i% d: a2 X" S8 v
interface serial 0
# @. y6 Q1 l# w7 ]5 D) m0 Yip address 192.200.10.5 255.255.255.252
& Y( Z9 ^3 v6 c8 A2 ]& h7 K! Tip ospf authentication-key cisco
; r  _1 m% j8 i$ c. l1 x, b!
9 h6 E- @5 S  o0 t2 [" ~router ospf 100 % a& k7 u0 b* e
network 192.200.10.4 0.0.0.3 area 0
0 j; B1 f1 D4 `6 Nnetwork 192.1.0.128 0.0.0.63 area 1
5 K3 h! V& \+ H0 s; q6 C- W9 X9 ^area 0 authentication
4 Z  {3 Q# x3 Y9 R- \% d9 ^! 6 @) M1 U+ h9 ^8 q- K/ L4 m& R. _
Router2:
$ U9 {) \+ ?7 h( Q6 M' j8 Ainterface ethernet 0
# @& B5 e) ]& u! k$ g9 e+ v+ zip address 192.1.0.65 255.255.255.192 9 z2 D$ E' t" w6 H
!
8 m. y+ C5 K% kinterface serial 0
1 q) O5 q# B1 q) l. S- g5 Yip address 192.200.10.6 255.255.255.252
- g7 G* `. f) q% g- d3 M5 y* y: aip ospf authentication-key cisco   
' b6 L; l, e) N* m" o4 R3 X! , ]( w7 f6 X% t& h
router ospf 200
5 ~. N7 V; J  A* znetwork 192.200.10.4 0.0.0.3 area 0
' b3 m. w" m6 H" }4 R# Rnetwork 192.1.0.64 0.0.0.63 area 2
4 e$ X# H/ \# d. h/ narea 0 authentication
/ ?2 X+ ~, i+ X! ^, m" ]!     }6 X6 ?* V4 e) ~" N$ k7 ~
例2.消息摘要(md5)身份验证:   2 y2 @1 l2 S0 A2 O: n
Router1:
4 u: |& ~6 U" l3 s& |0 e9 y! ~% Ninterface ethernet 0
! b* Q* ~, H: Z4 F) u& E% c+ x0 T6 `/ Gip address 192.1.0.129 255.255.255.192
( y& O5 d+ E: y!
4 I7 n9 d& _6 `- G/ X* Linterface serial 0
6 ?$ O1 @" M4 a5 m7 k( a' A8 U" ]ip address 192.200.10.5 255.255.255.252 * r' q2 k' ~' ~/ b9 h7 v
ip ospf message-digest-key 1 md5 cisco
3 _1 R* ~' t% C' N7 O+ T$ d# G!
% \* l9 m" y2 X! W" Vrouter ospf 100
% a; U3 z6 ~  A9 n/ rnetwork 192.200.10.4 0.0.0.3 area 0 # J. c, g# j# s. X3 Q' C
network 192.1.0.128 0.0.0.63 area 1
- T. j* Q4 d* A. R# z9 w9 C0 farea 0 authentication message-digest / u6 D2 T9 F/ p+ l! ^; m! `
!
9 e1 \0 I. {+ ORouter2: / W: m. m5 s) j3 `' p
interface ethernet 0
) d2 ?3 Y3 B8 Y2 f0 }ip address 192.1.0.65 255.255.255.192 2 z5 B) r+ V) q: P
! / l) c& \2 P, ~+ J
interface serial 0 $ e" g5 k( r  n, U8 Q+ T" K& I9 z
ip address 192.200.10.6 255.255.255.252 # C$ B; j1 S& d. S% M
ip ospf message-digest-key 1 md5 cisco ' `. K& J  `; b7 |9 g
! - t, _+ N; [9 A; ~* z0 V: ?- X) ~
router ospf 200
" [: t8 k6 r1 D: u9 q+ Lnetwork 192.200.10.4 0.0.0.3 area 0
0 Q# s+ E! O6 f5 I! }( J: jnetwork 192.1.0.64 0.0.0.63 area 2 ' F1 s) h5 j' ?6 a6 n
area 0 authentication message-digest
  o& K$ V- z' `4 z5 g! # u8 V2 d8 f- ~( c6 T/ I7 z% f
相关调试命令: ) Y$ [3 q7 ?" p% {3 Q5 r
debug ip ospf adj 6 l" }+ X! S4 n3 H
debug ip ospf events
四、重新分配路由 0 v% H6 S# R1 L0 K( D0 Y' u& W) s
 
4 {8 o  Z1 q0 j$ M在实际工作中,我们会遇到使用多个IP路由协议的网络。为了使整个网络正常地工作,必须在多个路由协议之间进行成功的路由再分配。
8 f; J+ a( M/ S  o9 l  k 以下列举了OSPF与RIP之间重新分配路由的设置范例: " F* T; l) A; a# |- [& |* [

+ p: J7 Z5 w. Q. aRouter1的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上重新分配静态路由和直连的路由。  3 _/ a7 P  i; s6 f! m) ^6 i# v
范例所涉及的命令 ' D2 O! x) a8 f1 R+ M9 f8 I
任务 命令
* ~$ f1 a7 w" w# e* w重新分配直连的路由redistribute connected
1 u* x, L) [4 g" f1 w/ N( V重新分配静态路由redistribute static $ j+ Q3 r/ z. S, G
重新分配ospf路由 redistribute ospf process-id metricmetric-value
, e4 w# B* \% @) [$ b重新分配rip路由 redistribute rip metric metric-value
# Q! j+ E' d# L/ Y' N6 k; ]# A6 d3 M Router1:
5 }6 v3 s8 X  L9 H; ]1 }  B+ u% h# ]interface ethernet 0 ' d1 @. R+ S) m1 M
ip address 192.168.1.1 255.255.255.0
8 e( o! m0 P% B1 s- N( o5 o!
" s4 G$ C0 B# v" ]7 u" ainterface serial 0 5 S6 @/ }! V. e9 }7 i/ g
ip address 192.200.10.5 255.255.255.252
2 M" p9 z/ j, S1 X!
4 t( T1 c; K1 y0 U, }router ospf 100
2 m1 }2 @& T2 s* y1 p5 x/ rredistribute rip metric 10
1 `+ n* D9 D# E- m& h+ mnetwork 192.200.10.4 0.0.0.3 area 0 7 e* g( P1 E' ]$ C+ e+ e
!
+ U% L. H# G  X7 Wrouter rip
( D2 X* Y( J5 ?! U# N4 x2 mversion 2 * S  O7 p- }$ B, _$ }/ p3 Q
redistribute ospf 100 metric 1
/ g9 r: m- n) j0 s! ~network 192.168.1.0
9 X7 S4 I# L- l5 J!
6 U- A# _" s  j: a+ zRouter2:
3 X/ n( K2 T+ a- @6 v6 s3 T* qinterface loopback 1
, l- B4 Z' P; g* a+ Vip address 192.168.3.2 255.255.255.0 ( }1 Q: f( z1 N) Y9 @
!
; G5 r* b( `) {  ointerface ethernet 0 0 B! S+ _, x3 ^+ s4 p6 N. Q3 @
ip address 192.168.0.2 255.255.255.0
1 O/ y  t3 D+ D1 R2 m8 I! * W: @! X' J8 g3 f  s
interface serial 0 7 Z+ v( y) P) v  p2 U/ L  Y
ip address 192.200.10.6 255.255.255.252 1 E) j7 k- N% X, b) l+ L. l
!
- \( B: M+ \- N8 j. srouter ospf 200
3 u0 G8 i% @* L( B% Oredistribute connected subnet
! [# w' d% H' n# H3 X; V7 ?redistribute static subnet 5 ?, F' Q' L! R: ]( {8 M
network 192.200.10.4 0.0.0.3 area 0
; @, _  q2 X0 _, @" S! " Z2 l( `; ^- X
ip route 192.168.2.0 255.255.255.0 192.168.0.1 & a" Z" y, M* Q: Q" L) \% g
& K% V) J8 V/ i
Router3:
! v# D; m& |: P3 Kinterface ethernet 0
& d; d% m; C- b( ?# T' ~4 Uip address 192.168.1.2 255.255.255.0 1 W, S/ C% ~* T. E9 l% x5 a9 Y* }
!
+ E5 P8 S* |( Hrouter rip
# M9 C) v) Y3 _, ~6 u! L) Uversion 2 $ `+ S7 u8 ^! b6 @2 L
network 192.168.1.0
; R8 t- W! k! K- a* P( a, J!
0 e* x/ s- V* U0 B4 g! z5 D" V Router4:
. _: J2 o$ E  Q3 f2 l0 finterface ethernet 0
+ q9 N8 Z. r: N1 I/ U3 B8 C5 p0 }ip address 192.168.0.1 255.255.255.0
; Q" v! T- G; `' C8 D& M3 P% _! % a3 U# {" I( b0 N, F! \8 a+ a
interface ethernet 1 % b1 J5 Z8 c# Y4 u
ip address 192.168.2.1 255.255.255.0 ; o* B# Z$ Q- s  [, i. X' o
!
; H' C5 O/ b# T* }6 gip route 0.0.0.0 0.0.0.0 192.168.0.2 ( _8 s, B$ {: g$ B# _# t# A3 I; C
!
五、IPX协议设置
% A2 m1 P" e* o0 D& u + r: @4 |0 h+ g& R" Q3 v9 N, y
IPX协议与IP协议是两种不同的网络层协议,它们的路由协议也不一样,IPX的路由协议不象IP的路由协议那样丰富,所以设置起来比较简单。但IPX协议在以太网上运行时必须指定封装形式。  
5 p" d$ e" o2 w- M1. 有关命令  
: n( W( A) P0 p0 Z启动IPX路由 ipx routing
* Q$ `0 q1 G1 g4 O! L2 m9 \* y. j设置IPX网络及以太网封装形式 ipx network network[encapsulation encapsulation-type]1
4 |2 l/ w# a/ w: x+ N& X' P指定路由协议,默认为RIP ipxrouter {eigrp autonomous-system-number | nlsp [tag] | rip}   
" q4 g* T  J( X- [注:1.network 范围是1 到FFFFFFFD. . T" s! u; c4 y- x
IPX封装类型列表 ; g8 C" m) Y! U5 j
接口类型 封装类型 IPX帧类型
/ [3 s, i4 w. \  T% JEthernet novell-ether (默认)arpa sap snap  Ethernet_802.3 Ethernet_II Ethernet_802.2 Ethernet_Snap
$ J8 g1 y; s  eToken Ring sap (默认) snapToken-Ring Token-Ring_Snap 2 S; s6 r$ |9 G8 f. f
FDDI snap (默认) sapnovell-fddi Fddi_Snap Fddi_802.2 Fddi_Raw # O- t: i# W; M) f, x
举例:
$ y# ^" t6 p7 L0 G在此例中,WAN的IPX网络为3a00,Router1所连接的局域网IPX网络号为2a00,在此局域网有一台Novell服务器,IPX网络号也是2a00, 路由器接口的IPX网络号必须与在同一网络的Novell服务器上设置的IPX网络号相同。路由器通过监听SAP来建立已知的服务及自己的网络地址表,并每60秒发送一次自己的SAP表。  {6 @- U4 x4 ~& P& X' [
; C3 _. r; j! @$ Z  q( a0 u
Router1:8 T. x) z% q3 _
ipx routing 8 ?3 ]7 G( a! V7 T0 `, J
interface ethernet 0
! Z! T3 [% n1 n7 `% L; r1 Uipx network 2a00 encapsulation sap - ?5 o  l7 ?) m7 B
! 4 q0 z9 B- i$ j$ u: I" G$ T
interface serial 0
4 |" \5 }; G5 Jipx network 3a00
" U% L9 d% e: O" l2 D( T9 p& h! ) J1 G. w. P6 ]. p: d* g- s+ S- e% v
ipx router eigrp 10 ! F2 D) n$ V" d+ _
network 3a00 % h4 j' N* [' T% y- Z
network 2a00
: {' v: L) E0 Y: B4 f!
+ U; i+ o' b/ l( p0 O3 N- Z
3 a) s- s3 G  g9 S7 d- wRouter2: + U. Y/ H; {% X! c( j( s- T% H
ipx routing
7 c2 l# c2 C6 Yinterface ethernet 0   U0 u6 e/ }6 \
ipx network 2b00 encapsulation sap & T$ m, w$ j$ x* X: A1 m9 {" e
!
- _; }- H9 {1 l- j' n% L& s6 Binterface serial 0
7 j- C6 Q: ]) o; t( V5 oipx network 3a00
+ l% h: q0 I9 }! 2 i9 p: c9 t0 ?2 a0 L$ Y! y
ipx router eigrp 10
4 K3 R& H/ u  _network 2b00
. K- u- M/ U9 N6 _network 3a00 1 M: m, @( e5 ~0 d& `1 R
!   ! v4 j) S5 }3 q% f
相关调试命令: $ N7 V; U, _$ K1 S. D3 B0 _
debug ipx packet
0 `7 b2 ~9 T7 w& `, Qdebug ipx routing   {7 S4 M& m+ I; c5 z5 @
debug ipx sap 7 N2 K1 Y, y8 }: y
debug ipx spoof 3 f- v( D2 n  B7 C$ J& ~
debug ipx spx
) j1 F- R9 X# a, K2 g8 yshow ipx eigrp interfaces
% d9 k- |/ k  dshow ipx eigrp neighbors
) C; N  _( N3 V5 kshow ipx eigrp topology
1 h7 Z2 |5 y) c" ]show ipx interface
/ J+ R7 K) ]! D- ^0 Mshow ipx route
! y# t* _/ ~8 s# r# R% D  q2 Zshow ipx servers % w7 J* u0 X3 d0 e2 C/ I" i" N, c/ g4 j
show ipx spx-spoof
" h8 J# q9 k2 t) }! D3 w2 o) \( S& Z
第四章 服务质量及访问控制
一、协议优先级设置
! r" W% f& y# t# e- e: g# S* c 
/ S7 D7 b2 _; H. x2 h4 ~+ o1.有关命令  
3 k2 t% s+ V9 f4 w% P2 \/ V任务 命令
) }2 R; X+ _7 r7 F& U* Q# ?设置优先级表项目priority-list list-number protocol protocol {high | medium | normal | low}queue-keyword keyword-value " E. U1 T- Y% H, G3 o
使用指定的优先级表priority-group list-number
8 ^- J& Q$ ]+ |0 v' h$ y5 j6 g! {7 h$ {' N+ L2 ~* w6 g
2.举例 # M/ x$ b/ n, X6 B+ S) M
Router1: ( ~  S8 i1 U! F2 L8 ^% e# u  G3 ^% g
priority-list 1 protocol ip high tcp telnet
9 y( [! l# j# p5 Hpriority-list 1 protocol ip low tcp ftp
1 v* F  a1 A8 {1 B# r3 {7 Opriority-list 1 default normal , M8 H2 v: g" v* W- V, d% k
interface serial 0
) l) J; w: M8 f3 n) Y
* U3 z/ g5 `3 c$ Wpriority-group 1
二、队列定制
% I- d' r% N4 B4 y  o6 o- Q  I. u; f 
& B. n% v* \! h1.有关命令  3 q% G1 M) o4 u5 ~
任务 命令
1 t! @3 A1 s' t3 U设置队列表中包含协议queue-list list-number protocol protocol-name queue-number queue-keywordkeyword-value " F1 d$ X  n  y8 B# R
设置队列表中队列的大小queue-list list-number queue queue-number byte-count byte-count-number
. n) V* I8 @$ L+ T  K4 V- Y使用指定的队列表custom-queue-list list
  n3 l8 f8 _' @5 a  ?. j4 n  h   
$ L- i' X# ~+ P/ c2.举例2 W7 F  c  Z3 v. c
. {2 l% i2 o- [; b* |0 W( }
Router1:
: L0 H/ ]1 M+ z1 k- ]: W0 }queue-list 1 protocol ip 0 tcp telnet ) r9 k) @6 |' j! C' }3 P- U) N! C
queue-list 1 protocol ip 1 tcp www & s* I: Q. C: W0 v  X/ h
queue-list 1 protocol ip 2 tcp ftp 1 _% K" p8 l& j* h5 A
queue-list 1 queue 0 byte-count 300
5 q' N% A- i/ ~' [0 S* d$ n2 Gqueue-list 1 queue 1 byte-count 200 0 s4 C4 y0 o4 J" N- w
queue-list 1 queue 2 byte-count 100 & r/ G; X6 s$ f; \, w3 D
interface serial 0
5 i) X1 s6 F! E" T. N8 j1 Y0 D5 t  Z' N: ^7 u/ V+ k. r
custom-queue-list 1
, C, X/ m: R% G6 R8 V8 Q0 W& g三、访问控制 2 B9 z. k$ ^9 x: s* M
 
' Z6 ]3 O: W/ R5 |5 _1.有关命令  
: c& W( S7 C( T6 l/ N& C; P任务 命令
5 `7 E/ q0 c+ ]2 }' u5 s4 n& ]; z; U- S设置访问表项目access-list list {permit | deny} address mask
; C9 k) U3 w4 w2 \设置队列表中队列的大小queue-list list-number queue queue-number byte-count byte-count-number
3 _2 m7 b" w0 r* c  g" b+ O" Y使用指定的访问表 ipaccess-group list {in | out}
' W. m$ \3 G& X# m$ _2.举例- l& f# \5 v7 B# z2 M" R, ^
    Z  A1 F9 u: z% @- V8 ^
Router1:
7 a$ W2 P4 I; b3 ]8 laccess-list 1 deny 192.1.3.0 0.0.0.255
: O1 ~' V8 q4 U+ Y' s- D$ J( Taccess-list 1 permit any
& M7 ?) {: V+ {3 M% i# b" v: s, pinterface serial 0
8 {8 c9 l, ^  t& d) B; j( Q1 d& J* H- i2 e
ip access-group 1 in
& d% @& b9 L* {/ @5 s* N
第五章 虚拟局域网(VLAN)路由
一、虚拟局域网(VLAN)
' B" W2 V& K5 ^5 q7 k9 n当前在我们构造企业网络时所采用的主干网络技术一般都是基于交换和虚拟网络的。交换技术将共享介质改为独占介质,大大提高网络速度。虚拟网络技术打破了地理环境的制约,在不改动网络物理连接的情况下可以任意将工作站在工作组或子网之间移动,工作站组成逻辑工作组或虚拟子网,提高信息系统的运作性能,均衡网络数据流量,合理利用硬件及信息资源。同时,利用虚拟网络技术,大大减轻了网络管理和维护工作的负担,降低网络维护费用。随着
发表于 2014-3-23 11:30:26 | 显示全部楼层
我也想试试 可惜么有思科路由器
发表于 2014-3-31 17:51:36 | 显示全部楼层
很好, 学习资料啊谢谢了
*滑块验证:
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|小黑屋|宽带技术网 |网站地图 粤公网安备44152102000001号

GMT+8, 2025-5-3 22:31 , Processed in 0.046835 second(s), 4 queries , Redis On.

Powered by Discuz! X3.5 Licensed

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表