-
-
-
编辑:xujie 时间:2007-11-27 来源:淘学考试网 推荐好友
|
1. BGP邻居之间使用Loopback地址进行负载共享
该场景展示如何在多条(最大可有6条)等价链路上完成负载共享。该链路建立在本地AS中一台路由器和远程AS中另一台路由器之间是一个单宿主末端网络 BGP环境。
配置如下:
RouterA
RA(config)#int s1/1
RA(config-if)#ip add 150.10.10.1 255.255.255.0
RA(config-if)#no sh
RA(config-if)#int s1/2
RA(config-if)#ip add 160.20.20.1 255.255.255.0
RA(config-if)#no sh
RA(config-if)#int lo0
RA(config-if)#ip add 1.1.1.1 255.255.255.0
RA(config)#router bgp 11
RA(config-router)#nei 2.2.2.2 remote-as 10
RA(config-router)#nei 2.2.2.2 update-source lo0
RA(config-router)#nei 2.2.2.2 ebgp-multihop
RA(config-router)#router eigrp 12
RA(config-router)#net 1.0.0.0
RA(config-router)#net 150.10.0.0
RA(config-router)#net 160.20.0.0
RA(config-router)#no auto-summary
RouterB
RB(config)#int lo0
RB(config-if)#ip add 2.2.2.2 255.255.255.0
RB(config-if)#int s1/1
RB(config-if)#no ip route-cache
RB(config-if)#ip add 160.20.20.2 255.255.255.0
RB(config-if)#no sh
RB(config-if)#int s1/2
RB(config-if)#no ip route-cache
RB(config-if)#ip add 150.10.10.2 255.255.255.0
RB(config-if)#no sh
RB(config-if)#router bgp 10
RB(config-router)#nei 1.1.1.1 remote-as 11
RB(config-router)#nei 1.1.1.1 update-source lo0
RB(config-router)#nei 1.1.1.1 ebgp-multihop
RB(config-router)#router eigrp 12
RB(config-router)#net 2.0.0.0
RB(config-router)#net 150.10.0.0
RB(config-router)#net 160.20.0.0
RB(config-router)#no auto-summary
验证基于数据包(过程交换)的负载均衡:
RA#sh ip ro
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/24 is subnetted, 1 subnets
D 2.2.2.0 [90/2297856] via 150.10.10.2, 00:18:47, Serial1/1
[90/2297856] via 160.20.20.2, 00:18:47, Serial1/2
160.20.0.0/24 is subnetted, 1 subnets
C 160.20.20.0 is directly connected, Serial1/2
150.10.0.0/24 is subnetted, 1 subnets
C 150.10.10.0 is directly connected, Serial1/1
RA#traceroute 2.2.2.2
Type escape sequence to abort.
Tracing the route to 2.2.2.2
1 150.10.10.2 36 msec
160.20.20.2 60 msec *
2. 单台边界路由器多宿主末端网络连接到单一ISP环境中的负载共享
本场景展示了当在远程AS和本地AS之间存在多条链路时如何完成负载共享。链路建立在本地AS中的一个路由器和远程AS中的多个路由器之间。
默认情况下BGP只从可能存在的等价路径中选择出一条最佳的路径,通过命令maximum-path对可选择的等价路径数目(1~6)进行修改。
配置如下:
RouterA
RouterA (config)#int s1/0
RouterA (config-if)#ip add 160.20.20.1 255.255.255.0
RouterA (config-if)#no sh
RouterA (config)#int s1/2
RouterA (config-if)#ip add 150.10.10.1 255.255.255.0
RouterA (config-if)#no sh
RouterA (config-if)#int lo0
RouterA (config-if)#ip add 1.1.1.1 255.255.255.0
RouterA (config-if)#router bgp 11
RouterA (config-router)#network 1.0.0.0
RouterA (config-router)#neighbor 150.10.10.2 remote-as 10
RouterA (config-router)#neighbor 160.20.20.2 remote-as 10
RouterA (config-router)#maximum-paths 2
RouterB
RourterB(config)#int s1/2
RourterB(config-if)#ip add 160.20.20.2 255.255.255.0
RourterB(config-if)#no sh
RourterB(config-if)#int fa0/0
RourterB(config-if)#ip add 2.2.2.1 255.255.255.0
RourterB(config-if)#no sh
RourterB(config)#router bgp 10
RourterB(config-router)#network 2.0.0.0
RourterB(config-router)#neighbor 160.20.20.1 remote-as 11
RourterB(config-router)#auto-summary
RouterC
RourterB(config)#int s1/2
RourterB(config-if)#ip add 150.10.10.2 255.255.255.0
RourterB(config-if)#no sh
RourterB(config-if)#int fa0/0
RourterB(config-if)#ip add 2.2.2.2 255.255.255.0
RourterB(config-if)#no sh
RourterB(config)#router bgp 10
RourterB(config-router)#network 2.0.0.0
RourterB(config-router)#neighbor 150.10.10.1 remote-as 11
RourterB(config-router)#auto-summary
验证:
RouterA# sh ip bgp
BGP table version is 5, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.0.0.0 0.0.0.0 0 32768 i
*> 2.0.0.0 160.20.20.2 0 0 10 i
* 150.10.10.2 0 0 10 i
RouterA#sh ip ro
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
B 2.0.0.0/8 [20/0] via 150.10.10.2, 00:16:32
[20/0] via 160.20.20.2, 00:15:47
160.20.0.0/24 is subnetted, 1 subnets
C 160.20.20.0 is directly connected, Serial1/0
150.10.0.0/24 is subnetted, 1 subnets
C 150.10.10.0 is directly connected, Serial1/2
RouterA#
RouterA#traceroute 2.2.2.2
Type escape sequence to abort.
Tracing the route to 2.2.2.2
1 150.10.10.2 64 msec
160.20.20.2 92 msec *
3. 多台边界路由器多宿主末端网络连接到单一ISP环境中的负载共享
这个场景展示了当通过多个本地路由器到达同一ISP具有多条连接时如何完成负载共享。两个eBGP对等体分别建立在两个独立的本地路由器上。在两条链路上负载均衡是不可能发生的因为BGP会在从eBGP和iBGP学来的路由中挑选出一条最佳的路由。在去往AS10的多条路径上进行负载共享是很好的选择,这种负载共享可以基于预先制定的路由策略让去往某一特定网络的流量在两条链路上通过。此外,当其中一条链路失效后另外一条链路能充当其备分链路。
现在假定AS11的BGP路由策略如下:
● AS11接收来自AS10的本地路由,连同其余一些默认的Inetnet路由。
● 外出流量策略是:
①从R101去往Internet的所有流量走R101-R103这条链路。
②若R101-R103链路失效则R101去往Internet的所有流量从R102到达AS10.
③从R102去往Internet的所有流量走R102-R104这条链路。
④若R102-R104链路失效则R102去往Internet的所有流量从R101到达AS10.
●进入流量的策略是:
①从Inetnet到网络192.168.11.0/24的流量走R103-R101这条链路。
②从Inetnet到网络192.168.12.0/24的流量走R104-R102这条链路。
③如果到AS10的其中一条链路失效,那么另一条链路必须路由所有从Intnet返回到AS11的流量。
要达成以上策略,就要使得经R101到R103所通告192.168.11.0的As-Path比经R102到R104的As-Path短,则AS10就会选择R103-R101链路为最佳路径。同样的,经R102-R104链路所通告的192.168.12.0也要有较短的As-Path,那么AS10就会为去往AS11网络192.168.12.0的流量优选链路R104-R102.
对于外出的流量,BGP会根据通过eBGP学得的路由来决定最佳路径,这些路由也可从iBGP学到。所以R101既可以通过eBGP从R103学到10.10.34.0又可以通过iBGP从R102学到。但是外部路径优先于内部路径。所以R101到10.10.34.0的路由会走R101-R103链路,下一跳为10.10.13.3.R102到10.10.34.0的路由会走R102-R104链路下一跳为10.10.24.4.这样便在去往10.10.34.0的流量上达到了负载共享的效果。
配置如下:
R101
R101(config)#int s1/1
R101(config-if)#ip add 10.10.13.1 255.255.255.0
R101(config-if)#no sh
R101(config-if)#int fa0/0
R101(config-if)#ip add 192.168.12.1 255.255.255.0
R101(config-if)#ip add 192.168.11.1 255.255.255.0 sec
R101(config-if)#no sh
R101(config)#router bgp 11
R101(config-router)#no syn
R101(config-router)#net 192.168.11.0
R101(config-router)#net 192.168.12.0
R101(config-router)#nei 10.10.13.3 remote-as 10
R101(config-router)#nei 10.10.13.3 route-map R101-R103-MAP out
R101(config-router)#nei 192.168.12.2 remote-as 11
R101(config-router)#nei 192.168.12.2 next-hop-self
R101(config-router)#maximum-paths 2
R101(config-router)#no auto-summary
R101(config-router)#access-list 1 permit 192.168.12.0
R101(config)#access-list 2 per 192.168.11.0
R101(config)#route-map R101-R103-MAP per 10
R101(config-route-map)#match ip add 1
R101(config-route-map)#set as-path prepend 11 11 11
R101(config-route-map)#route-map R101-R103-MAP per 20
R101(config-route-map)#match ip add 2
R102
R102(config)#int s1/2
R102(config-if)#ip add 10.10.24.2 255.255.255.0
R102(config-if)#no sh
R102(config-if)#int fa0/0
R102(config-if)#ip add 192.168.12.2 255.255.255.0
R102(config-if)#ip add 192.168.11.2 255.255.255.0 sec
R102(config-if)#no sh
R102(config)#router bgp 11
R102(config-router)#no syn
R102(config-router)#net 192.168.11.0
R102(config-router)#net 192.168.12.0
R102(config-router)#nei 10.10.24.4 remote-as 10
R102(config-router)#nei 10.10.24.4 route-map R102-R104-MAP out
R102(config-router)#nei 192.168.12.1 remote-as 11
R102(config-router)#nei 192.168.12.1 next-hop-self
R102(config-router)#no auto-summary
R102(config-router)#access-list 1 permit 192.168.11.0
R102(config)#access-list 2 per 192.168.12.0
R102(config)#route-map R102-R104-MAP per 10
R102(config-route-map)#match ip add 1
R102(config-route-map)#set as-path prepend 11 11 11
R102(config-route-map)#route-map R102-R104-MAP per 20
R102(config-route-map)#match ip add 2
R103
R103(config)#int s1/0
R103(config-if)#ip add 10.10.13.3 255.255.255.0
R103(config-if)#no sh
R103(config-if)#int fa0/0
R103(config-if)#ip add 10.10.34.3 255.255.255.0
R103(config-if)#no sh
R103(config)#router bgp 10
R103(config-router)#no syn
R103(config-router)#net 10.10.34.0 mask 255.255.255.0
R103(config-router)#nei 10.10.13.1 remote-as 11
R103(config-router)#nei 10.10.13.1 default-originate
R103(config-router)#nei 10.10.34.4 remote-as 10
R103(config-router)#nei 10.10.34.4 next-hop-self
R103(config-router)#no auto-summary
R104
R104(config)#int s1/0
R104(config-if)#ip add 10.10.24.4 255.255.255.0
R104(config-if)#no sh
R104(config-if)#int fa0/0
R104(config-if)#ip add 10.10.34.4 255.255.255.0
R104(config-if)#no sh
R104(config)#router bgp 10
R104(config-router)#no syn
R104(config-router)#nei 10.10.24.2 remote-as 11
R104(config-router)#nei 10.10.24.2 default-originate
R104(config-router)#nei 10.10.34.3 remote-as 10
R104(config-router)#nei 10.10.34.3 next-hop-self
R104(config-router)#no auto-summary
R101的BGP表中显示所以去往Internet的流量都通过链R101-R103.
R101#sh ip bgp
BGP table version is 6, local router ID is 192.168.12.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
* i0.0.0.0 192.168.12.2 100 0 10 i
*> 10.10.13.3 0 10 i
*> 10.10.34.0/24 10.10.13.3 0 0 10 i
* i 192.168.12.2 100 0 10 i
* i192.168.11.0 192.168.12.2 0 100 0 i
*> 0.0.0.0 0 32768 i
* i192.168.12.0 192.168.12.2 0 100 0 i
*> 0.0.0.0 0 32768 i
R101#sh ip ro
Gateway of last resort is 10.10.13.3 to network 0.0.0.0
C 192.168.12.0/24 is directly connected, FastEthernet0/0
C 192.168.11.0/24 is directly connected, FastEthernet0/0
10.0.0.0/24 is subnetted, 2 subnets
C 10.10.13.0 is directly connected, Serial1/1
B 10.10.34.0 [20/0] via 10.10.13.3, 00:02:39
B* 0.0.0.0/0 [20/0] via 10.10.13.3, 00:13:01
R102的BGP表中显示按照路由策略所以去往AS10的流量都通过R102-R104.
R102#sh ip bgp
BGP table version is 5, local router ID is 192.168.12.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 0.0.0.0 10.10.24.4 0 10 i
* i 192.168.12.1 100 0 10 i
* i10.10.34.0/24 192.168.12.1 0 100 0 10 i
*> 10.10.24.4 0 10 i
* i192.168.11.0 192.168.12.1 0 100 0 i
*> 0.0.0.0 0 32768 i
* i192.168.12.0 192.168.12.1 0 100 0 i
*> 0.0.0.0 0 32768 i
R102#sh ip ro
Gateway of last resort is 10.10.24.4 to network 0.0.0.0
C 192.168.12.0/24 is directly connected, FastEthernet0/0
C 192.168.11.0/24 is directly connected, FastEthernet0/0
10.0.0.0/24 is subnetted, 2 subnets
C 10.10.24.0 is directly connected, Serial1/2
B 10.10.34.0 [20/0] via 10.10.24.4, 00:04:12
B* 0.0.0.0/0 [20/0] via 10.10.24.4, 00:12:08
验证从AS10进入AS11的流量。去往网络192.168.11.0的流量走链路R103-R101,去往网络162.168.12.0的流量走链路R104-R102.
R103# sh ip bgp
BGP table version is 5, local router ID is 10.10.34.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 10.10.34.0/24 0.0.0.0 0 32768 i
*> 192.168.11.0 10.10.13.1 0 0 11 i
*>i192.168.12.0 10.10.34.4 0 100 0 11 i
* 10.10.13.1 0 0 11 11 11 11 i
R103#sh ip ro
Gateway of last resort is not set
B 192.168.12.0/24 [200/0] via 10.10.34.4, 00:49:14
B 192.168.11.0/24 [20/0] via 10.10.13.1, 00:52:36
10.0.0.0/24 is subnetted, 2 subnets
C 10.10.13.0 is directly connected, Serial1/0
C 10.10.34.0 is directly connected, FastEthernet0/0
在R104上情况相同。
当R101-R103的链路失效后,R102-R104成为其备分链路
R103(config)#int s1/0
R103(config-if)#sh
R101#sh ip bgp
BGP table version is 8, local router ID is 192.168.12.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*>i0.0.0.0 192.168.12.2 100 0 10 i
*>i10.10.34.0/24 192.168.12.2 100 0 10 i
* i192.168.11.0 192.168.12.2 0 100 0 i
*> 0.0.0.0 0 32768 i
* i192.168.12.0 192.168.12.2 0 100 0 i
*> 0.0.0.0 0 32768 i
R101#sh ip ro
Gateway of last resort is 192.168.12.2 to network 0.0.0.0
C 192.168.12.0/24 is directly connected, FastEthernet0/0
C 192.168.11.0/24 is directly connected, FastEthernet0/0
10.0.0.0/24 is subnetted, 1 subnets
B 10.10.34.0 [200/0] via 192.168.12.2, 00:01:42
B* 0.0.0.0/0 [200/0] via 192.168.12.2, 00:01:42
R103#sh ip bgp
BGP table version is 7, local router ID is 10.10.34.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 10.10.34.0/24 0.0.0.0 0 32768 i
*>i192.168.11.0 10.10.34.4 0 100 0 11 11 11 11 i
*>i192.168.12.0 10.10.34.4 0 100 0 11 i
R103#sh ip ro
Gateway of last resort is not set
B 192.168.12.0/24 [200/0] via 10.10.34.4, 01:09:47
B 192.168.11.0/24 [200/0] via 10.10.34.4, 00:14:08
10.0.0.0/24 is subnetted, 1 subnets
C 10.10.34.0 is directly connected, FastEthernet0/0
|