实验3.15 BGP路由的引入
=================================================================================
1.基本配置
=================================================================================
#合作伙伴A,使用RIP路由协议
R1:
sys
sysname R1
int loop 0
ip add 10.0.1.1 32
int g0/0/0
ip add 10.0.12.1 24
q
undo info-cen en
------------------------------------------
#企业内部,AS 100
R2:
sys
sysname R2
int loop 0
ip add 10.0.2.2 32
int g0/0/1
ip add 10.0.12.2 24
int g0/0/0
ip add 10.0.23.2 24
q
undo info-cen en
------------------------------------------
#企业内部,AS 100
R3:
sys
sysname R3
int loop 0
ip add 10.0.3.3 32
int g0/0/0
ip add 10.0.23.3 24
int g0/0/1
ip add 10.0.34.3 24
q
undo info-cen en
------------------------------------------
#企业内部,AS 100
R4:
sys
sysname R4
int loop 0
ip add 10.0.4.4 32
int g0/0/0
ip add 10.0.34.4 24
int g0/0/1
ip add 10.0.45.4 24
q
undo info-cen en
------------------------------------------
#合作伙伴B,使用OSPF路由协议
R5:
sys
sysname R5
int loop 0
ip add 10.0.5.5 32
int g0/0/0
ip add 10.0.45.5 24
q
undo info-cen en
------------------------------------------
#为了让R2与R4能够建立TCP会话,配置静态路由。
R2:
ip route-static 10.0.34.0 255.255.255.0 10.0.23.3
R4:
ip route-static 10.0.23.0 255.255.255.0 10.0.34.3
=================================================================================
2.配置BGP路由协议
=================================================================================
#企业内部3台路由器R2、R3、R4,均属于AS 100,建立全互联的IBGP邻居关系。
R2:
bgp 100
router-id 10.0.2.2
peer 10.0.23.3 as-number 100
peer 10.0.23.3 next-hop-local
peer 10.0.34.4 as-number 100
peer 10.0.34.4 next-hop-local
network 10.0.2.2 32
q
------------------------------------------
R3:
bgp 100
router-id 10.0.3.3
peer 10.0.23.2 as-number 100
peer 10.0.34.4 as-number 100
network 10.0.3.3 32
q
------------------------------------------
R4:
bgp 100
router-id 10.0.4.4
peer 10.0.23.2 as-number 100
peer 10.0.23.2 next-hop-local
peer 10.0.34.3 as-number 100
peer 10.0.34.3 next-hop-local
network 10.0.4.4 32
q
------------------------------------------
=================================================================================
3.配置RIP路由协议和OSPF路由协议
=================================================================================
#在R1、R2上配置RIP路由协议
R1:
rip 1
version 2
network 10.0.0.0
q
-------------------
R2:
rip 1
version 2
network 10.0.0.0
q
------------------------------------------
#在R4、R5上配置ospf协议
R4:
ospf 1 router-id 10.0.4.4
area 0
network 10.0.45.0 0.0.0.255
-------------------
R5:
ospf 1 router-id 10.0.5.5
area 0
network 10.0.5.5 0.0.0.0
network 10.0.45.0 0.0.0.255
q
------------------------------------------
#可以将RIP、OSPF、IS-IS等IGP协议的动态路由,以及直连路由或静态路由引入到BGP协议的进程中。
#在引入路由的过程中,可根据需要实施相应的路由策略和控制。
=================================================================================
4.引入RIP路由
=================================================================================
R2:
sys
ip ip-prefix 1 permit 10.0.1.1 32
route-policy 1 permit node 10
if-match ip-prefix 1
bgp 100
import-route rip 1 route-policy 1
rip 1
default-route originate
dis bgp routing-table
------------------------------------------
#BGP进程中,MED的值默认为1,可根据需要修改,例修改为5.
R2:
bgp 100
import-route rip 1 med 5 route-policy 1
dis bgp routing-table
------------------------------------------
=================================================================================
5.引入RIP路由
=================================================================================
R4:
sys
ip ip-prefix 1 index 10 permit 10.0.5.5 32
route-policy 1 permit node 10
if-match ip-prefix 1
bgp 100
import-route ospf 1 route-policy 1
ospf 1
default-route-advertise always
dis bgp routing-table
------------------------------------------