發布時間: 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}路由器密碼的恢復