1、有用的路由协议配置 挺有用的协议配置,建议大家都留备一份~~~ 1、命令格式: RIP Router# config t Router(config)#router rip Router(config-router)#network 192.168.10.0 255.255.255.0(注意的的问题是,这里需要掩码吗?答案是不需要,因为RIP本身是有类的,也就是说不用输入255.255.255.0它也知道是这个掩码)所以,正确的是: Router(config-router)#192.168.10.0 Router(config-router)#192.168.20.0
2、Router(config-router)#172.16.0.0 Router(config-router)#10.0.0.0 Router(config-router)#end Router#copy run start 如果要使用RIPV2的话需要这样做。 Router(config-router)#version 2即可。 IGRP Router#config t Router(config)#router igrp 10(虽都是距离矢量协议,它需要AS号) Router(config-router)#network 192.168.10.0 Router(confi
3、g-router)#network 192.168.20.0 Router(config-router)#network 192.168.30.0 Router(config-router)#end Router#copy run start EIGRP Router#config t Router(config)#router eigrp 20(混合型路由协议,与igrp一样需要AS号) Router(config-router)#network 192.168.40.0 Router(config-router)#network 192.168.50.0 Router(c
4、onfig-router)#network 192.168.60.0 Router(config-router)#end Router#copy run start OSPF Router#config t Router(config)#router ospf 100 Router(config-router)#network 192.168.10.0 0.0.0.255 area 0 Router(config-router)#network 172.16.0.0 0.0.255.255 area 0 Router(config-router)#network 10.0.0.
5、0 0.255.255.255 area 0 Router(config-router)#network 192.168.0.0 0.0.255.255 area 0 Router(config-router)#network 192.0.0.0 0.255.255.255 area 0 Router(config-router)#network 192.168.50.1 0.0.0.0 area 0 2、管理距离 静态路由 1 通过接口实现的路由 0 直接相连的网络 0 RIP 120 IGRP 100 internal EIGRP 90 external E
6、IGRP 170 OSPF 110 3、支持的网络层协议 RIP IP协议 IGRP IP协议 EIGRP IP IPX AppleTalk,通过PDM(Protocol-dependent modules)来实现,由它实现维护一系列的路由表,ip/eigrp ipx/eigrp appletalk/eigrp IS-IS IP CLNS(Connectionless Network Service) OSPF IP 4、Verifying命令 RIP和IGRP Show ip route显示当前使用的路由协议,网络号AD/Metric,下一跳和本地接口。 Show p
7、rotocols 显示被动路由协议,应用的接口及其IP地址。 Show ip protocol显示包括AS、timer、要声明的网络、邻居和AD值。 Show ip interface brief 显示各端口的IP地址,状态等。 Show int 显示所有端口的详细信息,而上面只显示开启与否与IP地址。 Debug ip rip telnet时默认不能看到debug信息,需要输入terminal monitor 显示接收和发送的路由信息,距离 debug ip igrp events 显示通过哪一个端口接收或发送更新。 Debug ip igrp transactions 显
8、示接收和发送的路由信息及通过哪个端口。这一个与debug ip rip 实现的功能相同。 要关闭debug,用命令undebug all 或简写为un all EIGRP Show ip route 显示当前使用的路由协议,网络号,AD/Metric下一路地址和本地接口。 Show ip route eigrp 只显示eigrp的路由信息等。 Show ip eigrp neighbor显示所有eigrp的邻居路由器地址,建立起连接的时间,发送hello的timer,重传时间等。 Show ip eigrp topology显示eigrp的拓扑表,以及是否为successor,还显
9、示feasible distance和advertised distance。 OSPF Show ip route显示的内容同上。 Show ip ospf显示ospf的一般信息。但不确定是否显示路由信息。 Show ip ospf database显示process ID、接口ID和相应的RID。 Show ip ospf interface显示各个接口的ospf信息。 Show ip ospf neighbor显示ospf的邻居信息,包括neighbor ID,优先级、状态(是否为DR/BDR等)邻居的接口地址以及接收的本地接口。 Show ip protocol这个命令很
10、有用,能显示出所有运行的路由协议的实际操作。 5、AS等数字 IGRP AS 1-65535 EIGRP AS 1-65535 OSPF Process ID 1-65535 区域号:0-42亿 area 0为骨干区域,必须存在。 VLAN号:1-1005其中1002-1005为保留,1-1001可分配。 Subinterface 号:0-42亿. Standard acl 1-99或1300-1999 Extended acl 100-199或2000-2699 6、timer Update(sec) Invalid(sec) Hold down(sec) Flush(s
11、ec) RIP 30 180 180 240 IGRP 90 270 280 630 7、几张列表 EIGRP 邻居表,拓扑表,路由表 OSPF 邻居表,链路状态表,路由表 8、组播地址 RIP V2 224.0.0.9 EIGRP 224.0.0.10 OSPF 224.0.0.5 (DR) 224.0.0.6(BDR) 9、路由器间的信息传递协议 RIP 用传输层的UDP传播。端口520,不可靠 IGRP 用IP协议号9 不可靠 EIGRP 用RTP协议传播IP协议号88 可靠 OSPF 用IP协议号89传播,不用TCP也不用UDP。可靠。 10、算法 RI
12、P Bellman-Ford RIPv2 Bellman-Ford IGRP Bellman-Ford EIGRP DUAL (扩散更新算法) OSPF Dijkstra 又称为SPF算法,最短路径优先算法。 11、自动汇总 RIP、RIPv2、EIGRP默认开启自动汇总;但是默认不开启对不连续子网的支持。其中,RIP总是开启自动汇总以减少路由表中的路由信息量;RIPv2和EIGRP可以通过no auto-summary来关闭该功能,以实现对不连续网络的支持。 OSPF默认不开启自动汇总,默认不开启对不连续子网的支持。 RIP不支持不连续网络,因为默认它不能关闭自动汇总。 I
13、GRP也不支持不连续网络。(书上并没有说为何,网上也搜索不到原因) EIGRP和OSPF默认不开启对不连续网络的支持。 关于EIGRP的手动汇总 Core#config t Core(config)#router eigrp 10 Core(config-router)#network 192.168.10.0 Core(config-router)#network 10.0.0.0 Core(config-router)#no auto-summary Core(config-router)#int e0 Core(config-if)#ip summary-addre
14、ss eigrp 10 192.168.10.64 255.255.255.224 Summary-address是在接口配置模式下设置的。 关于OSPF的手动汇总 OSPF手动汇总用于把一个area的汇总路由向area 0宣告时。用图与EIGRP一样,但是之前需要把接口分入不同的area。命令如下: Core#config t Core(config)#router ospf 110 Core(config-router)#network 192.168.10.68 0.0.0.3 area 1 Core(config-router)#network 192.168.10.
15、64 0.0.0.3 area 1 Core(config-router)#network 10.10.10.0 0.0.0.255 area 0 Core(config-router)#area 1 range 192.168.10.64 255.255.255.224 对OSPF进行配置时并不需要像EIGRP那样使用命令no auto-summary,因为如上所述,OSPF默认并没有开启自动汇总,所以自然不需要用这条命令。 12、度量值(Metric) RIP、RIPv2使用跳数(hops)作为度量值。最大跳数为15;默认支持四条等耗费的负载平衡,最大可开启到六条。 IGRP默
16、认使用带宽bandwidth和线路的延时delay of the line,被称为复合度量值。这两个默认的度量之外,可信度,负载和最大传输单元也能被使用。除此之外它还设有默认为100,可设为255的最大跳计数,但hop并不参与度量值的计算,其目的只是为了限制AS的范围。默认支持四条不等耗费的负载平衡。最大可开启到六条。 EIGRP同IGRP。其中,度量值计算时不考虑MTU,但是在EIGRP的一些命令中它是一个相关的参数。尤其是在redistribution时。 OSPF度量值为cost,思科只使用带宽这个参数。不同的设备生产商计算cost的方法是不一样的。思科使用100,000,000/b
17、andwidth,bandwidth是接口处的带宽。但命令ip ospf cost命令优先与这个方程。 13、passive-interface命令 RIP协议中,它指定的端口不发送路由信息,但是接受。所以,它仍然会学习到其它路由器的网络。 EIGRP协议中,它既不发送也不接受。所以不会学习到其它路由器的网络。 这条命令应用在不想传播路由协议的端口上。如果serial口或bri0接口。 14、发送路由信息 RIP IGRP因为通过广播发送,所以它从所有活动的接口发送路由信息。 EIGRP、RIPv2、和OSPF用多播发送,从连接路由器的接口发送。 路由器配置命令详细列表 【
18、内容摘要】 cisco路由配置语句汇总启动接口,分配ip地址:router>router>enablerouter#router#configureterminalrouter(config)#router(config)#interfacetypeportrouter(config-if)#noshutdownrouter(config-if)#ipaddressip-addresssubnet-maskrouter(config-if)#^z配置rip路由协议:30秒更新一次router(config)#routerriprouter(config-if)#…… ----------
19、 cisco路由配置语句汇总 启动接口,分配ip地址: router> router> enable router# router# configure terminal router(config)# router(config)# interface type port router(config-if)# no shutdown router(config-if)# ip address i
20、p-address subnet-mask router(config-if)# ^z 配置rip路由协议:30秒更新一次 router(config)# router rip router(config-if)# network network-number <——通告标准a,b,c类网——> router(config-if)# ^z 配置igrp路由协议:90秒更新一次 router(config)# router igrp as-number <—— as-number范围1~65535——> router(config-if)# net
21、work network-number <——通告标准a,b,c类网——> router(config-if)# ^z 配置novell ipx路由协议:novell rip 60秒更新一次 router(config)# ipx routing [node address] router(config)# ipx maximum-paths paths <——设置负载平衡,范围1~512——> router(config)# interface type port router(config-if)# ipx network network-number
22、[encapsulation encapsulation-type] [secondary] <——通告标准a,b,c类网——> router(config-if)# ^z 配置ddr: router(config)# dialer-list group-number protocol protocol-type permit [list acl-number] router(config)# interface bri 0 router(config-if)# dialer-group group-number router(config-if)# dia
23、ler map protocol-type next-hop-address name hostname telphone-number router(config-if)# ^z 配置isdn: router(config)# isdnth-typeth-type <——配置isdn交换机类型,中国使用basic-net3——> router(config-if)# ^z 配置frame relay: router(config-if)# encapsulation frame-relay [cisco | ietf ] router(config-
24、if)# frame-relay lmi-type [ansi | cisco | q933a ] router(config-if)# bandwidth kilobits router(config-if)# frame-relay invers-arp [ protocol ] [dlci ] <——配置静态invers arp表: router(config)# frame-relay protocol protocol-address dlci [ broadcast ] [ ietf | cisco ] [ payload-compress | packe
25、t-by-packet ] ——> <——设置keepalive间隔: router(config-if)# keepalive number ——> <——为本地接口指定dlci: router(config-if)# frame-lelay local-dlci number ——> <——子接口配置: router(config-if)# interface type port.subininterface-number [ multipoint | point-to-point ] router(config-subif)#
26、ip unnumbered interface router(config-subif)# frame-lelay local-dlci number ——> router(config-if)# ^z 配置标准acl: router(config)# access-list access-list-number [ permit | deny ] source [ source-mask ] <—— access-list-number 范围:1~99标准acl;100~199扩展acl;800~899标准ipx acl;900~999扩展ipx acl;100
27、0~1099 ipx sap acl;600~699apple talk acl——> router(config)# interface type port router(config-if)# ip access-group access-list-number [ in | out ] router(config-if)# ^z 配置扩展acl: router(config)# access-list access-list-number [ permit | deny ] [ protocol | protocol-number ] source sour
28、ce-wildcard [ source-port ] destination destination-wildcard [ destination-port ] [ established ] router(config)# interface type port router(config-if)# ip access-group access-list-number [ in | out ] router(config-if)# ^z 配置命名acl: router(config)# ip access-list [ standard | extended
29、] acl-name router(config [ std- | ext- ] nacl)# [ permit | deny ] [ ip-access-list-test-conditions ] router(config [ std- | ext- ] nacl)# no [ permit | deny ] [ ip-access-list-test-conditions ] router(config [ std- | ext- ] nacl)# ^z router(config)# interface type port router(config-i
30、f)# ip access-group [acl-name | 1~199 ] [ in | out ] router(config-if)# ^z 配置dce时钟: router# show controllers type port <——确定dce接口——> router(confin-if)# clock rate 64000 <——进入dce接口设置时钟速率——> router(config-if)# ^z 配置ppp协议: router(config)# username name password set-password-here <
31、——验证方建立数据库——> router(config)# interface type port router(config-if)# encapsulation ppp <——启动ppp协议——> router(config-if)# ppp outhentication [ chap | chap pap | pap chap | pap ] <——选择ppp认证——> router(config-if)# ppp pap sent-username name password password <——发送验证信息——> router(config-if)#
32、 ^z pap单向认证配置实例: 验证方: router-server(config)# username client password 12345 <——验证方建立数据库——> router-server(config)# interface serial 0 router-server(config-if)# encapsulation ppp router-server(config-if)# ppp authentication pap <——选择使用pap实现ppp认证——> router-server(config-if)# ^z
33、 被验证方: router-client(config-if)# encapsulation ppp router-client(config-if)# ppp pap sent-username client password 12345 <——发送验证信息——> router-client(config-if)# ^z pap双向认证配置实例: 路由器 a: routera(config)# username b password 12345 routera(config)# interface serial 0 routera(confi
34、g-if)# encapsulation ppp routera(config-if)# ppp authentication pap routera(config-if)# ppp pap sent-username a password 54321 routera(config-if)# ^z 路由器 b: routerb(config)# username a password 54321 routerb(config)# interface serial 1 routerb(config-if)# encapsulation ppp ro
35、uterb(config-if)# ppp authentication pap routerb(config-if)# ppp pap sent-username b password 12345 routerb(config-if)# ^z chap单向认证配置实例: 验证方: router-server(config)# username router-client password 12345 router-server(config)# interface serial 0 router-server(config-if)# encapsu
36、lation ppp router-server(config-if)# ppp authentication chap router-server(config-if)# ^z 被验证方: router-client(config-if)# encapsulation ppp router-client(config-if)# ppp authentication chap router-client(config-if)# ppp chap hostname router-client router-client(config-if)# ppp
37、 chap password 12345 router-client(config-if)# ^z chap双向认证配置实例: 路由器 a: routera(config)# username routerb password 12345 routera(config)# interface serial 0 routera(config-if)# encapsulation ppp routera(config-if)# ppp authentication chap routera(config-if)# ppp chap hostname rou
38、tera routera(config-if)# ppp chap password 54321 routera(config-if)# ^z 路由器 b: routerb(config)# username routera password 54321 routerb(config)# interface serial 1 routerb(config-if)# encapsulation ppp routerb(config-if)# ppp authentication chap routerb(config-if)# ppp chap h
39、ostname routerb routerb(config-if)# ppp chap password 12345 routerb(config-if)# ^z telnet使用: routera# terminal monitor <——可以传回在远端主机执行debug命令的结果——> routera# telnet ip-address [ router-name ] <——telnet到指定的地址或名字的主机——> routerb# [ exit | logout ] <——退出telnet——> routerb# ++<6>再按 <——挂起
40、telnet——> routera# show sessions <——显示当前所有telnet的信息,包括connect-number ——> routera# connect-number <——返回指定的telnet连接——> routera# disconnect ip-address [ router-name ] <——断开指定地址或名字的主机的连接——> routera# show user <——显示telnet到本机的连接信息——> routera# clear line [ 0 | 1 | 2 | 3 | 4 ] <——断开指定telnet到本
41、机的连接——> 禁止任何telnet到本机: router(config)# line vty 0 4 router(config-line)# access-class acl-number router(config)# ^z 设置主机名: router(config)# hostname set-hostname router(config)# ^z router(config)# ^z 设置用户模式密码: router(config)# line console 0 router(config-line)# login
42、 router(config-line)# password set-password router(config-line)# ^z 设置telnet密码: router(config)# line vty 0 4 router(config-line)# login router(config-line)# password set-password router(config-line)# ^z 设置特权模式密码: router(config)# enable password set-password <——不加密的密码,明码——>
43、 router(config)# enable secret set-password <——经过加密的密码——> router(config)# ^z 给所有密码加密: router(config)# service password-ancryption set-password-here router(config)# no service password-ancryption <——取消加密——> router(config)# ^z 设置登录banner: router(config)# banner motd 分隔符 set-ban
44、ner-information-here 分隔符 <——前后分隔符一定要一致——> 设置接口的描述信息: router(config-if)# description set-port-information-here router(config)# ^z cdp的控制: router(config-if)# cdp enable <——在指定端口启用cdp,缺省——> router(config-if)# no cdp enable <——在指定端口关闭cdp——> router(config)# cdp run <——使所有端口启用cdp——>
45、 router(config)# no cdp run <——使所有端口关闭cdp——> ping的使用: router# ping ip-address router# ping <——扩展ping命令——> protocol [ip]:[ protocol-type ] <——选择协议类型——> target ip address:ip-address <——输入测试地址——> repeat count [5]: <——选择发送的icmp包数量——> datagram size [100]: <——选择每个包的大小——> timeout
46、 in seconds [2]: <——设置每个包的超时时间——> extended commands [n]:y <——使用扩展ping命令——> sweep range of sizes [n]: tracke的使用: router# trace ip-address [ host-name ] 为cisco 4000路由器指定媒体类型: router(config-if)# media-type 10baset <——使aui(默认)失效,改为使用rj-45——> router(config-if)# ^z 更改路由器启动顺序:
47、router(config)# boot system flash ios-filename router(config)# boot system tftp ios-filename tftp-ip-address router(config)# boot system rom router(config)# ^z 修改寄存器数值: router(config)# config-register value <——cisco出厂默认value=0x2102,value范围:0x2100(进入rom监视器),0x2101(使系统从rom启动),0x2102~0x2
48、10f(使系统从nvram启动)。0x1=0x2101,从最小位开始改变——> 在rom监视器中更改寄存器数值: > o/r value 路由器密码的恢复: 冷关机,然后再开机并在60秒内按< ctrl>+进入rom监视器模式 > o/r 0x2142 <--25xx型路由器--> 或 > confreg 0x2142 <--16xx型路由器--> router> i router> n router> enable router# copy startup-config running-config router# configur
49、e terminal router(config)# enable secret new-password router(config)# config-register 0x2102 router(config)# ^z router# copy running-config startup-config router# reload 配置名称-主机入口: router(config)# ip host set-name [ tcp-port-number ] ip-address [ ip-address 2 ].。。 router(co
50、nfig)# ^z 定义dns主机: router(config)# ip name-server server-address [ server-address 2 ].。。 router(config)# ^z 禁用dns: router(config)# no ip domain-lookup router(config)# ^z配置水平分割: router(config-if)# ip split-horizon router(config-if)# no ip split-horizon router(config-if)# ^z
©2010-2025 宁波自信网络信息技术有限公司 版权所有
客服电话:4009-655-100 投诉/维权电话:18658249818