CCNP—IGP重分发 分发列表 前缀列表 route-map
- 格式:docx
- 大小:44.86 KB
- 文档页数:3
RGNOSv10.3(3)BGP和OSPF在路由重分发时的注意点2008-5-15福建星网锐捷网络有限公司版权所有侵权必究前言本文档介绍了RGNOS V10.3(3)中BGP和OSPF路由重发布时的一些实现特点。
由于这些特点区别于友商CISCO的BGP功能实现,在具体的项目实施过程中需要注意。
1.☹本文档仅限公司内部使用,严禁外传。
1.☺如果您在阅读中产生疑问,请与文档维护人联系。
目录1. 1OSPF重分发BGP路由1. 1.1注意点1. 这里Cisco验证的版本为c7200-adventerprisek9-mz.124-9.T1.bin2. 1.2应用实例1. 1.2.1网络拓扑四台设备之间建立EBGP/IBGP/EBGP连接。
C1为CISCO 3550、C2、C3是Cisco模拟器,R1是我司设备,实验设备为RG-S5750。
C1和R1建立EBGP连接,R1和C2建立IBGP连接,C2和C3建立EBGP连接。
其中C1和C3主要是发送路由,具体的操作在R1和C2。
2. 1.2.2配置文件C1 简化配置C1#sho running-configBuilding configuration...Current configuration : 2557 bytes!version 12.2no service padservice timestamps debug uptimeservice timestamps log uptimeno service password-encryption!hostname C1!!no aaa new-modelip subnet-zeroip routing!!!!!!no file verify autospanning-tree mode pvstspanning-tree extend system-id!vlan internal allocation policy ascending!!interface Loopback0ip address 1.1.1.1 255.255.255.255!interface FastEthernet0/1no switchportip address 192.168.16.1 255.255.255.248!interface FastEthernet0/2switchport mode dynamic desirable!interface FastEthernet0/3switchport mode dynamic desirable!...!router bgp 1no synchronizationbgp log-neighbor-changesredistribute staticneighbor 192.168.16.2 remote-as 23no auto-summary!ip classlessip route 192.168.111.0 255.255.255.0 Loopback0ip route 192.168.112.0 255.255.255.0 Loopback0ip http serverip http secure-server!!!control-plane!!line con 0line vty 0 4privilege level 15password wlogin!!endC1#C2简化配置C2#sho runnBuilding configuration...Current configuration : 1450 bytes!version 12.4service timestamps debug datetime msecservice timestamps log datetime msecno service password-encryption!hostname C2!boot-start-markerwarm-rebootboot-end-marker!!no aaa new-model!resource policy!ip cef!!!!interface Loopback0ip address 192.168.125.1 255.255.255.0 secondary ip address 192.168.126.1 255.255.255.0 secondary ip address 2.2.2.2 255.255.255.255!interface FastEthernet0/0ip address 192.168.26.2 255.255.255.248duplex full!interface Ethernet1/0no ip addressshutdownduplex half!interface Ethernet1/1no ip addressshutdownduplex half!interface Ethernet1/2no ip addressshutdownduplex half!interface Ethernet1/3ip address 192.168.23.1 255.255.255.248duplex full!router ospf 1log-adjacency-changesnetwork 2.2.2.2 0.0.0.0 area 0network 192.168.26.0 0.0.0.7 area 0!router bgp 23no synchronizationbgp log-neighbor-changesnetwork 192.168.125.0network 192.168.126.0neighbor 6.6.6.6 remote-as 23neighbor 6.6.6.6 update-source Loopback0neighbor 6.6.6.6 next-hop-selfneighbor 192.168.23.2 remote-as 3no auto-summary!no ip http serverno ip http secure-server!!...!line con 0stopbits 1line aux 0line vty 0 4privilege level 15password wlogin!!endC2#C3简化配置C3#sho runnBuilding configuration...Current configuration : 1178 bytes!version 12.4service timestamps debug datetime msecservice timestamps log datetime msecno service password-encryption!hostname C3!boot-start-markerboot-end-marker!!no aaa new-model!resource policy!ip cef!!!!!!interface Loopback0ip address 3.3.3.3 255.255.255.255!interface FastEthernet0/0no ip addressshutdownduplex full!interface Ethernet1/0no ip addressshutdownduplex half!interface Ethernet1/1no ip addressshutdownduplex half!interface Ethernet1/2no ip addressshutdownduplex half!interface Ethernet1/3ip address 192.168.23.2 255.255.255.248duplex full!router bgp 3no synchronizationbgp log-neighbor-changesredistribute staticneighbor 192.168.23.1 remote-as 23no auto-summary!ip route 192.168.131.0 255.255.255.0 Loopback0ip route 192.168.132.0 255.255.255.0 Loopback0no ip http serverno ip http secure-server!!!logging alarm informational!...!line con 0stopbits 1line aux 0line vty 0 4privilege level 15password wlogin!!endC2#R1简化配置R1#show runnBuilding configuration...Current configuration : 2080 bytes!version RGNOS 10.3.00(3), Release(38105)(Fri Apr 25 15:29:44 CST 2008 -ngcf31)hostname R1co-operate enable!!!!route-map ospf_redist permit 10match route-type external!vlan 1!!!!!interface GigabitEthernet 0/1no switchportno ip proxy-arpip address 192.168.26.1 255.255.255.248!interface GigabitEthernet 0/2!...!interface GigabitEthernet 0/23!interface GigabitEthernet 0/24no switchportno ip proxy-arpip address 192.168.16.2 255.255.255.248!interface Loopback 0ip address 6.6.6.6 255.255.255.255ip address 192.168.165.1 255.255.255.0 secondaryip address 192.168.166.1 255.255.255.0 secondary!!!!!!!!router bgp 23neighbor 2.2.2.2 remote-as 23neighbor 2.2.2.2 update-source Loopback 0neighbor 192.168.16.1 remote-as 1!address-family ipv4network 192.168.165.0network 192.168.166.0neighbor 2.2.2.2 activateneighbor 2.2.2.2 next-hop-selfneighbor 192.168.16.1 activateexit-address-family!!router ospf 1router-id 6.6.6.6network 6.6.6.6 0.0.0.0 area 0network 192.168.26.0 0.0.0.7 area 0!!!ip route 192.168.161.0 255.255.255.0 Loopback 0ip route 192.168.162.0 255.255.255.0 Loopback 0!!line con 0line vty 0 10privilege level 15loginpassword w!!end3. 1.2.3检验配置效果C2使用show ip bgp可以看到125.0/126.0是源发路由,111.0/112.0/165.0/166.0是IBGP路由,131.0/132.0是EBGP路由。
EIGRP重要的EIGRP验证命令配置EIGRP认证(只支持MD5)Key chain name 创建一个密钥链(邻居路由密钥链可不同)Key number 创建一个或多哥密钥号(邻居密钥号必须相同)Key string value 指定身份验证的值Ip authentication mode eigrp ASN md5 在接口上为特定的EIGRP ASN启用MD5认证Ip authentication key-chain eigrp ASN name-of-chain验证MD5认证配置:show key-chain ; debug eigrp packet ; show clock建立基本的EIGRP拓扑表:1.使用network命令启用了EIGRP的路由接口连接的子网前缀。
2.在EIGRP命令neighbor中指定的接口连接的子网的前缀。
3.通过其他路由协议重分发到EIGRP中的路由或其他路由信息源获取的前缀。
将这些信息加入到本地EIGRP topology数据库中后,路由器边可将前缀信息及每个前缀相关连的其他拓扑信息通告给每个正常运行的EIGRP邻居。
EIGRP路由过滤:1.使用ACL进行过滤Access-list 1 deny 192.168.1.0 0.0.0.255Access-list 1 permit anyRouter eigrp 1Distribute-list 1 out(in)2.使用ip前缀列表进行过滤Ip prefix-list policy seq 5 deny 192.168.1.0 /24 ge 25 le 30Ip prefix-list policy seq 10 permit 0.0.0.0./0 le 32Router eigrp 1Distribute-list prefix policy out(in)3.使用路由映射表过滤:Ip prefix-list policy seq 5 permit 192.168.1.0/24 ge 25 le 30 Ip access-list 1 permit 192.168.2.0 0.0.0.255Route-map filter deny 8Match ip address prefix-list policyRoute-map filter deny 9Match Ip address 1Route-map filter permit 10Router eigrp 1Distribute-list route-map filter outEIGRP路由汇总:Ip summary-address eigrp asn prefix- subnet-mask默认路由:方法1. ip router 0.0.0.0 0.0.0.0 s0/0方法2. ip default-network network-numberOSPFLSDB中的信息如下:1.路由ID。
路由重分布基本配置1实验目的通过本实验可以掌握种子度量值的配置路由重分布参数的含义静态路由重分布直连路由重分布RIP和EIGRP的重分布EIGRP和OSPF的重分布重分布路由的查看和调试2实验拓扑3实验步骤配置路由器R1router ripversion 2no auto-summarynetwork 172.16.0.0redistribute static metric 3ip route 192.168.1.0 255.255.255.0 Null0R2router eigrp 1no auto-summarynetwork 172.16.23.2 0.0.0.0redistribute rip metric 1000 100 255 1 1500//将rip 重分布到EIGRP 中router ripversion 2no auto-summarynetwork 172.16.0.0redistribute eigrp 1default-metric 4//配置重分布进行RIP协议所有的默认种子度量值R3router eigrp 1no auto-summarynetwork 172.16.23.3 0.0.0.0redistribute ospf 1 metric 1000 100 255 1 1500distance eigrp 90 150//将ospf 重分布到EIGRP中router ospf 1router-id 3.3.3.3network 172.16.34.3 0.0.0.0 area 0redistribute eigrp 1 metric 30 metric-type 1 subnetsredistribute maximum-prefix 100 50R4access-list 1 permit 172.16.0.0 0.0.254.0//该ACL用于匹配172.16.X.0 X代表偶数access-list 2 permit 172.16.1.0 0.0.254.0//该ACL用于匹配172.16.X.0 X代表奇数route-map CONN permit 10 //配置路由映射表match ip address 1 //匹配ACL 1set metric 200 //匹配度量值route-map CONN permit 20match ip address 2set metric 100set metric-type type-1//设置ospf 路由类型为OE1 默认为OE2route-map CONN permit 30//以上路由映射表CONN是为在OSPF 重分布直连路由器时调用的其含义是:对于172.16开头的第三位是偶数的路由条目设置度量值为100 路由类型为OE2 (默认不用配置)对于172.16 开头的第三位是奇数的路由条目,设置度量值为200 路由类型为OE1 ,而其他路由条目采用默认即度量值为20 路由类型为OE2router ospf 1router-id 4.4.4.4network 172.16.34.4 0.0.0.0 area 0redistribute connected subnets route-map CONN//重分布时调用路由映射表4实验调试R1:前缀列表和路由映射表控制路由更新1实验目的通过本实验可以掌握前缀列表的使用和含义在路由映射表中用前缀列表匹配用路由映射表控制路由更新2实验拓扑3实验步骤R1ip prefix-list CONN1 seq 5 permit 172.16.0.0/16 ge 24 le 28ip prefix-list CONN2 seq 5 permit 172.16.0.0/16 ge 29route-map CONN permit 10match ip address prefix-list CONN1set metric 100set metric-type type-1route-map CONN permit 20match ip address prefix-list CONN2set metric 200set tag 200route-map CONN permit 30router ospf 1router-id 1.1.1.1network 172.16.12.1 0.0.0.0 area 0redistribute connected subnets route-map CONNR2router ospf 1router-id 2.2.2.2network 172.16.12.2 0.0.0.0 area 0network 172.16.23.2 0.0.0.0 area 1R3route-map TAG permit 10match tag 200router ospf 1router-id 3.3.3.3network 172.16.3.3 0.0.0.0 area 1network 172.16.23.3 0.0.0.0 area 1distribute-list route-map TAG in//R3通过分布列表在入向过滤,只把TAG为200 的路由从数据库中提取道路由表中4实验调试以上3条E1 路由条目匹配前缀列表CONN1以上2条E2 路由条目匹配前缀列表CONN2以上2条路由条目的tag 值为200从R3 的链路状态数据库中可以看出,从R1重分布直接进入ospf的5条条目都有,但是由于针对R3的seria1/1 接口的入方向的分布列表要求匹配tag值为200的路由条目所以OSPF 只把tag 值为200 的放入路由表中试验总结:首先需要依照拓扑图划分好区域,不同的区域类型配置。
重发布-重分发--重分布:用于不同的路由协议共享路由表;必须存在ASBR(自治系统边界路由器)---协议边界路由器存在种子度量规则:1、在ASBR上配置,若将A协议发布到B协议,进入B协议配置;2、将A协议发布到B协议,是将ASBR上通过A协议学习和自身宣告到A协议的直连路由,全部重发布到B协议;三种协议间的重发布:1)A--->B 动态到动态2)静态---> B 静态到动态3)直连--->B 直连到动态只要ASBR上没有宣告到A协议中的路由,全部到A协议名词:单点单向单点双向双点双向多点双向RIPA--->Br2(config)#router ripr2(config-router)#redistribute ospf 1 metric 2r2(config-router)#redistribute eigrp 90 metric 2注:必须配置种子度量,默认为15;静态--->Br2(config)#router ripr2(config-router)#redistribute static注:默认种子度量为1直连--->B 该直连路由没有宣告到RIP中r2(config)#router ripr2(config-router)#redistribute connected注:默认种子度量为1OSPF:A--->Br2(config)#router ospf 1r2(config-router)#redistribute rip 发布有类别到OSPFr2(config-router)#redistribute rip subnets 发布无类别到OSPFr2(config-router)#redistribute eigrp 90 subnetsSubnets 字段添加后才能发布无类,携带原有掩码默认种子度量为20,类型2r2(config-router)#redistribute rip subnets metric-type 1 metric 10类型种子度量静态--->Br2(config)#router ospf 1r2(config-router)#redistribute static subnets默认种子度量为20,类型2r2(config-router)#redistribute static subnets metric-type 1 metric 10直连--->Br2(config-router)#redistribute connected subnets默认种子度量为20,类型2r2(config-router)#redistribute connected subnets metric-type 1 metric 10注:OSPF中无论缺省路由是通过其他动态还是静态学习;均必须使用专门的指令来发布r2(config-router)#default-information originate重发布进入的缺省路由,类型2,种子1;EIGRP:A--->Br2(config)#router eigrp 90r2(config-router)#redistribute ospf 1 metric 1544 100 255 1 1500r2(config-router)#redistribute rip metric 1544 100 255 1 1500注:必须配置种子度量,默认种子无穷大;以上参数除带宽外,其他值已经为最佳了;使用字母D EX标示,管理距离为170;静态--->Br2(config)#router eigrp 90r2(config-router)#redistribute static 默认给定最佳种子度量r2(config-router)#redistribute connected 默认给定最佳种子度量当两种非EIGRP的IGP路由协议进行双点双向重发布,可能出现路由回馈问题:r4(config)#router ospf 1r4(config-router)#distance 121 2.2.2.2 0.0.0.0RID为2.2.2.2的邻居传输进入的路由条目,管理距离修改121;在管理距离后;若ASBR的接口处于DV路由协议中,且管理距离默认较大;可能用于水平分割导致路由回馈;路由策略:基于控制层面流量进行干涉,最终影响路由协议的选路计算;启动干涉选路的作用;路由策略的工作规则:1、使用专门的协议来抓取控制层面流量2、路由策略基于抓取的流量进行策略1)抓取流量的协议(1)ACL 基于源目IP地址、端口号、协议号/MAC地址来抓取流量;及可以抓取数据层面流量,又可以抓取控制层面流量;缺点:本身设计用于抓取数据层面流量;故在控制流量(网络号)不能精确(2)前缀列表只能抓取控制层面流量--可以搭配分发列表、route-map使用r1(config)#ip prefix-list ccna deny 1.1.1.0/25 网络号为1.1.1.0/25r1(config)#ip prefix-list ccna permit 1.1.1.0/25 ge 26 网络号为1.1.1.0/26-32r1(config)#ip prefix-list ccna permit 1.1.1.0/25 ge 32 网络号为1.1.1.0/32r1(config)#ip prefix-list ccna permit 1.1.1.0/25 le 32 网络号为1.1.1.0/25-32r1(config)#ip prefix-list ccna permit 1.1.1.0/24 ge 25 le 30 网络号为1.1.1.0/25-30len < ge-value <= le-value匹配规则:从上往下逐一匹配,末尾隐含拒绝所有r1(config)#ip prefix-list ccna permit 0.0.0.0/0 le 32 允许所有r1(config)#ip prefix-list ccna seq 21 permit 1.1.1.0/30 基于序号插入,可随意删除任何一条(1)偏移列表在DV路由协议中,在控制层面更新进出接口上,人为增加度量;可以叠加r1(config)#access-list 1 permit 1.1.1.0r1(config)#router ripr1(config-router)#offset-list 1 in 2 serial 1/0(2)分发列表----人为决定哪些路由传递给邻居【1】抓取流量--前缀列表r2(config)#ip prefix-list ccie deny 2.2.2.0/24 拒绝该条目r2(config)#ip prefix-list ccie permit 0.0.0.0/0 le 32 允许其他条目【2】配置分发列表r4(config)#router ripr4(config-router)#distribute-list prefix ccie out fastEthernet 0/0前缀方向进出接口【1】抓取流量--ACLr4(config)#access-list 10 deny 2.2.2.0r4(config)#access-list 10 permit any【2】配置分发列表r4(config)#router ripr4(config-router)#distribute-list 10 out fastEthernet 0/0注:方向为控制层面的方向;但OSPF协议不支持出接口,仅支持入接口,必须传输拓扑,但可以不加载到路由表;注:分发列表除可以限制协议更新包在接口上的进出外,同时还可以在重发布直接限定那些路由可以被发布r4(config)#ip prefix-list ccsp deny 2.2.2.0/24r4(config)#ip prefix-list ccsp permit 0.0.0.0/24r4(config)#router ospf 1r4(config-router)#distribute-list prefix ccsp out rip从ospf发出到rip的协议;必须为out方向注:此时是限制OSPF重发布到RIP中的条目;(3)route-map :可以为重发布、BGP选路、PBR工作;可以基于ACL和前缀列表同时工作r2(config)#access-list 1 permit 1.1.1.0r2(config)#access-list 2 permit 1.1.2.0r2(config)#ip prefix-list ccna permit 1.1.3.0/24r2(config)#ip prefix-list ccnp permit 1.1.4.0/24注:对于将进行不同的策略的流量,需要定制到不同的列表中r2(config)#route-map cisco permit 10 创建列表cisco,序号10.大动作允许r2(config-route-map)#match ip address 1 匹配ACLr2(config-route-map)#exitr2(config)#route-map cisco permit 20 cisco列表的序号20,大动作允许r2(config-route-map)#match ip address 2 匹配ACLr2(config-route-map)#set metric-type type-1 小动作修改默认类型r2(config-route-map)#exitr2(config)#route-map cisco permit 30 cisco列表的序号30,大动作允许r2(config-route-map)#match ip address prefix-list ccna 配置前缀列表r2(config-route-map)#set metric ?+/-<metric> Add or subtract metric 在原有基础上进行加减<0-4294967295> Metric value or Bandwidth in Kbits per second 直接修改某个值<cr>r2(config-route-map)#set metric 10 小动作为修改度量r2(config-route-map)#exitr2(config)#route-map cisco deny 40 cisco列表的序号40,大动作拒绝r2(config-route-map)#match ip address prefix-list ccnpr2(config-route-map)#exitr2(config)#route-map cisco permit 50 cisco列表的序号50,空表项r2(config-route-map)#重发布时调用:r2(config)#router ospf 1r2(config-router)#redistribute rip subnets route-map ciscoRoute-map配置指南:1、序号若不配置;默认永远为10;故除第一条,其余必须编辑序号2、大动作不配置,默认为允许3、匹配规则--从上往下注意匹配,所上条匹配按上条执行,不再查看下条,默认隐含拒绝所有;4、执行规则---不匹配即匹配所有流量,不执行即不执行任何小动作,仅按大动作处理故使用大动作为允许的空表项,可以允许所有;5、在每条条目中存在或and 与or 关系route-map na permit 10match ip address 1 2 3 4 5 6 7 8 9 10 或关系set metric 10set metric-type type-1 与关系set as-path prepend 1 2 3注:可以理解为匹配的流量中任何一个流量出现,将对其执行所有的小动作;6、若一个序号中,先匹配了ACL的流量,那么将不能再匹配前缀列表的流量;反之一样;。
Route-mapCCNP学习笔记关于route-map的配置讨论,1.Passive-interface被动接口RIP中的被动接口是只收不发,EIGRP中的被动接口是不收不发。
配置,路由进程中,Passive-interface default 关闭所有接口No passive-interface s1/1 打开s1/1接口2.Distribute-list分发列表配置,利用ACL来抓取路由条目,Access-list 1 permit 4.4.4.0 0.0.0.255(路由条目)在路由进程中应用分发列表,Router eigrp 100Distribute-list 1 in/out 接口这个就代表只允许4.4.4.0的路由条目通过,其他路由条目不允许通过。
In后面不能跟协议,只有out后面可以跟。
Out后面不可以跟接口。
3.Prefix-list前缀列表,设计用于专抓路由,不仅可以抓网络号,还可以抓掩码。
配置,利用prefix-list来抓取路由条目,Ip prefix-list 1 permit 2.2.2.0/24(代表必须严格匹配网络号必须是2.2.2.0,掩码必须是24位的。
)在路由进程中应用prefix-list,Router eigrp 100Distribute-list prefix 1 out 接口Prefix-list的其他写法:Ip prefix-list 1 permit 2.2.2.0/24 (匹配前24位:2.2.2.*,掩码必须为24位)Ip prefix-list 1 permit 2.2.2.0/24 le 32 (匹配前24位:2.2.2.*,掩码必须为24—32位)Ip prefix-list 1 permit 2.2.2.0/24 ge 26 (匹配前24位:2.2.2.*,掩码必须为26---32位)Ip prefix-list 1 permit 2.2.2.0/24 ge 25 le 30 (匹配前24位:2.2.2.*,掩码必须为25---32位)Ip prefix-list 1 permit 0.0.0.0/0 le 32 (匹配所有,不可以写any)Show ip prefix-list可以用查看。
#conf t从终端配置路由器int eo指定E0端口#ip addr ABCD XXXXABCD为以太网地址XXXX为子网掩码#IP addr ABCD XXXX secondary E0口直接支持两个地址类型,如果第一个为A类地址则第二个为B类或C类地址no shutdown 激活E0端口#exit退出配置#conf t#Int S0 指定s0端口#ip addr ABCD XXXXABCD为以太网S0的IP地址,XXXX为子网掩码#encap X.25-ABC分装X.25协议,ABC指定X.25为DTC或DCE操作,缺省为DTE#X.25 map ip ABCD XXXX br映射的X.25的地址,ABCD为对方的路由器的X.25端口地址。
show running config 显示所有的配置show versin显示版本号和寄存器值show history查看历史记录no ip address 删除已经配置的ip地址no IP address 删除已经配置的ip地址show history 查看历史记录show ip 查看ippassword+密码配置telnet密码enable password+密码配置明文密码2900交换机配置vlan databasevalan 1 test1valan 2 test2show vlan 查看vlanset vtp v2 enable 开启VTPshow vtp statistics 显示串发出或收到的VTP通知信息的摘要内容干线:干线指交换机和另一个允许多个虚拟网的信息流从中穿过设备之间的链接access link接入链接static vlan静态虚拟网end to end vlan端到端的虚拟网配置多层交换机vlan之间的路由:switch(config)#ip routing //激活多层交换机的路由功能switch(config)#router ip_routing_protocol//配置路由协议switch(config)#interface vlan-id //创建虚拟端口trunk link干线链接frame tagging帧标记vtp pruning vtp取消local vlan 本地虚拟网set spantree portpri设置端口优先级show spantree 验证端口优先级set spantree portvlanpri 改变某个虚拟网或虚拟网组的优先级\set spantree maxage 设置BUDU的最大生命周期进入配置模式:interface选择封装类型:switchport trunk encapsucation{is|dotlq|negotiate}配置trunk上许可的vlan:swithprot trunk allowed vlan{add|except|all|remove}在vlan database下配置vlan:vlan databasevlan 1exitVTP配置:进入全局配置模式confinguer termial将VTP配置为服务器模式 VTP server配置域名 VTP domain启动VTP版本2 VTP version 2指定VTP密码 VTP password在管理域中启动VTP修剪技术 VTP pruning使用show vtp status来查看vtp的配置及当前的状态把交换机上的catos复制到tptp服务器:capy tptp flashbootflash源文件cat4000.6-1-1.bin目的主机的IP地址将ram文件拷贝到nvram中:copy runing startup将nvrum中的文件拷贝到ram中:copy startup runing将tftp服务器中的文件拷贝到nvram中:copy tftp start将nvram中的文件拷贝到tftp服务器中:copy start tftp将内存ram中的文件拷贝到tftp服务器中:copy run tftp将tftp中的文件拷贝到内存ram中:copy tftp run删除nvram中的文件:erase startdebug命令打上时间标记:service timestamaps debug datatime msec为日志消息打上时间标记:service timestamaps log datatime msecshow vtp counters查看VTP的统计数据show interface验证私用vlan:show interface switchportshow vlan private-vlan激活生成树协议:spanning-tree vlan降低将交换机的优先级:spanning-tree vlan 200 priority 4097将当前交换机的vlan 200优先级降低为4097配置接口的开销:spanning-tree cast 18 把当前交换机的开销设置为18spanning-tree vlan 200 cast 17 把当前交换机的vlan 200开销降低为17将端口的开销降低这个端口的有可能成为根端口show spanning-tree vlan 200检验此生成树的vlan200的端口是否打开生成树是否激活show spanning-tree vlan vlan-id检验生成树是否激活查看一个交换机上的所有生成树的信息:show spanning-tree bridge配置生成树快速端口:spannning-tree portfastshow running-config interfacespanning-tree uplinkfastshow spanning-tree uplinkfast 检验交换机上的uplinkfast是否激活spanning-tree backbonefast 快速骨干show spanning-tree backbonefast 查看快速骨干是否激活spanning-tree mode mstspanning-tree mst configuretionnamerevision rev-num 配置多生成树的版本号intstance inst vlan range 把valn映射到生成树里面激活多生成树show spanning-tree mst configuretion 查看多生成树的配置show spanning-tree mst x 查看某一具体的生成树配置etherchannelinterface interface slot/portchannel-group number mode{auto/disirable/on}//二层interface port-channel port-channer numberip adress adress mst//三层show ranning-config port-channel num//查看二层etherchannel的配置show ranning-config interface intface x/yshow etherchannel number port-channel 查看某一个通道的状况switch (config-if)#channel-portocol{lacp/pagp}默认是pagp pagp是思科私有的lacp port-priority priority_value 配置lacp端口的优先级switch#lacp system-port-priority priority_value 配置交换机的优先级switch (config)#port channel load balance type 配置以太通道的负载平衡的方式show spanning-tree summary totals 检测交换机上buduguard的交换信息bpdu过滤:spanning-tree portfast bpdufilter defaultspaning-tree guard root 根的保护show spanning-tree inconsistentports 查看处于阻塞状态的端口switch (config)#udld enable 激活单向链路检测switch (config-f)#udld enable 激活某一个以太网某个端口的链路检测no udld enable //关闭非光口链路检测udld disable //关闭光口链路检测switch#udld reset 复位链路接口激活某一个端口环路保护功能:spantree guard loopswitch#show udld interfaceswitch#debug spanning-tree all 检查交换机所有的生成树debug spanning-tree event 检查交换机的所有生成树事件debug spanning-tree backbonefast 检查交换机的快速骨干的情况debug spanning-tree uplinkfast 显示生成树的快速上行链路事件路由器配置IPsec-vpn:router(config)#crypto isakmp policy priority 创建策略并指定策略的优先级router(config-isakmp)# encreption{des/3des} 指定对称加密算法router(config-isakmp)#has{sha/md5} 指定消息摘要算法router(config-isakmp)#authertication{rsa-sig/rsa-encr/pre-share} 指定身份认证方法router(config-isakmp)#group{1/2}指定dh分组编号router(config-isakmp)#lifetime seconds 指定sa生存期设置标识对方用的方法:router(config)#crypto isakmp identity{address/hastname} 建立主机名和ip地址之间的关系:router(config)#ip host hostname address1确定身份认证的密码: router(config)#crypto isakmp key keystring address peer-address显示IKE策略:router#show crypto isakmp policy定义交换集:router(config)#crypto ipsec transfrom-set transform-set-name transform1[transform2/transform3]定义ipsec的工作模式:router(cfg-crypto-tran)mode{tunnel/transport}看交换机上邻居表的信息:switch#show adjacency查看ip路由表:switch#show IP route查看多层交换机上的路由协议:switch#show ip protocolsRPR:路由处理器冗余.主控引擎坏了启动备份引擎RPR+的配置:switch(config)#redundency//进入到冗余配置switch(config-red)#mode rpr plusswitch#show redundency states//显示当前的冗余电源的冗余:power redundency_mode combined/redandunt //combined两个电源合作工作,redandunt两个电源冗余工作switch#show power//查看当前电源的供给no power enable module_id//关闭电源上的某一个模块power cycle module_id//开启电源上的某一个模块switch#show ip arp //查看虚拟路由器的IP地址和mac地址HSRP的配置:switch(config-if)#standby id ip //id是备份组的组号,ip是虚拟路由器的ip且虚拟路由器的ip必须和实际路由器的ip在同一个子网网段内配置HSRP的抢先功能:switch(config-if)#standby id preempt //id是备份组的组号配置计时器:switch(config-if)#standby timers 5 15 //5表示hellotime的时间,15表示hodetime的时间,hellotime的时间至少是hodetime时间的三倍接口的监测:switch(config-if)#standby group_number track type number interface_priority 优先级查看当前备份的状态:switch#show standby brief显示HSRP状态改变的消息:switch#debug standbySRM单路由器模式:switch(config)#redundancyswitch(config-r)#high availabilityswitch(config-r-ha)#single-router-mode检查单路由器模式是否配置好 switch#show startup-config检查当前冗余配置状态是否激活:switch#show redundancySLB服务器负载平衡功能的配置:switch(config)#ip slb serverfarm serverfarm-name//定义服务器群名switch(config-slb-sfarm)#real ip-address//设置ip地址switch(config-slb-real)#inservice//激活真实的服务器定义虚拟的服务器:switch(config)#ip slb serverfarm viltual-server-nameswitch(config-slb-vserver)#virtual address maskswitch(config-slb-vserver)#serverfarm farm_nameswitch(config-slb-vserver)#inservice//激活switch(config-slb-vserver)#client//限制只有那些客户机能访问这个服务器启动ip组播路由:switch(config)#ip multicast-routingswitch(config)#ip pim[sparse-mode|dense-mode|sparse-dense-mode]启动稀疏或密集模式的组播路由协议auto RP自动RPswitch(config)#ip pim send-rp-announce type number scope ttl group-list access-list-numberswitch(config)#ip pim send-rp-discovery scope ttl配置自举路由器:switch(config)#ip pim brs-candidate interface hash-maks-length 配置rp的候选路由器:switch(config)#ip pim version[1|2]//选择pim的版本switch(config)#ip pim rp-candidate type number ttl group-list access-list-number查看路由器的单播路由表:switch#show ip mroute查看路由器上哪些接口启动pim路由协议:switch#show ip pim interface查看路由器的pim邻居:switch#show ip pim neighbor查看路由器上的rp:switch#show ip pim rp查看自举路由器:switch#show ip pim bsr激活rip协议:router(config)#router riprouter(config-router)#network network-number//选择要激活的接口的网段router#show ip protocols//查看ripQOS定义一个类switch(config)#class-map name定义策略图switch(config)#policy-map policy-name在接口上应用一个策略图:switch(config-if)#service polity{input|output} polity-name 启动QOS:switch(config)#mls qos配置接口上的信任状态:switch(config-if)#mls qos trust{cos|dscp|ip-precedence}查看当前交换机上的类图:switch#show class-map查看交换机上的策略图:switch#show polity-map polity-name查看接口上的策略图的应用:switch#show polity-map interface 接口名 input|output class class-name打precedence标记:switch(config)#polity map polity-nameswitch(config-pmap)#class class-nameswitch(config-pmap-c)#set ip precedence 0-5打DSCP标记:switch(config)#polity mappolity-nameswitch(config-pmap)#class class-nameswitch(config-pmap-c)#set ipdscp 0-5|ef //ef指加速转发class map voicematch ipdscp ef//所有属于ipdscp ef的包属于voice类nbuy基于网络的应用识别switch#show class-mapswitch(config-cmap)#match protocol protocol-name配置拥塞控制的QOSswitch(config-if)#ip rtp priority start-port/udp端口号 port range/端口范围 bw/带宽最大的预定带宽:switch(config-if)#max-reserved-bandwidth present不超过总带宽的百分之七十五查看接口队列配置:show queue interface-type interface-numberLLQ低延迟队列:switch(config)#policy-map policy-nameswitch(config-pmap)#class class-nameswitch(config-pmap-c)#priority bandwidth检查队列配置:switch#show queue interface-type interface-number查看策略图的配置:switch#show polity interface interface-number查看某一个策略图的配置:switch#show polity-map polity-map-nameWRR加权的轮行:switch(config-if)#wrr-queue cos-map//分配服务类型cos的值switch(config-if)#wrr-queue bandwith weight1 weight2 分配权值switch(config-if)#wrr-queue random-detecte max-threshold queueIDthreshold1 threshold2 定义丢失门槛wred加权的拥塞避免switch(config-if)#random-detect dscp-based 用dscp的值计算数据包丢弃的可能性switch(config-if)#randam-detect dscp dscpvalue min-threshold max-threshold[mark-probality denominator]设置最小丢弃门槛最大丢弃门槛以及丢弃的可能性查看接口上的配置队列: switch#show queueing interface interface-spec诊断RSVP:debug ip rsvp显示优先级队列的输出:debug porioritySPAn:switch(config)#monitor sessionRSPAN:switch(config)#vlan vlan-name:switch(config-vlan)#remote spanswitch#show monitor session session-number[detail]网络分析模块上启动某一个收集类型:root@localhost#autostart collection enableswitch#show moduleswitch#show interface gigabitEthernet slot/[1|2]AAA(认证授权记账)的配置:switch(config)#aaa new-modelswitch(config)#aaa authertication login{default|list-name}methold1[methold2]}switch(config)#line[aux|console|tty|vty] line-number[ending-line-number]//应用某一个接口switch(config)#login authertication[default|list-name]//应用定义的名字aaa授权:switch(config)#aaa autherorizetion [auth-proxy|network|exec|commands level|reverse-access|configuration|immobile}{default|list-name[methode1[methode2 ...]]}switch(config)#ppp autherorizition{default|list-name}switch(config)#interface interface-type interfacenumberaaa记账:switch(config)#aaa accounting {systerm|network|exec|connection|commands level{default|list-name}}start-stop|stop only|none}[methode1[methode2...]switch(config)#ppp accounting{default|list-name}switch(config)#interface interface-type interfacenumber端口的安全配置:switch(config-if)#switchport port-[maximum value] violation[protect|restrict|shoudown]802.1X认证的配置:switch(config)#aaa authertication dot1x {defauter}method1[method2...]switch(config)#dot1x syeterm-auth-control//启动802.1x的认证switch(config-if)#dot1x port-control auto//端口上启动802.1x的认证switch#show port-security//检验端口的安全性switch#show port-security interface interface x/y//检查具体某一个端口的安全性switch#show port-security address//查看交换机所有的mac地址表中的安全的mac地址vlan的ACL配置:switch(config)#vlan access-map map-name[seq#]创建vlan的访问图switch(config-access-map)#match{ip address{1-199|1300-2699|acl-name}ipx address{800-999|acl-name} mac address acl-name}//定义匹配条件switch(config-access-map)#action {drop [log]}|{forward [capture]}|redirect{type slot/port|port-channel channel-id }//定义匹配的动作switch(config)#vlan filter map-name vlan-list list//把前面定义过的访问图应用到vlanPvlan私有vlan的配置:switch#vtp mode transpoarent//vtp为透明模式switch(config-vlan)#private-vlan {primary|isolated|community} //主vlan,隔离vlan,团体vlanswitch(config-vlan)#privaty-vlan association{secondary-vlan-list |add svl|remove svl}//把主vlan跟从vlan关联起来switch#show vlan ptivate-vlan type//显示私有vlan的配置信息pvlan端口的配置:switch(config-if)#switchport mode private-vlan{host|promiscuous}//主vlan模式,混杂模式端口switch(config-if)#switchport private-vlan host-association primary-vlan-ID secendary-vlan-id}//host模式下把这个端口划分到主vlan中去switch(config-if)#private-vlan mapping primary-vlan-IDsencendary-vlan-list|add svl|remove svl}混杂模式下把这个端口划分到主vlan中去switch#show interface private-vlan mapping //显示私有vlan的信息配置ripv2:router(config)#router riprouter(config-router)#version 2router(config-router)#network network-numberEIGRP(增强的内部网管路由协议)中Metric值的计算方法:Metric=[k1*带宽+((k2*带宽)/(256-负载))+k3*延时]默认缺省k1=1,k2=0,k3=1,k4=0,k5=0;注意:带宽取整个网络中带宽最小的链路的带宽bw(带宽)=(10 000 000/以K为单位的带宽)*256Metric=[k1*带宽+((k2*带宽)/(256-负载))+k3*延时]*[k5/(延时+k4)]默认缺省k1=1,k2=0,k3=1,k4=0,k5=1;延时=传输的延时(以微秒为单位)/10*256EIGRP的Metric=igrp的Metric*256关闭自动汇总:(config router)#no auto-summaryEIGRP汇总:(config-if)#ip summary-address eigip [as-number](自制系统号)[address][mask]EIGRP控制查询:router(config-router)#eigrp stub[receive only|connected|static|summary]//receive only只接收eigrp邻居的信息,connected 把直连的网络信息传递给eigrp邻居, static把自己的静态路由传递给他的eigrp邻居路由器,summary是自制系统号在ospf网络上配置缺省路由:router(config-router)#default-information originate[always]//always表示网络中不管有没有缺省路由都会添加一条缺省路由。
•BGP属性公认属性Well-Known•公认强制属性Well-known mandatory•公认自由属性Well-known discretionary可选属性Optional•可选传递的Optional transitive•可选非传递的Optional non-transitive报文•Origin —公认强制属性•指出了路径信息的源头,有下列3种可能:•IGP:用network通告路由时,用i表示•EGP:路由通过EGP获悉,用e表示•Incomplete:路由的源头未知或是通过其他方法获悉的,用?表示。
例如重发布•路由优选顺序:IGP > EGP > Incomplete•NEXT_HOP —公认强制属性•指出了用于前往目的地的下一跳IP地址。
•对EBGP会话来说,NEXT-HOP就是通告该路径的EBGP邻居的接口IP。
•对IBGP,起源AS内部的路由的NEXT-HOP就是通告该路径的邻居的IP。
(如果有设定更新源,则为更新源地址),而从EBGP学到的路由的NEXT-HOP,在IBGP内传递时不变,始终指向的是下一个AS(本AS对端的EBGP邻居接口IP)。
•COMMUNITY —可选传递属性•用于简化路由策略的执行•可以将某些路由分配一个特定的COMMUNITY属性,之后就可以基于COMMUNITY值而不是每条路由进行BGP属性的设置了route-map bgp permit 10set community ?<1-4294967295> community numberaa:nn community number in aa:nn format // 路由所属as:nn标识additive Add to the existing communityinternet Internet (well-known community) // 默认所有路由都属于该团体local-AS Do not send outside local AS (well-known community)不把这条路由传出本AS(联邦as中的小联邦)。
1.IGP(EIGRP/OSPF/IS-IS)2.EGP(BGP)3.policy4.IP multicast5.路由表:控制层和数据层(FIB)组成。
接入层:ACCESS LAYER端口密度汇聚层:DISTRIBUTION LAYER接入层流量的聚合点,高可用性(冗余+热备份)核心层:CORE LAYER高可用性+高吞吐量,快速转发数据。
Backbone+MAN层二:交换,(以太网)层三:路由可收敛的网络(可聚合的网络)的流量:--语音+视频流量--语音应用程序(IP电话)--办公性质--路由更新--网络管理流量(监控和日志)关键的需求:性能:带宽,延迟,抖动(jitter,到每个节点延迟的偏移量),语音和视频对延迟和抖动要求高。
Real-time 实时流量对延迟,抖动要求高,不可逆性安全:接入和转发。
SONA----语音,视频和数据的综合数据体系,是AVVID 的扩展。
目的是将网络朝IIN(智能信息网)方向推进,IIN 有三个阶段:集成传输,集成服务,集成应用。
SONA>>IIN网络放大效应效率=IT资产成本/ IT资产成本+运营成本使用率=所使用的资产/总资产(%)效能=效率*使用率网络放大效应=使用SONA的效能/不适用SONA的效能IS-IS用于超大型网络,而EIGRP,OSPF用于大型网络环境。
OSPF在NBMA网络上的运行模式:一.RFC:2328定义的:1.nonbroadcast(NBMA)非广播(不支持广播和组播)---- 默认模式(星型网络)必须在同一个子网内。
特点:1.要选举DR/BDR,所有接口处于同一子网,要确保中心路由器(hub)成为BD/BDR.2.边缘路由器(spoke)相互之间要作DLCI的映射(DLCI的复用)3.必须手动指定邻居(neighbor命令)把组播流量(hello包)已单播的形式传输出去2.point-to-multipoint(P2M)1.要选举DR/BDR,所有接口处于同一子网2.多点FR子接口要修改接口的网络类型3.SPOKE之间无需做DLCI复用二.CISCO定义的标准:1.broadcast1.要选DR/BDR,所有接口处于同一子网要确保中心路由器(hub)成为BD/BDR.2.边缘路由器(spoke)相互之间要作DLCI的映射(DLCI的复用)2.point-to-point(P2P)1.DR/BDR不选举,hello time 为10s2.hub要划分子接口,两个子接口在不同的子网3.point-to-multipoint nonbroadcast(P2M NBMA)1.要选举DR/BDR,所有接口处于同一子网2.多点FR子接口要修改接口的网络类型3.SPOKE之间无需做DLCI复用4.需要手动指定邻居。
课程安排:D1,路由基础汇总,EIGRP协议介绍及配置D2,OSPF协议介绍及基本配置D3,OSPF协议介绍及高级配置D4,多协议互操作及路由控制(收发过滤)D5,BGP协议介绍及配置资料推荐:模拟器,Packet Tracer、GNS3(调用IOS)远程登录,cmd、putty、secureCRT路由基础:路由,一条路由表示一个网段路由器,运行路由协议、生成路由表、根据路由表转发报文。
路由协议,共享路由信息的方式路由表,收集不同方式获取的路由,组成路由表路由协议:作用范围:自治系统AS(1-65535)IGP,一个AS内传递路由。
RIP EIGRP OSPFEGP,AS间传递路由。
BGP传递路由方式:距离矢量路由协议,路由器间分享路由表RIP EIGRP BGP链路状态路由协议,路由器间分享直连链路信息(确保可达,可靠)OSPF路由传递是否携带掩码:有类,RIPv1 IGRP不携带掩码,自动汇总无类,RIPv2 EIGRP OSPF BGP携带掩码,支持VLSM,支持手动汇总路由注入路由表:管理距离值小,度量值小管理距离值,衡量协议(路由获取方式)优劣直连0,静态1,EIGRP5\90\170,OSPF110,BGP20\200 RIP120 度量值,衡量路径优劣RIP,跳数hop,1-15EIGRP,带宽、延时、可靠性、负载OSPF,开销(与带宽成反比)查找路由表:最长匹配,掩码最长递归查找,找到出接口Show ip route192.168.1.0/24 serial 1/0 //递归查找10.0.0.0/8 serial 1/210.0.0.0/9 serial 1/310.1.0.0/16 serial 1/310.1.1.0/24 192.168.1.1 //最长匹配0.0.0.0/0 172.16.1.1172.16.1.0/24 serial 1/1收到报文的目的IP地址为10.1.1.1,从serial1/0发出路由协议:建立邻居→分析路由信息→算法→生成路由表→维护路由表以太网Dst:0100.5e00.0009 Src:aaaa.aaaa.aaaa type/length:0x0800 IPSrc:1.1.1.1Dst:224.0.0.9Pro:17TTL:1UDPSrc:xDst :520RIPupdate192.168.1.0/24hop:3以太网Dst:bbbb.bbbb.bbbb Src:aaaa.aaaa.aaaa type/length:0x0800 IPSrc:1.1.1.1Dst:2.2.2.2Pro:6TTL:xTCPSrc:xDst:179BGPupdate192.168.1.0/24属性以太网Dst:bbbb.bbbb.bbbbSrc:aaaa.aaaa.aaaatype/length:0x0800IPSrc :1.1.1.1Dst :224.0.0.5|10Pro :89|88TTL :1OSPF|EIGRP hello浮动静态路由:手动修改静态路由的管理距离值,使其不出现在路由表中 RIP 高级配置:手动汇总 R2(config)#interface Ethernet 0/0//连接R1的接口R2(config-if)#ip summary-address rip 10.1.1.2 255.255.255.254R1#show ip route ripR 10.1.1.2/31 [120/1] via 10.1.12.2, 00:00:28, Ethernet0/0 R 10.1.23.0/24 [120/1] via 10.1.12.2, 00:00:28, Ethernet0/0 路由验证验证模式:明文、MD5;KeyIDinterface Xip rip authentication mode text //开启明文验证ip rip authentication mode md5 //开启密文验证ip rip authentication key-chain xx //调用钥匙链(密码库)key chain xx //创建密码库,命名为xxkey 1 //创建第一组密码key-string ccna //密码设置为ccnaaccept-lifetime //开门密码,当前密码key用于解锁接收到的RIP 报文时,时效性是多少send-lifetime //关门密码,用当前密码key加密RIP报文时,时效性key 2key-string ccnpkey 3key-string ccieshow ip route ripdebug ip rip被动接口:设置为被动的接口不向外发送组播(目的IP地址为224.0.0.9)的RIP报文R2(config)#router ripR2(config-router)#passive-interface Ethernet 0/1R3#show ip routeC 10.1.1.3/32 is directly connected, Loopback0C 10.1.23.0/24 is directly connected, Ethernet0/1R1#show ip routeC 10.1.12.0/24 is directly connected, Ethernet0/0R 10.1.1.2/32 [120/1] via 10.1.12.2, 00:00:12, Ethernet0/0 R 10.1.1.3/32 [120/2] via 10.1.12.2, 00:00:12, Ethernet0/0C 10.1.1.1/32 is directly connected, Loopback0R 10.1.23.0/24 [120/1] via 10.1.12.2, 00:00:12, Ethernet0/0 EIGRP,Cisco特点:1、邻居机制,Hello报文,发现、建立、维护邻居2、可靠传输机制a)显式可靠,专用的ACK报文(已收回执)b)隐式可靠,其余报文内包含ACK字段3、扩散更新算法DUAL,防环。
CCNP路由笔一OSPF篇:OSPF EIGRP都是用4个逻辑分支1 发现邻居(发送hello报文)2建立邻居表(two way)3 建立拓扑表4建立路由表(选择最佳路由)流程为down –init- two way(建立邻居成功DR BDR选举完成)-exstat(交换之前会选出主从关系确定谁先发送数据)-exchange(交换DB过程)loadiing(交换lsu)full(完成整个数据交换ospf真个过程建立完成)。
基础知识1.ABR(至少有一个接口与另外两个OSPF区域相连)骨干路由器(至少有一个接口在AREA 0区域内)内部路由器(所有接口都再这个区域内)指定路由器DR(在交换数据链路LSA时不是每个路由器都相互转发而是通过DR/BDR进行2. DRother向DR,BDR发送DD,LSA request或者LSA UPdate时目标地址是AllDRouter(224.0.0.6);或者理解为:DR侦听224.0.0.6DR,BDR向DRother发送DD,LSA Request或者LSA Update时目标地址是AllSPFRouter(224.0.0.5);或者理解为:DRother侦听224.0.0.5并且所有的DROTHER与DR只会形成TWOWAY邻居关系但是不会形成full只有DR或BDR出现故障才回重新选举,即使加进来的优先级或者RID再打也不会重新选举,如果DR出现故障那么BDR接替,如果BDR出现故障重新选举BDR,DR保持不变3各类LSA1类路由器LSA:每台路由器上都会有1类LSA 他指出了这个路由器的RID和所有的IP地址ABR会有很多1类LSA,每个区域的LSA都会在ABR中列出`。
2类网络LSA:是有DR生成描述中转网络子网及该子网的路由接口这里的10.5.5.0为DR所创建的中转网络,他显示的是DR的接口。
只有DR与BDR会形成FULL状态,DRother与DR之间形成FULL与BDR之间形成FULL所有DROTHER之间形成twoway状态。
路由重分发/各种列表介绍RIP*******A协议分布到RIP =A协议的直连接口地址和打A协议都被引入到RIP中,SEED-METRIC 默认是无穷大,需要手工添加METRIC直连分布到RIP =直连分布到RIP中SEED-METRIC默认是1 不用手工添加。
静态/默认分布到RIP =静态分布到RIP中SEED-METRIC默认是1 不用手工添加。
OSPF*******A协议分布到OSPF =A协议的直连接口地址和打A协议都被引入到OSPF中,必须手工添加SUBNETS,SEED-METRIC默认是20直连分布到OSPF =直连分布到OSPF必须手工添加SUBNETS,SEED-METRIC默认是20静态/默认分布到OSPF =静态分布到OSPF必须手工添加SUBNETS,SEED-METRIC默认是20,(默认路由不能被分布进去*)EIGRP*******A协议分布到EIGRP =A协议的直连接口地址(ISIS除外,有BUG)和打A协议都被引入到EIGRP中。
SEED-METRIC默认是无穷大,需要手工添加METRIC,直连分布到EIGRP =直连分布到EIGRP中,不用手工添加静态/默认分布到EIGRP =静态分布到EIGRP中,不用手工添加ISIS*******A协议分布到ISIS =A协议的直连接口地址和打A协议都被引入到ISIS中,SEED-METRIC 默认是0直连分布到ISIS =直连分布到ISIS中,SEED-METRIC默认是0静态/默认分布到ISIS =静态分布到ISIS中,SEED-METRIC默认是0,(默认路由不能被分布进去*)实验任务1:双点双向重分发出现次优路径选择,解决方法实验任务2:重分发问题:在R4上show ip route能学习到几条路由!!结论:两条,在路由器协议A引入协议B动作:R上的所有运行A的协议和直连路由(除ISIS,ODR)以及R上的所有学习到的A的协议路由,都会重分布的B协议中实验任务3:passive-interface interfaceX被动接口命令总结:RIP:此命令不主动发送路由更新,但接收路由更新EIGRP: 此命令不发送和接收HELLO信息OSPF:此命令不发送和接收HELLO信息ISIS:此命令不发送和接收HELLO信息以RIP举例:R1:router ripversion 2passive-interface Serial1/0--------------配置被动接口network 1.0.0.0network 13.0.0.0no auto-summaryR3:R3#show ip route ----------------没有学习到R1的1.1.1.0/24的路由3.0.0.0/24 is subnetted, 1 subnetsC 3.3.3.0 is directly connected, Loopback013.0.0.0/24 is subnetted, 1 subnetsC 13.1.1.0 is directly connected, Serial1/0查看R1的路由表:R1#show ip route ---------------可以接收到R3的3.3.3.0/24的路由3.0.0.0/24 is subnetted, 1 subnetsR 3.3.3.0 [120/1] via 13.1.1.3, 00:00:09, Serial1/0开启R1的debug开关R1#debug ip ripR1#clear ip route *-------清除路由表*Mar 1 01:05:30.767: 3.3.3.0/24 via 0.0.0.0, metric 2, tag 0-----------接收到R3的路由分发列表:distribute-list {access–list-number | name} out ------------出方向[interface–name| routing–process [routing-process parameter]]distribute-list [access–list-number | name] | [route-map map-tag] in [interface-type interface-number]]------------进方向分发列表的作用是影响到控制层,可以灵活的指定那些路由可以进入,那些路由被拒绝!实验任务4:两台路由器运行EIGRP协议,并宣告所有的接口到EIGRP中。
CCNP知识:使用route-map控制路由重分发的方法最近在学习CCNP的相关课程和知识要点,总结出来的一些东西未必是正确的,不过先发表出来,共大家参考和讨论。
先说说使用route-map控制路由重分发的方法、组网和配置,以4个路由器组成一个链式网络。
至于这些命令是在什么模式下打出来的,有基础的应该都能看出来的,就不要纠结于这些命令是在全局模式还是在路由模式抑或是在接口模式下打出来的。
废话不多说了,进入正题。
以上是拓扑图,下面上配置以及简单的介绍。
有时候我们想控制路由协议重分发时哪些路由条目应该通告,哪些路由条目不应该通告。
这样做可能是为了保密,也可能是为了别的目地,管他呢,反正有些人就是有一些奇奇怪怪的需求。
而要达到这个目的的有两种工具,通过分发列表控制哪些路由条目应该被重分发,哪些不应该被重分发。
而另一种工具为路由映射表,而我今天讲的就是利用路由映射表来经行路由重分发控制。
简单介绍下什么是路由映射表。
路由映射表是一种逻辑化的语言,就像程序语言中的if-then-else,满足某种条件就执行某项动作。
而路由映射表的功能就太强大了,像我前面做的pbr用到了路由映射表,而做bgp路径控制更要用到路由映射表,而今天讲控制重分发又用到了。
废话不多说了,先讲讲拓扑结构。
4台路由器,其中r1和r4运行ripv2,在r1上有4个环回接口。
r2为asbr路由器,分别运行着ripv2和ospf,r3也为ospf。
r4:in e1/0ip add 192.168.1.1 255.255.255.0no shin loop 1ip add 4.4.4.4 255.0.0.0router ripversion 2net 192.168.1.0net 4.0.0.0r1:in e1/1ip add 192.168.1.2 255.255.255.0 no shin e1/0ip add 192.168.2.1 255.255.255.0 no shin loop 1ip add 172.16.0.1 255.255.255.0 in loop 2ip add 172.16.1.1 255.255.255.0 in loop 3ip add 172.16.2.1 255.255.255.0 in loop 4ip add 172.16.3.1 255.255.255.0 router ripversion 2no aunet 192.168.1.0net 192.168.2.0net 172.16.0.0r2:in e1/1ip add 192.168.2.2 255.255.255.0no shin e1/0ip add 192.168.3.1 255.255.255.0no shrouter ripversion 2net 192.168.2.0redistribute ospf 1 metric 2 重分发ospf路由到riprouter ospf 1net 192.168.3.1 0.0.0.0 a 0redistribute rip route-map test subnets 这条命令引用路由映射表test将rip重分发到ospfaccess-list 1 permit 172.16.1.0 0.0.0.255access-list 1 permit 172.16.2.0 0.0.0.255 这3条acl控制匹配哪些路由条目,允许的将会被重分发access-list 1 permit 192.168.1.0 0.0.0.255route-map test permit 10 定义路由映射表名字为test,采取的行为为允许match ip add 1 匹配的acl为access-list 1set metric-type type-1 行为为将分发类型改为1类r3:in e1/1/14427/ip add 192.168.3.2 255.255.255.0no ship ospf 1 a 0看看效果,在r3上我们只重分发了匹配acl1的3条路由条目,而且把分发类型改为了1类,而默认是2类。
培训Bgp 协议基本bgp配置router bgp 300no synchronization //默认配置bgp router-id 5.5.5.5bgp log-neighbor-changesneighbor 3.3.3.3 remote-as 100neighbor 3.3.3.3 update-source Loopback0如果不指明更新的接口,那么路由更新是从直连的接口出去而对端指的是你的环回接口,那么对端路由器要做一个校验,看看路由更新的源接口和用neighbor命令指的接口是否一致,如果不一致,就扔掉数据包no auto-summaryr2#sh ip bgp sur2#sh ip bgp summaryBGP router identifier 2.2.2.2, local AS number 100 BGP table version is 1, main routing table version 1Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd3.3.3.3 4 100 15 16 1 0 0 00:12:44 04.4.4.4 4 200 0 0 0 0 0 never Idle路由解决了,但是有一个问题,ebgp的多跳问题r2(config)#router bgp 100r2(config-router)#neighbor 4.4.4.4 ebgr2(config-router)#neighbor 4.4.4.4 ebgp-multihop 2r4(config)#router bgp 200r4(config-router)#neighbor 2.2.2.2 ebgpr4(config-router)#neighbor 2.2.2.2 ebgp-multihop 2不用环回口,就不存在整个问题结果Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd3.3.3.3 4 100 19 21 3 0 0 00:16:28 04.4.4.4 4 200 5 4 3 0 0 00:00:09 1r2#sh ip bgpBGP table version is 3, local router ID is 2.2.2.2Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Pathr> 4.4.4.0/24 4.4.4.4 0 0 200 i这个r3学来了没有?r3#sh ip bgpBGP table version is 1, local router ID is 3.3.3.3Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Path* i4.4.4.0/24 4.4.4.4 0 100 0 200 iR5 ?r5#sh ip bgp空一个路由要向其他的as发送,要满足两个条件1.igp有这条路由(可以用关闭同步解决,现在默认都是no synchronization )2.下一条应该可达可以用 next-hop-self或者加路由如果这两个条件满足,路由条目前面会出现一个>号(路由最优)r2(config-router)#neighbor 3.3.3.3 next-hop-selfr3#clear ip bgp * softr3#sh ip bgpBGP table version is 2, local router ID is 3.3.3.3Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Path*>i4.4.4.0/24 2.2.2.2 0 100 0 200 ir5#sh ip bgpBGP table version is 2, local router ID is 5.5.5.5Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Path*> 4.4.4.0/24 3.3.3.3 0 100 200 iPing 测试结果?r5#ping 4.4.4.4Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds:.....Success rate is 0 percent (0/5)Ping测试1)数据包能否倒台目的地R1 没有运行bgp,所以说出现了路由黑洞问题解决方法把4.4.4.0 发到ospf里面去,或者做静态路由(不可取)1.直接把bgp发到ospf里面去,但是一定要做过滤2.做一条这个路由的静态路由,指向空接口,然后把整个静态路发进去3.2)数据包能否返回r2#sh ip bgpBGP table version is 3, local router ID is 2.2.2.2Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Pathr> 4.4.4.0/24 4.4.4.4 0 0 200 ir就代表有更好的igp路由因为4.4.4.0 有一条静态路由,所以不重发bgp了,直接就发静态路由算了router ospf 1log-adjacency-changesredistribute static subnetsredistribute bgp 100 subnets route-map to-igpnetwork 2.2.2.2 0.0.0.0 area 0network 12.1.1.2 0.0.0.0 area 0!router bgp 100no synchronizationbgp router-id 2.2.2.2bgp log-neighbor-changesneighbor 3.3.3.3 remote-as 100neighbor 3.3.3.3 update-source Loopback0neighbor 3.3.3.3 next-hop-selfneighbor 4.4.4.4 remote-as 200neighbor 4.4.4.4 ebgp-multihop 2neighbor 4.4.4.4 update-source Loopback0no auto-summaryip route 4.4.4.0 255.255.255.0 24.1.1.4!!!access-list 10 permit 4.4.4.0!route-map to-igp permit 10match ip address 10r1O E2 4.4.4.0 [110/20] via 12.1.1.2, 00:00:39, Serial1/0还需要做r3(config-router)#redistribute connected subnetsr4(config)#ip route 35.0.0.0 255.0.0.0 24.1.1.2再测试一下r5#ping 4.4.4.4Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 124/135/156 ms1.更新接口问题2.ebgp的多跳问题3.bgp的条目要正常的通告要满足两个条件igp路由可达下一跳可达4.路由黑洞同步/路由黑洞路由反射器R1 运行bgprouter bgp 100no synchronizationbgp router-id 1.1.1.1bgp log-neighbor-changesneighbor 2.2.2.2 remote-as 100neighbor 3.3.3.3 remote-as 100r2router bgp 100no synchronizationbgp router-id 2.2.2.2bgp log-neighbor-changesneighbor 1.1.1.1 remote-as 100neighbor 1.1.1.1 update-source Loopback0neighbor 4.4.4.4 remote-as 200neighbor 4.4.4.4 ebgp-multihop 2neighbor 4.4.4.4 update-source Loopback0r3router bgp 100no synchronizationbgp router-id 3.3.3.3bgp log-neighbor-changesneighbor 1.1.1.1 remote-as 100neighbor 1.1.1.1 update-source Loopback0neighbor 5.5.5.5 remote-as 300neighbor 5.5.5.5 ebgp-multihop 2neighbor 5.5.5.5 update-source Loopback0no auto-summary问题?R3 或者说R5还能学到4.4..4.4 这个路由吗?r2#sh ip bgpBGP table version is 3, local router ID is 2.2.2.2Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Path r> 4.4.4.0/24 4.4.4.4 0 0 200 ir1#sh ip bgpBGP table version is 3, local router ID is 1.1.1.1Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Path r>i4.4.4.0/24 4.4.4.4 0 100 0 200 ir3#sh ip bgpr3#r3为什么没有路由?Ibgp 路由只能传递一跳一个ibgp路由器不会把从一个ibgp对等体学来的路由再传给其他的对等体叫做ibgp的水平分割注意:防止路由环路(bgp防止环路的机制是靠AS,但是在一个as里面,as就失去了意义)解决方法:1.全互联2.路由反射器3.联盟路由反射器把r1配置成路由反射器从路由反射器的客户端来的路由可以反给客户端和非客户端从路由反射器的非客户端来的路由可以反给客户端router bgp 100no synchronizationbgp router-id 1.1.1.1bgp log-neighbor-changesneighbor 2.2.2.2 remote-as 100neighbor 2.2.2.2 route-reflector-clientneighbor 3.3.3.3 remote-as 100再到R3看一看r3#sh ip bgpBGP table version is 7, local router ID is 3.3.3.3Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Pathr>i4.4.4.0/24 4.4.4.4 0 100 0 200 i下一跳Ebgp的下一跳进入as的时候保留Ibgp的下一跳出as的时候改变联盟把一个大的as分成许多小的as对外是大的as,小的as只是在区域内有作用R1router bgp 65001no synchronizationbgp router-id 1.1.1.1bgp log-neighbor-changesbgp confederation identifier 100bgp confederation peers 65002neighbor 2.2.2.2 remote-as 65001 neighbor 3.3.3.3 remote-as 65002 neighbor 3.3.3.3 ebgp-multihop 2 neighbor 3.3.3.3 update-source Loopback0R2router bgp 65001no synchronizationbgp router-id 2.2.2.2bgp log-neighbor-changesbgp confederation identifier 100 neighbor 1.1.1.1 remote-as 65001 neighbor 1.1.1.1 update-source Loopback0 neighbor 4.4.4.4 remote-as 200 neighbor 4.4.4.4 ebgp-multihop 2 neighbor 4.4.4.4 update-source Loopback0 no auto-summaryrouter bgp 65002no synchronizationbgp router-id 3.3.3.3bgp log-neighbor-changesbgp confederation identifier 100bgp confederation peers 65001neighbor 1.1.1.1 remote-as 65001 neighbor 1.1.1.1 ebgp-multihop 2 neighbor 1.1.1.1 update-source Loopback0 neighbor 5.5.5.5 remote-as 300 neighbor 5.5.5.5 ebgp-multihop 2 neighbor 5.5.5.5 update-source Loopback0r4router bgp 200no synchronizationbgp router-id 4.4.4.4bgp log-neighbor-changesnetwork 4.4.4.0 mask 255.255.255.0 neighbor 2.2.2.2 remote-as 100 neighbor 2.2.2.2 ebgp-multihop 2 neighbor 2.2.2.2 update-source Loopback0 no auto-summaryr5no synchronizationbgp router-id 5.5.5.5bgp log-neighbor-changesneighbor 3.3.3.3 remote-as 100neighbor 3.3.3.3 ebgp-multihop 2neighbor 3.3.3.3 update-source Loopback0no auto-summary注意:下一跳这个属性不理会联盟的asr3#sh ip bgpBGP table version is 3, local router ID is 3.3.3.3Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Pathr> 4.4.4.0/24 4.4.4.4 0 100 0 (65001) 200 i 对等体组R1router bgp 100no synchronizationbgp router-id 1.1.1.1bgp log-neighbor-changesneighbor aaa peer-group //创建一个对等体组neighbor aaa remote-as 100neighbor aaa update-source Loopback0neighbor aaa route-reflector-clientneighbor 2.2.2.2 peer-group aaaneighbor 3.3.3.3 peer-group aaar2router bgp 100no synchronizationbgp router-id 2.2.2.2bgp log-neighbor-changesneighbor 1.1.1.1 remote-as 100neighbor 1.1.1.1 update-source Loopback0r3no synchronizationbgp router-id 3.3.3.3bgp log-neighbor-changesneighbor 1.1.1.1 remote-as 100neighbor 1.1.1.1 update-source Loopback0no auto-summary联盟社团属性知名的社团属性一种有特殊意义的标记Community一种是知名社团,大家一看到这种标记,就知道他的特殊意义Local-as不传给本as之外的对等体(对联盟中的对等体有作用)route-map com permit 10set community local-ASr2# clear ip bgp * sr2#sh ip bgp commr2#sh ip bgp community lor2#sh ip bgp community local-ASBGP table version is 6, local router ID is 2.2.2.2Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Path r> 4.4.4.0/24 4.4.4.4 0 0 200 iNo-Export不传给本as之外的对等体(不会理会联盟的as)R2router bgp 100no synchronizationbgp router-id 2.2.2.2bgp log-neighbor-changesneighbor 1.1.1.1 remote-as 100neighbor 1.1.1.1 update-source Loopback0neighbor 1.1.1.1 send-communityneighbor 4.4.4.4 remote-as 200neighbor 4.4.4.4 ebgp-multihop 2neighbor 4.4.4.4 update-source Loopback0neighbor 4.4.4.4 route-map com inroute-map com permit 10set community no-exportr1r1(config-router)#neighbor aaa send-communityr1#sh ip bgp communityBGP table version is 4, local router ID is 1.1.1.1Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Path r>i4.4.4.0/24 4.4.4.4 0 100 0 200 iNo-advertisement不传给任何对等体route-map com permit 10set community no-advertiser2#sh ip bgp community no-adr2#sh ip bgp community no-advertiseBGP table version is 5, local router ID is 2.2.2.2Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Path r> 4.4.4.0/24 4.4.4.4 0 0 200 i社团列表自己定义社团有些时候需要没有特殊意义,只是标记而已配置r2(config-route-map)#set community 100:88显示route-map com permit 10set community 6553688r2(config)#ip bgp-community new-format然后route-map com permit 10set community 100:88r1#sh ip bgp community 6553688BGP table version is 8, local router ID is 1.1.1.1Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Path r>i4.4.4.0/24 4.4.4.4 0 100 0 200 i在r3对community 进行控制r3#sh ip bgp 4.4.4.0BGP routing table entry for 4.4.4.0/24, version 8Paths: (1 available, best #1, table Default-IP-Routing-Table, RIB-failure(17)) Advertised to update-groups:22004.4.4.4 (metric 20) from 1.1.1.1 (1.1.1.1)Origin IGP, metric 0, localpref 100, valid, internal, bestCommunity: 6553688Originator: 2.2.2.2, Cluster list: 1.1.1.1r3(config)#ip bgp-community new-formatr3#sh ip bgp 4.4.4.0BGP routing table entry for 4.4.4.0/24, version 8Paths: (1 available, best #1, table Default-IP-Routing-Table, RIB-failure(17)) Advertised to update-groups:22004.4.4.4 (metric 20) from 1.1.1.1 (1.1.1.1)Origin IGP, metric 0, localpref 100, valid, internal, bestCommunity: 100:88Originator: 2.2.2.2, Cluster list: 1.1.1.1router bgp 100no synchronizationbgp router-id 3.3.3.3bgp log-neighbor-changesneighbor 1.1.1.1 remote-as 100neighbor 1.1.1.1 update-source Loopback0neighbor 1.1.1.1 route-map addas inneighbor 5.5.5.5 remote-as 300neighbor 5.5.5.5 ebgp-multihop 2neighbor 5.5.5.5 update-source Loopback0neighbor 5.5.5.5 route-map asadd outip bgp-community new-formatip community-list 20 permit 100:88!route-map addas permit 10match community 20set local-preference 666set as-path prepend 88 //进来的时候不起作用!route-map asadd permit 10match community 20set as-path prepend 8888路由过滤Prefix-listrouter bgp 100no synchronizationbgp router-id 2.2.2.2bgp log-neighbor-changesneighbor 1.1.1.1 update-source Loopback0neighbor 1.1.1.1 send-communityneighbor 4.4.4.4 remote-as 200neighbor 4.4.4.4 ebgp-multihop 2neighbor 4.4.4.4 update-source Loopback0neighbor 4.4.4.4 prefix-list to-r2 inneighbor 4.4.4.4 route-map com inip prefix-list to-r2 seq 5 permit 4.4.4.0/24Route-map(as-path的修改)route-map to-r2 permit 10match ip address prefix-list to-r2set tag 1111set local-preference 8888set weight 7777set as-path prepend 6666neighbor 4.4.4.4 route-map to-r2 inr2#sh ip bgpBGP table version is 10, local router ID is 2.2.2.2Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Pathr> 4.4.4.0/24 4.4.4.4 0 8888 7777 6666 200 i Distribute-list他还要调用访问控制列表,或者前缀列表Filter-list对as进行一个过滤和控制R2ip as-path access-list 100 permit ^200$正则表达式改天再讲路径控制router bgp 100no synchronizationbgp router-id 1.1.1.1bgp log-neighbor-changesneighbor aaa peer-groupneighbor aaa remote-as 100 neighbor aaa update-source Loopback0 neighbor aaa route-reflector-client neighbor aaa send-community neighbor 2.2.2.2 peer-group aaar2router bgp 100no synchronizationbgp router-id 2.2.2.2bgp log-neighbor-changesnetwork 2.2.2.0 mask 255.255.255.0 neighbor 1.1.1.1 remote-as 100 neighbor 1.1.1.1 update-source Loopback0 neighbor 1.1.1.1 send-community neighbor 4.4.4.4 remote-as 200 neighbor 4.4.4.4 ebgp-multihop 2 neighbor 4.4.4.4 update-source Loopback0 neighbor 4.4.4.4 route-map to-r4 out neighbor 4.4.4.4 filter-list 100 inip prefix-list to-r2 seq 5 permit 4.4.4.0/24 access-list 10 permit 4.4.4.0access-list 30 permit 3.3.3.0!route-map to-igp permit 10match ip address 10!route-map com permit 10set community 100:88!route-map to-r4 permit 10match ip address 30set metric 300!route-map to-r4 permit 20r3router bgp 100no synchronizationbgp router-id 3.3.3.3bgp log-neighbor-changesnetwork 3.3.3.0 mask 255.255.255.0 neighbor 1.1.1.1 remote-as 100 neighbor 1.1.1.1 update-source Loopback0 neighbor 5.5.5.5 remote-as 200 neighbor 5.5.5.5 ebgp-multihop 2neighbor 5.5.5.5 update-source Loopback0 neighbor 5.5.5.5 route-map to-r5 outno auto-summaryaccess-list 20 permit 2.2.2.0!route-map to-r5 permit 10match ip address 20set metric 200!route-map to-r5 permit 20r4router bgp 200no synchronizationbgp router-id 4.4.4.4bgp log-neighbor-changesneighbor 2.2.2.2 remote-as 100 neighbor 2.2.2.2 ebgp-multihop 2 neighbor 2.2.2.2 update-source Loopback0 neighbor 2.2.2.2 route-map from-r2 in neighbor 2.2.2.2 route-map to-r2 out neighbor 8.8.8.8 remote-as 200 neighbor 8.8.8.8 update-source Loopback0access-list 30 permit 3.3.3.0access-list 40 permit 4.4.4.0!route-map to-r2 permit 10match ip address 40set as-path prepend 888!route-map to-r2 permit 20!route-map from-r2 permit 10match ip address 30set local-preference 666!route-map from-r2 permit 20router bgp 200no synchronizationbgp router-id 5.5.5.5bgp log-neighbor-changesneighbor 3.3.3.3 remote-as 100 neighbor 3.3.3.3 ebgp-multihop 2 neighbor 3.3.3.3 update-source Loopback0 neighbor 3.3.3.3 route-map from-r3 in neighbor 8.8.8.8 remote-as 200 neighbor 8.8.8.8 update-source Loopback0 no auto-summaryaccess-list 20 permit 2.2.2.0!route-map from-r3 permit 10match ip address 20set local-preference 666!route-map from-r3 permit 20r6router ospf 1log-adjacency-changesnetwork 0.0.0.0 255.255.255.255 area 0 router ospf 1log-adjacency-changesnetwork 0.0.0.0 255.255.255.255 area 0r7router bgp 200no synchronizationbgp router-id 8.8.8.8bgp log-neighbor-changesneighbor 4.4.4.4 remote-as 200 neighbor 4.4.4.4 update-source Loopback0 neighbor 4.4.4.4 route-reflector-client neighbor 4.4.4.4 route-map wei in neighbor 5.5.5.5 remote-as 200 neighbor 5.5.5.5 update-source Loopback0 neighbor 5.5.5.5 route-reflector-client neighbor 5.5.5.5 route-map wei2 inno auto-summaryaccess-list 20 permit 2.2.2.0access-list 30 permit 3.3.3.0!route-map wei2 permit 10match ip address 30set weight 1000!route-map wei2 permit 20!route-map wei permit 10match ip address 20set weight 1000!route-map wei permit 20 Weight思科私有的优先级是第一位的只能在一个路由器上比较不能传播到其他的路由器上去Med类似于我们说的metric值Multi-exit-descriptorlocal–prefence 可以传播其他as欺骗路由聚合Bgp进程下做的汇总就是igp里面做的WeightLocal-preferenceAs-pathMedRouter-id路由抑制Bgp bestpath as-path ignoreBgp负载均衡Bgp默认路由router bgp 20YYnetwork 0.0.0.0 mask 0.0.0.0ip route 0.0.0.0 0.0.0.0 null0bgp可选路由发布outer bgp 20YYnetwork 0.0.0.0 mask 0.0.0.0nei external advertise-map ADVER exist-map EXIST ip route 0.0.0.0 0.0.0.0 null0R3:access 10 per 0.0.0.0 0.0.0.0route-map DEFAULT deny 10match ip addr 10route-map DEFAULT per 20router bgp 20YYnei internal route-map DEFAULT in。
路由策略1路由策略1.1匹配路由工具1.1.1ACL(access-list)标准列表:匹配目标网络号,通配符用于精确匹配该网络号例:access-list 1 deny 1.1.1.0 0.0.0.0acl只能匹配网络号,不能匹配掩码长度扩展列表: 源地址匹配网络号,目标地址匹配掩码只限于bgp和重分布使用,同一协议无效例:access-list 100 permit ip host 192.168.1.0 host 255.255.255.0图1-1 ACL匹配路由实验拓扑图1-2 R1路由表R1(config)#access-list 1 deny 192.168.1.0 0.0.0.127R1(config)#access-list 1 permit anyR1(config)#router eigrp 100R1(config-router)#distribute-list 1 in f0/0图1-3 R1路由表说明acl只能匹配网络号,将192.168.1.0/24和192.168.1.0/25的路由都过滤掉了。
1.1.2前缀列表前缀列表只用于匹配路由条目,精确定义网络号,前缀长度。
相关参数:前缀长度:精确匹配网络号ge:大于等于le:小于等于说明:前缀长度<ge<=le例:ip prefix-list 1 permit 192.168.1.0/24 ge 25 le 32表示网络号前24位固定为192.168.1.0,掩码长度为25到32的路由被匹配。
前缀列表举例说明:ip prefix-list 1 permit 192.168.1.0/24表示网络号前24位固定为192.168.1.0,掩码为24位的路由被匹配。
ip prefix-list 1 permit 0.0.0.0/0表示匹配默认路由,网络号为0.0.0.0,掩码为0.0.0.0ip prefix-list 1 permit 0.0.0.0/0 le 32表示匹配任意路由,等于acl中permit any利用前缀列表解决上述实验问题:R1(config)#ip prefix-list 1 deny 192.168.1.0/24 ge 25 le 25R1(config)#ip prefix-list 1 permit 0.0.0.0/0 le 32R1(config)#router eigrp 100R1(config-router)#distribute-list prefix 1 in f0/0图1-4 R1路由表1.2过滤路由工具1.2.1分发列表通过acl或prefix-list定义流量进行路由的过滤1.2.2路由映射(route-map)用于重分发,策略路由,BGP属性。
重分布一个主要的作用就是要两种不同的路由协议之间互相的学习到路由
因为一种路由协议到另一种路由协议计算Metric的方法不同当把一种路由协议重分布到另一种路由协议的时候需要给他一个基础的Metric值这就叫Seed Metric
将协议重分布到默认Seed Metric
RIP 无限大
IGRP/EIGRP 无限大
OSPF 20(BGP为1)
ISIS 0
BGP 就是IGP的Metric
在R1上将OSPF重分布到RIP中不加任何参数然后在R2上看看效果
没有任何重分布的路由条目因为SEED是无限大所以我们在将任何协议重分布到RIP中的时候一定要加Metric
也可以在进程下使用defult-Metirc来进行更改
重分布主要的三种形式:
A协议重分布到B协议
静态重分布到B协议中
直连重分布到B协议中
假如R1有一条默认路由指向互联网我们在R1上写一条默认路由然后在RIP进程中重分布静态会发现在R2上此默认路由的Metric值为1 所以在RIP中重分布静态不用加Metric值
如果在R1上我希望将所有的接口全部引入到RIP中(config-router)#redistribute connected 同样也不需要加任何参数
接下来将RIP重分布进OSPF中
如果将任何协议重分布进
OSPF中不加任何参数默认OSPF只会引入主类网络所以必须要加subnets参数
LS协议不能通过重分布默认路由来向区域中注入默认路由redistribute static subnets只能重分布静态默认路由不行
我们现在做的是一个典型的单点双向重分布是否会有环路?
将任何协议重分布到EIGRP中也需要SEED值顺序为带宽延迟可靠性负载MTU
在一台路由器中将A协议重分布到B协议中会将此路由器上所有运行A协议的接口(除了ISIS/ODR)以及所有学习到A协议的路由重分布到B协议中
分发列表:工作在控制层面
现在我们在R1上要过滤R4-R2的14网段路由
首先定义ACL去抓路由:(config)#access-list 10permit 4.4.4.4
(config)#router eigrp 100
分发列表去调用(config-router)#distribute-list 10 (ACL编号)out serial 0在R1的S0口出方向调用此列表
因为R1做重分发R1将R4的路由告诉R2 在R1的出方向此路由的意思只允许4.4.4.4路由进入R2
分发列表in后面只能跟接口out后面能跟接口和协议
对于上面的要求我们也可以在R1上这样写:
(config-router)#distribute-list 100 (ACL编号)out OSPF 110 也就是说当把R4的OSPF重分布到R2的EIGRP的时候去调用这个分发列表
ACL的缺点就是只能控制网络号不能控制掩码当需要将很多连续的子网过滤一部分只靠ACL 是不行的
前缀列表(prefix-list):严格过滤路由
(config)#ip prefix-list 1名称随便定义permit 2.2.2.0/24 这样就达到了严格控制路由的目的
以此为例ip prefix-list 1permit 2.2.2.0/24le 32此前缀列表的意思就是网络号是2.2.2.0掩码是24-32位之间的
ip prefix-list 1permit 2.2.2.0/24ge 26此前缀列表的意思就是网络号是2.2.2.0掩码是26-32
ip prefix-list 1permit 2.2.2.0/24ge 26le 30此前缀列表的意思就是网络号是2.2.2.0掩码是26-30 ip prefix-list 1permit 0.0.0.0/0 le 32 =permit any
如果现在只允许R2学到14网段的路由使用前缀列表去抓精确路由然后分发列表去调用(config)#ip prefix-list 1 permit 14.1.1.0/24使用前缀列表定义精确路由
(config)#router eigrp 90进入进程
(config-router)#distribute-list prefix 1 out serial 0分发列表去调用前缀列表应用在R1 S0口的出方向不加此参数应用的是普通ACL的1
由此可以得出ACL和prefix-list是同一级别的
Router Maps:自上而下的顺序原理类似于编程满足什么条件执行什么动作满足条件match 执行动作set
如果出现这样的match ip address x y z (xyz指的是普通的ACL)这样的情况指的是或也就是说我满足X或Y或Z 就执行set什么··
如果是match Xmatch X match Y指的是或
Match Y 指的是与
在R3上现在有两个环回口3.3.3.3 和8.8.8.8 还有直连的13网段我们现在使用router maps 来将3.3.3.0改为E1 将8.8.8.0的seed cost改为10 13网段直接deny掉
这些我们肯定是在R1做R1在执行过重分布之后将router maps调用在重分布之后
抓路由:(config)#access-list 3 permit 3.3.3.0
(config)#ip prefix-list 8 permit 8.8.8.0/24
Router maps中调用:(config)#route-map zhangchi名称随便定义permit 10也可直接回车隐性相当于此命令代表第一条语句
(config-route-map)#match ip address 3ACL序号
(config-route-map)#set metric-type type-1
(config)#route-map zhangchi permit 20
(config-route-map)#match ip address prefix-list 8
(config-route-map)#set metric 10
还应考虑是否要(config)#route-map zhangchi permit 30
放过其他流量后面什么都不写默认就是match any set nothing
最后将router maps 应用于重分布之后:
(config)#router ospf 110
(config-router)#redistribute rip subnets route-map zhangchi
在双点双向重分布中如果采用默认设置AD大的一方会出问题轻则造成最优路径的选择问题重则造成环路
因为EIGRP重分布的路由AD为170 解决了双点双向重分布的问题所以在跟EIGRP进行双点双向重分布的时候不用考虑此问题
对于双点双向重分布我们需要更改AD来解决此问题:
进程下(config-route)#distance 121需要更改的AD1.1.1.1路由来源R的RID 0.0.0.0
总结:只需要在两台边界路由器上将管理距离小的路由协议的AD改成比另一个路由协议的AD大就行了如不明白思考同样的路由不同路由协议根据AD来判断(控制层面)。