1. 程式人生 > >41-高級路由:BGP AS長度:接收一切、最大AS長度、不比較AS長度

41-高級路由:BGP AS長度:接收一切、最大AS長度、不比較AS長度

nag ever ocp 是否 out work stat 5.5.0 summary

一、實驗拓撲:
技術分享圖片
二、實驗要求:
1、R4配置同上個實驗;
2、R3配置接收的路由包含最大AS長度為4;
3、R3配置隱藏命令,不比較AS長度;
4、R5配置不管收到的路由有沒有包含本地AS都收入(之前R4已經配置了4.4.4.4出方向關於AS 5的路徑);
5、驗證:AS最大長度為4,還可以接收R1過來的4.4.4.4嗎?
6、驗證:不比較AS長度,4.4.4.4最優路徑還是R1嗎?
7、驗證:R5是否仍然可以接收含有AS 5 的路由條目呢?
三、命令部署:
1、R3配置接收的路由包含最大AS長度為4
R3(config)#router bgp 123
R3(config-router)#bgp maxas-limit 4

2、R3配置隱藏命令,不比較AS長度
R3(config)#router bgp 123
R3(config-router)#no bgp maxas-limit 4
R3(config-router)#bgp bestpath as-path ignore

3、R5配置不管收到的路由有沒有包含本地AS都收入
①基本部署:
R5(config-if)#int f0/0
R5(config-if)#no shutdown
R5(config-if)#ip add 35.1.1.5 255.255.255.0
R5(config)#int lo0
R5(config-if)#ip add 5.5.5.5 255.255.255.0

R5(config-if)#router bgp 5
R5(config-router)#neighbor 3.3.3.3 remote-as 123
R5(config-router)#network 35.1.1.0 mask 255.255.255.0
R5(config-router)#network 5.5.5.0 mask 255.255.255.0
R5(config-router)#neighbor 3.3.3.3 next-hop-self
R5(config-router)#neighbor 3.3.3.3 update-source loopback 0

R5(config)#ip route 3.3.3.0 255.255.255.0 f0/0

R5(config-router)#neighbor 3.3.3.3 ebgp-multihop

R3(config)#int f1/0
R3(config-if)#no shutdown
R3(config-if)#ip add 35.1.1.3 255.255.255.0

R3(config)#router bgp 123
R3(config-router)#neighbor 5.5.5.5 remote-as 5
R3(config-router)#neighbor 5.5.5.5 update-source loopback 0
R3(config-router)#neighbor 5.5.5.5 next-hop-self

R3(config)#ip route 5.5.5.0 255.255.255.0 f1/0
R3(config-router)#neighbor 5.5.5.5 ebgp-multihop
R3(config-if)#no ip split-horizon

②重點部署
R5(config)#router bgp 5
R5(config-router)#neighbor 3.3.3.3 allowas-in

四、驗證:
1、R3配置接收的路由包含最大AS長度為4
R3#
Long AS path 4 5 6 7 8 received from 2.2.2.2: More than configured MAXAS-LIMIT

R3#show ip bgp
Network Next Hop Metric LocPrf Weight Path
*>i4.4.4.0/24 1.1.1.1 0 100 0 4 i
結論:可以看到R3會自動報錯,而且show ip bgp只有1.1.1.1的路徑

2、R3配置隱藏命令,不比較AS長度
R2#show ip bgp
Network Next Hop Metric LocPrf Weight Path
*> 4.4.4.0/24 24.1.1.4 0 0 4 5 6 7 8 i

R3#show ip bgp
Network Next Hop Metric LocPrf Weight Path
*>i4.4.4.0/24 2.2.2.2 0 100 0 4 5 6 7 8 i

  • i 1.1.1.1 0 100 0 4 i
    結論:雖然R2 的AS長度比R1長,但是4.4.4.4的路由條目的最優路徑仍然是R2

3、R5配置不管收到的路由有沒有包含本地AS都收入
R5#show ip bgp summary
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
3.3.3.3 4 123 0 0 0 0 0 never Idle
①未部署命令前:可以看到沒有4.4.4.4的路由條目
R5#show ip bgp
Network Next Hop Metric LocPrf Weight Path
> 1.1.1.0/24 3.3.3.3 0 123 i
> 2.2.2.0/24 3.3.3.3 0 123 i
r> 3.3.3.0/24 3.3.3.3 0 0 123 i
> 5.5.5.0/24 0.0.0.0 0 32768 i
> 14.1.1.0/24 3.3.3.3 0 123 4 i
> 20.20.20.0/24 3.3.3.3 0 0 123 i
> 24.1.1.0/24 3.3.3.3 0 123 i
> 35.1.1.0/24 0.0.0.0 0 32768 i
②R5部署命令後:
R5#show ip bgp
Network Next Hop Metric LocPrf Weight Path
> 1.1.1.0/24 3.3.3.3 0 123 i
> 2.2.2.0/24 3.3.3.3 0 123 i
r> 3.3.3.0/24 3.3.3.3 0 0 123 i
> 4.4.4.0/24 3.3.3.3 0 123 4 5 6 7 8 i
> 5.5.5.0/24 0.0.0.0 0 32768 i
> 14.1.1.0/24 3.3.3.3 0 123 4 i
> 20.20.20.0/24 3.3.3.3 0 0 123 i
> 24.1.1.0/24 3.3.3.3 0 123 i
*> 35.1.1.0/24 0.0.0.0 0 32768 i

41-高級路由:BGP AS長度:接收一切、最大AS長度、不比較AS長度