集团站切换校区

验证码已发送,请查收短信

图标

学习文章

当前位置:首页 > >学习文章 > >

{思科CCNP-RS}BGP 路径选择

发布时间: 2017-06-16 13:03:02


Setp1: 配置AS345的IGP(OSPF1)

Setp2: 构建冗余的IBGP session

Setp3: 构建EBGP session

Setp4: 通告路由在R1上1.1.1.0

Setp5: 在R4上观察路由,发现优化的是R5传来的

               Network       Next Hop     Metric LocPrf Weight   Path

*>i1.1.1.0/24       5.5.5.5                  0    100      0 100 i

* i                 3.3.3.3                  0    100      0 200 100 i

因为as-path属性最短。

Setp6: 通过命令让R1传递给R5时候增加一个AS号码10

ip prefix-list 1 per 1.1.1.0/24

route-map AS-PATH per 10

match ip add prefix-list 1

set as-path prepend 10

route-map AS-PATH per 20

router bgp 100

nei 15.0.0.5 route-map AS-PATH out

此时观察路由R4的优化从R3学到的,因为R3的router-id比R5小。

Setp7:  通过修改MED在R1---R5  50  R2---R3  100 ,来实现选路,在R4上并不起作用,因为MED是来自不同的AS,bgp always-compare-med 

R4(config)#router bgp 345

R4(config-router)#bgp always-compare-med 

Setp8: 起源选路,将R5收到的路由起源改为“?”,那么R4应该优化起源好的“I”路由。

Setp9: 通过在R3上将LP改为50,大于R5默认传来的值,所以R4优化了从R5学到的路由。

Setp10: 通过weigth值来控制本路由选路,越大越好,通过R3学到的路由将weigth设置为100,大于R5默认的0,所以路由优化R3方向的路由,weigth值本路由有效,不能传递。

R4(config-router)#router bgp 345

R4(config-router)#nei 3.3.3.3 weight 50

 

R1(config)#int s2/1

R1(config-if)#ip add 12.0.0.1 255.255.255.0

R1(config-if)#no shu

R1(config-if)#int f0/0

R1(config-if)#ip add 15.0.0.1 255.255.255.0

R1(config-if)#no shu

R1(config-if)#do ping 12.0.0.2

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 12.0.0.2, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 40/76/172 ms

R1(config-if)#do ping 15.0.0.5

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 15.0.0.5, timeout is 2 seconds:

.!!!!

Success rate is 80 percent (4/5), round-trip min/avg/max = 36/69/148 ms

R1(config-if)#router bgp 100

R1(config-router)#bgp router-id 1.1.1.1

R1(config-router)#no au

R1(config-router)#no syn

R1(config-router)#nei 12.0.0.2 remote-as 200

R1(config-router)#nei 15.0.0.5 remote-as 345

R1(config-router)#

*Sep 18 16:23:35.499: %BGP-5-ADJCHANGE: neighbor 12.0.0.2 Up 

R1(config-router)#net 1.1.1.0 mask 255.255.255.0

R1(config-router)#exit

R1(config)#int lo0

R1(config-if)#ip add 1.1.1.1 255.255.255.0

*Sep 18 16:24:26.819: %BGP-5-ADJCHANGE: neighbor 15.0.0.5 Up 

Setp6:

R1(config)#ip prefix-list 1 per 1.1.1.0/24

R1(config)#route-map AS_PATH per 10

R1(config-route-map)#match ip add prefix-list 1

R1(config-route-map)#set as-path prepend 10

R1(config-route-map)#exit

R1(config)#route-map AS_PATH per 20

R1(config-route-map)#exit

R1(config)#router bgp 100

R1(config-router)#nei 15.0.0.5 route-map AS_PATH out

R1(config-router)#do clear ip bgp * s o

R1(config-router)#exit

Setp7:(R2上也做Setp7:)

R1(config)#route-map AS_PATH per 10

R1(config-route-map)#set metric 50

R1(config-route-map)#do clear ip bgp * s o   

R1(config-route-map)#do clear ip bgp * s o

R1(config-route-map)#

 

 

 

R2(config)#int s2/1

R2(config-if)#ip add 12.0.0.2 255.255.255.0

R2(config-if)#no shu

R2(config-if)#int s2/2

R2(config-if)#ip add 23.0.0.2 255.255.255.0

R2(config-if)#no shu

R2(config-if)#do ping 23.0.0.3

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 23.0.0.3, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 4/58/172 ms

R2(config-if)#router bgp 200

R2(config-router)#bgp router-id 2.2.2.2

R2(config-router)#no au

R2(config-router)#no syn

R2(config-router)#nei 23.0.0.3 remote-as 345

R2(config-router)#nei 12.0.0.1 remote-as 100

R2(config-router)#

*Sep 18 16:23:24.671: %BGP-5-ADJCHANGE: neighbor 23.0.0.3 Up 

R2(config-router)#

*Sep 18 16:23:39.431: %BGP-5-ADJCHANGE: neighbor 12.0.0.1 Up 

Setp7

R2(config)#ip prefix-list 1 per 1.1.1.0/24

R2(config)#route-map MED per 10

R2(config-route-map)#match ip add prefix-list 1

R2(config-route-map)#set metric 100

R2(config-route-map)#exit

R2(config)#route-map MED per 20

R2(config-route-map)#exit

R2(config)#router bgp 200

R2(config-router)#nei 23.0.0.3 route-map MED out

R2(config-router)#do clear ip bgp * s 0

R2(config-router)#do clear ip bgp * s o

R2(config-router)#do clear ip bgp * s o

R2(config-router)#

 

 

R3(config)#int s2/1

R3(config-if)#ip add 23.0.0.3 255.255.255.0

R3(config-if)#no shu

R3(config-if)#int s2/2

R3(config-if)#ip add 34.0.0.3 255.255.255.0

R3(config-if)#no shu

R3(config-if)#do ping 34.0.0.4

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 34.0.0.4, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 24/54/92 ms

R3(config-if)#router ospf 1

R3(config-router)#router-id 3.3.3.3

R3(config-router)#net 34.0.0.0 0.0.0.255 a 0

R3(config-router)#net 3.3.3.0 0.0.0.255 a 0

R3(config-router)#exit

R3(config)#int lo0

R3(config-if)#ip add 3.3.3.3 255.255.255.0

R3(config-if)#

*Sep 18 16:15:18.387: %OSPF-5-ADJCHG: Process 1, Nbr 4.4.4.4 on Serial2/2 from LOADING to FULL, Loading Done

R3(config-if)#router bgp 345 

R3(config-router)#bgp router-id 3.3.3.3

R3(config-router)#no au

R3(config-router)#no syn

R3(config-router)#nei 4.4.4.4 remote-as 345

R3(config-router)#nei 4.4.4.4 up lo0

R3(config-router)#

*Sep 18 16:18:31.675: %BGP-5-ADJCHANGE: neighbor 4.4.4.4 Up 

R3(config-router)#nei 23.0.0.2 remote-as 200

R3(config-router)#

*Sep 18 16:23:24.303: %BGP-5-ADJCHANGE: neighbor 23.0.0.2 Up 

R3(config-router)#nei 4.4.4.4 next-hop-self 

R3(config-router)#exit

Setp9

R3(config)#ip prefix-list 1 per 1.1.1.0/24

R3(config)#route-map LP per 10

R3(config-route-map)#match ip add prefix-list 1

R3(config-route-map)#set local

R3(config-route-map)#set local-preference 50

R3(config-route-map)#exit

R3(config)#route-map LP per 20

R3(config-route-map)#exit

R3(config)#router bgp 345

R3(config-router)#nei 23.0.0.2 route-map LP in

R3(config-router)#nei 23.0.0.2 soft-reconfiguration inbound 

R3(config-router)#do clear ip bgp * s in

R3(config-router)#

*Sep 18 17:09:38.031: %BGP-5-ADJCHANGE: neighbor 4.4.4.4 Down Peer closed the session

R3(config-router)#

*Sep 18 17:10:04.735: %BGP-5-ADJCHANGE: neighbor 4.4.4.4 Up 

R3(config-router)#

 

 

R4(config)#int s2/1

R4(config-if)#ip add 34.0.0.4 255.255.255.0

R4(config-if)#no shu

R4(config-if)#int s2/2

R4(config-if)#ip add 45.0.0.4 255.255.255.0

R4(config-if)#no shu

R4(config-if)#do ping 45.0.0.5

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 45.0.0.5, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 12/68/164 ms

R4(config-if)#int lo0

R4(config-if)#ip add 4.4.4.4 255.255.255.0

R4(config-if)#router ospf 1

R4(config-router)#router-id 4.4.4.4

R4(config-router)#net 34.0.0.0 0.0.0.255 a 0

*Sep 18 16:15:16.887: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on Serial2/1 from LOADING to FULL, Loading Done

R4(config-router)#net 45.0.0.0 0.0.0.255 a 0 

R4(config-router)#net 4.4.4.0 0.0.0.255 a 0

R4(config-router)#

*Sep 18 16:16:04.755: %OSPF-5-ADJCHG: Process 1, Nbr 5.5.5.5 on Serial2/2 from LOADING to FULL, Loading Done

R4(config-router)#router bgp 345

R4(config-router)#bgp router-id 4.4.4.4

R4(config-router)#no syn

R4(config-router)#no au

上一篇: {思科CCNA-RS}路由器密码的恢复

下一篇: {思科CCNA-SEC}IOS-ASA IKEv2 crypto map

十年老品牌
QQ咨询:450959328 微信咨询:togogozhong 咨询电话:020-38289118 咨询网站客服:在线客服

相关课程推荐

在线咨询 ×

您好,请问有什么可以帮您?我们将竭诚提供最优质服务!