【实验步骤】
1、配置完成后请看路由表:
<R5>dis ip ro
Routing Tables: Public
Destinations : 6 Routes : 6
Destination/Mask Proto Pre Cost NextHop Interface
10.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
10.1.2.0/24 Direct 0 0 10.1.2.1 S0/6/3
10.1.2.1/32 Direct 0 0 127.0.0.1 InLoop0
10.1.2.2/32 Direct 0 0 10.1.2.2 S0/6/3
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
[R2]dis ip ro
Routing Tables: Public
Destinations : 8 Routes : 8
Destination/Mask Proto Pre Cost NextHop Interface
10.1.3.0/24 Direct 0 0 10.1.3.2 S0/6/0
10.1.3.1/32 Direct 0 0 10.1.3.1 S0/6/0
10.1.3.2/32 Direct 0 0 127.0.0.1 InLoop0
10.1.4.0/24 Direct 0 0 10.1.4.1 S0/6/1
10.1.4.1/32 Direct 0 0 127.0.0.1 InLoop0
10.1.4.2/32 Direct 0 0 10.1.4.2 S0/6/1
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
[R4-bgp]dis ip ro
Routing Tables: Public
Destinations : 6 Routes : 6
Destination/Mask Proto Pre Cost NextHop Interface
10.1.4.0/24 Direct 0 0 10.1.4.2 S0/6/1
10.1.4.1/32 Direct 0 0 10.1.4.1 S0/6/1
10.1.4.2/32 Direct 0 0 127.0.0.1 InLoop0
10.1.5.1/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
[R1-bgp]dis ip ro
Routing Tables: Public
Destinations : 9 Routes : 9
Destination/Mask Proto Pre Cost NextHop Interface
10.1.1.1/32 BGP 255 0 10.1.2.1 S0/6/3
10.1.2.0/24 Direct 0 0 10.1.2.2 S0/6/3
10.1.2.1/32 Direct 0 0 10.1.2.1 S0/6/3
10.1.2.2/32 Direct 0 0 127.0.0.1 InLoop0
10.1.3.0/24 Direct 0 0 10.1.3.1 S0/6/0
10.1.3.1/32 Direct 0 0 127.0.0.1 InLoop0
10.1.3.2/32 Direct 0 0 10.1.3.2 S0/6/0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
从四张路由表中可知,只有R1学到了R5上10.1.1.1的路由。
2、next-hop-local 命令应用分析:
[R2]
[R2]dis ip ro
Routing Tables: Public
Destinations : 8 Routes : 8
Destination/Mask Proto Pre Cost NextHop Interface
10.1.3.0/24 Direct 0 0 10.1.3.2 S0/6/0
10.1.3.1/32 Direct 0 0 10.1.3.1 S0/6/0
10.1.3.2/32 Direct 0 0 127.0.0.1 InLoop0
10.1.4.0/24 Direct 0 0 10.1.4.1 S0/6/1
10.1.4.1/32 Direct 0 0 127.0.0.1 InLoop0
10.1.4.2/32 Direct 0 0 10.1.4.2 S0/6/1
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
路由表中没有
<R2>dis bgp ro
Total Number of Routes: 1
BGP Local router ID is 10.1.4.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn
i 10.1.1.1/32 10.1.2.1 0 100 0 100i
BGP路由表中有,但是不是最佳的,没有写入路由表
[R1-bgp]peer 10.1.3.2 next-hop-local
[R2]dis ip ro
Routing Tables: Public
Destinations : 9 Routes : 9
Destination/Mask Proto Pre Cost NextHop Interface
10.1.1.1/32 BGP 255 0 10.1.3.1 S0/6/0
10.1.3.0/24 Direct 0 0 10.1.3.2 S0/6/0
10.1.3.1/32 Direct 0 0 10.1.3.1 S0/6/0
10.1.3.2/32 Direct 0 0 127.0.0.1 InLoop0
10.1.4.0/24 Direct 0 0 10.1.4.1 S0/6/1
10.1.4.1/32 Direct 0 0 127.0.0.1 InLoop0
10.1.4.2/32 Direct 0 0 10.1.4.2 S0/6/1
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
[R2]dis bgp ro
Total Number of Routes: 1
BGP Local router ID is 10.1.4.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 10.1.1.1/32 10.1.3.1 0 100 0 100i
路由表中有,并且是最佳合法的。
[R2]
在R1上没有配置next-hop-local时,R2无路由,R1上配置了next-hop-local后,R2上有路由,缺省情况下,向EBGP对等体/对等体组发布路由时,将自身地址作为下一跳;向IBGP对
等体/对等体组发布路由时,不将自身地址作为下一跳。
3、配置反射器
配置前我们来看R4的情况
<R4>dis ip ro
Routing Tables: Public
Destinations : 6 Routes : 6
Destination/Mask Proto Pre Cost NextHop Interface
10.1.4.0/24 Direct 0 0 10.1.4.2 S0/6/1
10.1.4.1/32 Direct 0 0 10.1.4.1 S0/6/1
10.1.4.2/32 Direct 0 0 127.0.0.1 InLoop0
10.1.5.1/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
<R4>
<R4>
<R4>dis bgp ro
Total Number of Routes: 0
<R4>
将R2作为反射器,因为只有他与区域内的其他路由器建立了全连接
bgp 200视图下加入如下命令:
peer 10.1.3.1 reflect-client
peer 10.1.4.2 reflect-client
配置完成后我们来看R4的情况
<R4>dis ip ro
Routing Tables: Public
Destinations : 6 Routes : 6
Destination/Mask Proto Pre Cost NextHop Interface
10.1.4.0/24 Direct 0 0 10.1.4.2 S0/6/1
10.1.4.1/32 Direct 0 0 10.1.4.1 S0/6/1
10.1.4.2/32 Direct 0 0 127.0.0.1 InLoop0
10.1.5.1/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
<R4>dis bgp ro
Total Number of Routes: 1
BGP Local router ID is 10.1.5.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn
i 10.1.1.1/32 10.1.3.1 0 100 0 100i
配置完成后学到了10.1.1.1的路由!