频道栏目
首页 > 网络 > 其他 > 正文

BGP路由选择相关实验-没文化-51CTO博客

2019-07-13 17:36:13           
收藏   我要投稿

BGP有丰富的路由属性。我们通常控制BGP路由属性,来控制BGP路由流向。cisco路由器常见路由属性如下:

1.优先选择最大weight(权重)的路由 (范围:0~65535)2.优先选择有最大LOCAL_OREF(本地优先级)的路由 (范围:0~4294967295)3.优先选择从本地路由器始发的路由 (即下一跳0.0.0.0)4.优先选择AS-path数量最少的路由5.根据origin属性,优先选择具有最低起源类型的路由 (IGP优先于EGP优先于incomplete)6.优先选择具有最小MED值的路由 (范围:0~4294967295)7.EBGP优先于IBGP8.优先选择能够通过最近的IGP邻居到达的路径 (即对BGP下一跳具有最低IGP度量值的路径)9.如果配置了maximum-path N(2≤N≤6),可实现负载均衡 (但BGP会继续比较,只有一条路径被打上“>”标签)10.如果都是external(外部的)路由,优先选择最老(即最早学到)的路由11.优先选择拥有最小BGP-router-ID的路由12.如果是从路由反射器(RR)学习到的路由,优先选择拥有最小cluster-ID(路由反射器的router-ID)的路由13.优先选择具有最低对等体地址接收到的路由(即邻居IP地址最小的优先)

实验拓扑图BGP路由选炸kyPHP4LnYyrXR6Q==" />

配置前R1上的路由R1#sh ip routeCodes: C - connected, S - static, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2ia - IS-IS inter area, * - candidate default, U - per-user static routeo - ODR, P - periodic downloaded static route

Gateway of last resort is not set

 172.16.0.0/24 is subnetted, 2 subnets

C 172.16.12.0 is directly connected, FastEthernet0/0C 172.16.13.0 is directly connected, FastEthernet0/110.0.0.0/32 is subnetted, 2 subnetsB 10.10.6.6 [20/0] via 172.16.12.2, 00:27:41C 10.10.1.1 is directly connected, Loopback0

使用weight改变路由

R1(config-router)#neighbor 172.16.13.3 weight 10R1#clear ip bgp * soft

更改weight后路由R1#sh ip routeCodes: C - connected, S - static, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2ia - IS-IS inter area, * - candidate default, U - per-user static routeo - ODR, P - periodic downloaded static route

Gateway of last resort is not set

 172.16.0.0/24 is subnetted, 2 subnets

C 172.16.12.0 is directly connected, FastEthernet0/0C 172.16.13.0 is directly connected, FastEthernet0/110.0.0.0/32 is subnetted, 2 subnetsB 10.10.6.6 [20/0] via 172.16.13.3, 00:01:09C 10.10.1.1 is directly connected, Loopback0

使用local-preference更改路由

更改R1配置:R1(config)#ip prefix-list mei permit 10.10.6.6/32R1(config)#route-map paul permit 10R1(config-route-map)#match ip address prefix-list meiR1(config-route-map)#set local-preference 200R1(config)#route-map paul permit 99R1(config-route-map)#router bgp 100R1(config-router)#neighbor 172.16.13.3 remote-as 2345R1(config-router)#neighbor 172.16.13.3 route-map mei in

R1(config-router)#do clear ip bgp * so1(config-router)#do sh ip bgp 10.10.6.6/32BGP routing table entry for 10.10.6.6/32, version 4Paths: (2 available, best #1, table Default-IP-Routing-Table)Flag: 0x840Advertised to update-groups:12345 600172.16.13.3 from 172.16.13.3 (10.10.3.3)Origin IGP, localpref 200, valid, external, best2345 600

使用AS-path更改路由更改R1配置R1(config-route-map)#do sh run | s route-maproute-map paul permit 10match ip address prefix-list meiset as-path prepend 100 100route-map paul permit 99

R1(config-router)#do sh run | s bgprouter bgp 100no synchronizationbgp router-id 10.10.1.1bgp log-neighbor-changesnetwork 10.10.1.1 mask 255.255.255.255neighbor 172.16.12.2 remote-as 2345neighbor 172.16.12.2 route-map paul inneighbor 172.16.13.3 remote-as 2345no auto-summary

R1(config-router)#do clear ip bgp * soR1(config-router)#do sh ip bgp 10.10.6.6BGP routing table entry for 10.10.6.6/32, version 2Paths: (2 available, best #2, table Default-IP-Routing-Table)Advertised to update-groups:1100 100 2345 600172.16.12.2 from 172.16.12.2 (10.10.2.2)Origin IGP, localpref 100, valid, external2345 600172.16.13.3 from 172.16.13.3 (10.10.3.3)Origin IGP, localpref 100, valid, external, best

使用MED更改路由更改R1配置R1(config-router)#do sh run | s route-mapneighbor 172.16.12.2 route-map paul inroute-map paul permit 10match ip address prefix-list meiset metric 10000route-map paul permit 99R1(config-router)#do sh run | s bgprouter bgp 100no synchronizationbgp router-id 10.10.1.1bgp log-neighbor-changesnetwork 10.10.1.1 mask 255.255.255.255neighbor 172.16.12.2 remote-as 2345neighbor 172.16.12.2 route-map paul inneighbor 172.16.13.3 remote-as 2345no auto-summary

R1(config-router)#do clear ip bgp * softR1(config-router)#do sh ip bgp 10.10.6.6/32BGP routing table entry for 10.10.6.6/32, version 2Paths: (2 available, best #1, table Default-IP-Routing-Table)Flag: 0x820Advertised to update-groups:12345 600172.16.13.3 from 172.16.13.3 (10.10.3.3)Origin IGP, localpref 100, valid, external, best2345 600172.16.12.2 from 172.16.12.2 (10.10.2.2)Origin IGP, metric 10000, localpref 100, valid, externalR1(config-router)#

相关TAG标签
上一篇:Linux习题vi编辑器(自制版)-数据库与大数据的相关研究-51CTO博客
下一篇:Linux指令每日背诵(第三天、玩大数据和云计算的一定要会vi编辑器)-数据库与大数据的相关研究-51CTO博客
相关文章
图文推荐
文章
推荐
热门新闻

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑联盟--致力于做实用的IT技术学习网站