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的流量上达到了负载共享的效果。
top如下:
配置如下:
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
``````````````````````````````````````````````````````````````````````````````````````````````````````