一、实验拓扑
二、实验要求
按照图示配置IP地址以及在路由器上配置BGP,使其全网通
1、配置IP地址
2、配置AS 200内的OSPF
[AR2]ospf 1 router-id 2.2.2.2
[AR2-ospf-1]a 0
[AR2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[AR2-ospf-1-area-0.0.0.0]network 100.3.3.0 0.0.0.255
[AR3]ospf 1 router-id 3.3.3.3
[AR3-ospf-1]a 0
[AR3-ospf-1-area-0.0.0.0]network 100.4.4.0 0.0.0.255
[AR3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[AR4]ospf 1 router-id 4.4.4.4
[AR4-ospf-1]a 0
[AR4-ospf-1-area-0.0.0.0]network 100.3.3.0 0.0.0.255
[AR4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[AR4-ospf-1-area-0.0.0.0]network 192.168.1.1 0.0.0.255
[AR4-ospf-1-area-0.0.0.0]network 100.4.4.0 0.0.0.255
3、BGP建邻
[AR1]bgp 100
[AR1-bgp]peer 100.1.1.2 as-number 200 #EBGP
[AR1-bgp]peer 100.2.2.3 as-number 200 #EBGP
[AR2]bgp 200
[AR2-bgp]peer 100.1.1.1 as-number 100 #EBGP
[AR2-bgp]peer 4.4.4.4 as-number 200 #IBGP
[AR2-bgp]peer 4.4.4.4 connect-interface l0 # 修改更新源,确保可收发协议报文
[AR2-bgp]peer 4.4.4.4 next-hop-local #修改下一跳为本机
[AR3]bgp 200
[AR3-bgp]peer 100.2.2.1 as-number 100 #EBGP
[AR3-bgp]peer 4.4.4.4 as-number 200 #IBGP
[AR3-bgp]peer 4.4.4.4 connect-interface l0 # 修改更新源
[AR3-bgp]peer 4.4.4.4 next-hop-local #修改下一跳为本机
[AR4]bgp 200
[AR4-bgp]peer 2.2.2.2 as-number 200
[AR4-bgp]peer 2.2.2.2 connect-interface l0
[AR4-bgp]peer 3.3.3.3 as-number 200
[AR4-bgp]peer 3.3.3.3 connect-interface l0
4、宣告网段,更改选路
[AR4]bgp 200
[AR4-bgp]network 192.168.1.0 24 宣告网段
在R2上修改,抓取流量(ACL)更改策略,以影响选路
[AR2]acl 2000
[AR2-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[AR2]route-policy 1.0 permit node 10 # 名为1.0的路由策略,节点为10
Info: New Sequence of this List.
[AR2-route-policy]if-match acl 2000
[AR2-route-policy]apply as-path 300 400 additive
[AR2]route-policy 1.0 permit node 20 # 配置空节点放行其他路由(apply)
[AR2]bgp 200 # 调用策略
[AR2-bgp]peer 100.1.1.1 route-policy 1.0 export #调用名为1.0的策略(出方向)
# R2传给R1时,在R2上配置出方向;在R1上配置入方向