? ? ? ?想要了解BGP协议下的路由聚合、路由反射器、联邦的具体命令配置,需要5通过如下的小实验来模拟现实网络环境来了解与掌握BGP协议。
?要求:1、AS1存在两个环回,一个IP地址为192.168.1.0/24该地址不能在任何协议中宣告
? ? ? ? ? ? ? ? ?AS3中存在两个环回,一个IP地址为192.168.2.0/24该地址不能在任何协议中宣告,最终要求这两个环回可以互相通讯
? ? ? ? ? ? ? ? ?AS1的另一个环回为10.0.0.0/24,AS3的另一个环回为11.0.0.0/24
? ? ? ? ? ?2、整个AS2的IP地址为172.16.0.0/16,请合理划分
? ? ? ? ? ?3、AS间的骨干链路IP地址随意定制
? ? ? ? ? ?4、使用BGP协议让整个网络的环回可以互相访问
? ? ? ? ? ?5、减少路由条目数量,避免环回出现
目录
一、首先给AS2区域根据172.16.0.0/16网段进行合理划分
二、按照划分的网段对路由器的接口进行IP地址的配置
(1)R1
(2)R2
(3)R3
(4)R4
(5)R5
(6)R6
(7)R7
(8)R8
三、在每个路由器上配置ospf协议
(1)R1
(2)R2
(3)R3
(4)R4
(5)R5
(6)R6
(7)R7?
(8)R8
四、对路由器进行BGP边界网关协议的配置
(1)R1与R2之间进行EBGP的建立
(2)R7与R8之间进行EBGP的建立
(3)AS2区域中64512内R/2/3/4之间建立联邦
(4)AS2区域中64513内的R/5/6/7之间建立联邦
(5)R2与R5之间建立EBGP邻居关系
(6)R4与R7之间建立EBGP邻居关系
(7)R2与R5之间,R4与R7之间建立EBGP关系后还需修改TTL值
五、路由反射器
在R3与R6上配置路由反射器用来打破IBGP的水平分割
六、整个网络的环回可以互相访问
七、创建虚拟隧道
(1)对R1
(2)对R8
(3)此时便可使R1与R8的另外两个环回互相访问
一、首先给AS2区域根据172.16.0.0/16网段进行合理划分
172.16.0.0/18-----AS 64512? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 172.16.64.0/18----AS 64513
? ? ? ?172.16.0.0/21? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?172.16.64.0/21
???????172.16.8.0/21? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?172.16.72.0/21
???????172.16.16.0/21 ??????????????????????????????????????????????????????172.16.80.0/21
???????172.16.24.0/21 ??????????????????????????????????????????????????????172.16.88.0/21
???????172.16.32.0/21? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?172.16.96.0/21
???????172.16.40.0/21 ??????????????????????????????????????????????????????172.16.104.0/21
???????172.16.48.0/21? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?172.16.112.0/21
???????172.16.56.0/21 ??????????????????????????????????????????????????????172.16.120.0/21
???????172.16.128.0/18----骨干一
???????172.16.192.0/18----骨干二
二、按照划分的网段对路由器的接口进行IP地址的配置
(1)R1
[R1-GigabitEthernet0/0/0]ip add 12.0.0.1 24
[R1-LoopBack0]ip add 192.168.1.1 24
[R1-LoopBack1]ip add 10.0.0.1 24
(2)R2
[R2-GigabitEthernet0/0/0]ip add 12.0.0.2 24
[R2-GigabitEthernet0/0/1]ip add 172.16.0.1 21
[R2-GigabitEthernet0/0/2]ip add 172.16.128.1 18
(3)R3
[R3-GigabitEthernet0/0/0]ip add 172.16.0.2 21
[R3-GigabitEthernet0/0/1]ip add 172.16.8.1 21
[R3-LoopBack0]ip add 172.16.24.1 21
(4)R4
[R4-GigabitEthernet0/0/0]ip add 172.16.8.2 21
[R4-GigabitEthernet0/0/1]ip add 172.16.192.1 18
[R4-LoopBack0]ip add 172.16.32.1 21
(5)R5
[R5-GigabitEthernet0/0/0]ip add 172.16.128.2 18
[R5-GigabitEthernet0/0/1]ip add 172.16.64.1 21
[R5-LoopBack0]ip add 172.16.80.1 21
(6)R6
[R6-GigabitEthernet0/0/0]ip add 172.16.64.2 21
[R6-GigabitEthernet0/0/1]ip add 172.16.72.1 21
[R6-LoopBack0]ip add 172.16.88.1 21
(7)R7
[R7-GigabitEthernet0/0/0]ip add 172.16.72.2 21
[R7-GigabitEthernet0/0/1]ip add 172.16.192.2 21
[R7-GigabitEthernet0/0/2]ip add 78.0.0.1 24
[R7-LoopBack0]ip add 172.16.96.1 21
(8)R8
[R8-GigabitEthernet0/0/0]ip add 78.0.0.2 24
[R8-LoopBack0]ip add 192.168.2.1 24
[R8-LoopBack1]ip add 11.0.0.1 24
三、在每个路由器上配置ospf协议
(1)R1
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]a 0
[R1-ospf-1-area-0.0.0.0]network 10.0.0.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]network 12.0.0.1 0.0.0.0
(2)R2
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1-area-0.0.0.0]network 12.0.0.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 172.16.0.1 0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 172.16.16.1 0.0.0.0
[R2-ospf-1-area-0.0.0.0]network 172.16.128.1 0.0.0.0
(3)R3
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]network 172.16.0.2 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 172.16.24.1 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 172.16.8.1 0.0.0.0
(4)R4
[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]a 0
[R4-ospf-1-area-0.0.0.0]network 172.16.8.2 0.0.0.0
[R4-ospf-1-area-0.0.0.0]network 172.16.32.1 0.0.0.0
[R4-ospf-1-area-0.0.0.0]network 172.16.192.1 0.0.0.0
(5)R5
[R5]ospf 1 router-id 5.5.5.5
[R5-ospf-1]a 0
[R5-ospf-1-area-0.0.0.0]network 172.16.128.2 0.0.0.0
[R5-ospf-1-area-0.0.0.0]network 172.16.64.1 0.0.0.0
[R5-ospf-1-area-0.0.0.0]network 172.16.80.1 0.0.0.0
(6)R6
[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]a 0
[R6-ospf-1-area-0.0.0.0]network 172.16.64.2 0.0.0.0
[R6-ospf-1-area-0.0.0.0]network 172.16.72.1 0.0.0.0
[R6-ospf-1-area-0.0.0.0]network 172.16.88.1 0.0.0.0
(7)R7?
[R7]ospf 1 router-id 7.7.7.7
[R7-ospf-1]a 0
[R7-ospf-1-area-0.0.0.0]network 172.16.72.2 0.0.0.0
[R7-ospf-1-area-0.0.0.0]network 172.16.96.1 0.0.0.0
[R7-ospf-1-area-0.0.0.0]network 78.0.0.1 0.0.0.0
(8)R8
[R8]ospf 1 router-id 8.8.8.8
[R8-ospf-1]a 0
[R8-ospf-1-area-0.0.0.0]network 78.0.0.2 0.0.0.0
[R8-ospf-1-area-0.0.0.0]network 11.0.0.1 0.0.0.0
四、对路由器进行BGP边界网关协议的配置
(1)R1与R2之间进行EBGP的建立
[R1]bgp 1
[R1-bgp]router-id 1.1.1.1
[R1-bgp]peer 12.0.0.2 as-number 2
[R1-bgp]
Oct 15 2022 19:06:40-08:00 R1 %%01BGP/3/STATE_CHG_UPDOWN(l)[0]:The status of the
peer 12.0.0.2 changed from OPENCONFIRM to ESTABLISHED. (InstanceName=Public, St
ateChangeReason=Up)
[R2]bgp 64512
[R2-bgp]peer 12.0.0.1 as-number 1
[R2-bgp]
Oct 15 2022 20:00:57-08:00 R2 %%01BGP/3/STATE_CHG_UPDOWN(l)[0]:The status of the
peer 12.0.0.1 changed from OPENCONFIRM to ESTABLISHED. (InstanceName=Public, St
ateChangeReason=Up)
(2)R7与R8之间进行EBGP的建立
[R7]bgp 2
[R7-bgp]router-id 7.7.7.7
[R7-bgp]peer 78.0.0.2 as-number 3
[R7-bgp]
Oct 15 2022 20:02:38-08:00 R7 %%01BGP/3/STATE_CHG_UPDOWN(l)[0]:The status of the
peer 78.0.0.2 changed from OPENCONFIRM to ESTABLISHED. (InstanceName=Public, St
ateChangeReason=Up)
[R8]bgp 3
[R8-bgp]router-id 8.8.8.8
[R8-bgp]peer 78.0.0.1 as-number 2
[R8-bgp]
Oct 15 2022 19:12:31-08:00 R8 %%01BGP/3/STATE_CHG_UPDOWN(l)[0]:The status of the
peer 78.0.0.1 changed from OPENCONFIRM to ESTABLISHED. (InstanceName=Public, St
ateChangeReason=Up)
(3)AS2区域中64512内R/2/3/4之间建立联邦
[R2]bgp 64512
[R2-bgp]confederation id 2
[R2-bgp]peer 172.16.24.1 as-number 64512
[R2-bgp]peer 172.16.24.1 next-hop-local
[R3]bgp 64512
[R3-bgp]confederation id 2
[R3-bgp]peer 172.16.16.1 as-number 64512
[R3-bgp]peer 172.16.16.1 next-hop-local
[R3-bgp]peer 172.16.32.1 as-number 64512
[R3-bgp]peer 172.16.32.1 next-hop-local
[R4]bgp 64512
[R4-bgp]confederation id 2
[R4-bgp]peer 172.16.24.1 as-number 64512
[R4-bgp]peer 172.16.24.1 next-hop-local
(4)AS2区域中64513内的R/5/6/7之间建立联邦
[R5]bgp 64513
[R5-bgp]confederation id 2
[R5-bgp]peer 172.16.88.1 as-number 64513
[R5-bgp]peer 172.16.88.1 next-hop-local
[R6]bgp 64513
[R6-bgp]confederation id 2
[R6-bgp]peer 172.16.80.1 as-number 64513
[R6-bgp]peer 172.16.80.1 next-hop-local
[R6-bgp]peer 172.16.96.1 as-number 64513
[R6-bgp]peer 172.16.96.1 next-hop-local
[R7]bgp 64513
[R7-bgp]confederation id 2
[R7-bgp]peer 172.16.88.1 as-number 64513
[R7-bgp]peer 172.16.88.1 next-hop-local
(5)R2与R5之间建立EBGP邻居关系
[R2]bgp 64512
[R2-bgp]confederation peer-as 64513
[R2-bgp]peer 172.16.128.2 as-number 64513
[R2-bgp]
Oct 15 2022 19:51:13-08:00 R2 %%01BGP/3/STATE_CHG_UPDOWN(l)[0]:The status of the
peer 172.16.128.2 changed from OPENCONFIRM to ESTABLISHED. (InstanceName=Public
, StateChangeReason=Up)
[R5]bgp 64513
[R5-bgp]confederation peer-as 64512
[R5-bgp]peer 172.16.128.1 as-number 64512
[R5-bgp]
Oct 15 2022 19:51:13-08:00 R5 %%01BGP/3/STATE_CHG_UPDOWN(l)[0]:The status of the
peer 172.16.128.1 changed from OPENCONFIRM to ESTABLISHED. (InstanceName=Public
, StateChangeReason=Up)
(6)R4与R7之间建立EBGP邻居关系
[R4]bgp 64512
[R4-bgp]confederation peer-as 64513
[R4-bgp]peer 172.16.192.2 as-number 64513
[R4-bgp]
Oct 15 2022 19:55:22-08:00 R4 %%01BGP/3/STATE_CHG_UPDOWN(l)[0]:The status of the
peer 172.16.192.2 changed from OPENCONFIRM to ESTABLISHED. (InstanceName=Public
, StateChangeReason=Up)
[R7]bgp 64513
[R7-bgp]confederation peer-as 64512
[R7-bgp]peer 172.16.192.1 as-number 64512
[R7-bgp]
Oct 15 2022 19:55:22-08:00 R7 %%01BGP/3/STATE_CHG_UPDOWN(l)[0]:The status of the
peer 172.16.192.1 changed from OPENCONFIRM to ESTABLISHED. (InstanceName=Public
, StateChangeReason=Up)
(7)R2与R5之间,R4与R7之间建立EBGP关系后还需修改TTL值
[R2-bgp]peer 172.16.128.2 ebgp-max-hop
[R5-bgp]peer 172.16.128.1 ebgp-max-hop
[R4-bgp]peer 172.16.192.2 ebgp-max-hop
[R7-bgp]peer 172.16.192.1 ebgp-max-hop
五、路由反射器
反射规则
1,如果路由反射器从自己客户处学习到一条路由信息,则他将把该路由信息反射给自
己所有的客户以及非客户。
2,如果RR从自己的非客户处学习到一条路由信息,则他将把该路由信息反射给自己所
有的客户。
"非非不传"
3,当路由器执行路由反射时,他只将自己使用的最优的BGP路由进行反射
在R3与R6上配置路由反射器用来打破IBGP的水平分割
[R3-bgp]peer 172.16.16.1 reflect-client
[R6-bgp]peer 172.16.80.1 reflect-client
六、整个网络的环回可以互相访问
<R1>ping 172.16.16.1
PING 172.16.16.1: 56 data bytes, press CTRL_C to break
Reply from 172.16.16.1: bytes=56 Sequence=1 ttl=255 time=40 ms
Reply from 172.16.16.1: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 172.16.16.1: bytes=56 Sequence=3 ttl=255 time=20 ms
Reply from 172.16.16.1: bytes=56 Sequence=4 ttl=255 time=10 ms
Reply from 172.16.16.1: bytes=56 Sequence=5 ttl=255 time=20 ms
--- 172.16.16.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/22/40 ms
<R1>ping 172.16.24.1
PING 172.16.24.1: 56 data bytes, press CTRL_C to break
Reply from 172.16.24.1: bytes=56 Sequence=1 ttl=254 time=30 ms
Reply from 172.16.24.1: bytes=56 Sequence=2 ttl=254 time=30 ms
Reply from 172.16.24.1: bytes=56 Sequence=3 ttl=254 time=40 ms
Reply from 172.16.24.1: bytes=56 Sequence=4 ttl=254 time=20 ms
Reply from 172.16.24.1: bytes=56 Sequence=5 ttl=254 time=20 ms
--- 172.16.24.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/28/40 ms
<R1>ping 172.16.32.1
PING 172.16.32.1: 56 data bytes, press CTRL_C to break
Reply from 172.16.32.1: bytes=56 Sequence=1 ttl=253 time=40 ms
Reply from 172.16.32.1: bytes=56 Sequence=2 ttl=253 time=30 ms
Reply from 172.16.32.1: bytes=56 Sequence=3 ttl=253 time=40 ms
Reply from 172.16.32.1: bytes=56 Sequence=4 ttl=253 time=30 ms
Reply from 172.16.32.1: bytes=56 Sequence=5 ttl=253 time=30 ms
--- 172.16.32.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/34/40 ms
<R1>ping 172.16.88.1
PING 172.16.88.1: 56 data bytes, press CTRL_C to break
Reply from 172.16.88.1: bytes=56 Sequence=1 ttl=253 time=40 ms
Reply from 172.16.88.1: bytes=56 Sequence=2 ttl=253 time=40 ms
Reply from 172.16.88.1: bytes=56 Sequence=3 ttl=253 time=40 ms
Reply from 172.16.88.1: bytes=56 Sequence=4 ttl=253 time=30 ms
Reply from 172.16.88.1: bytes=56 Sequence=5 ttl=253 time=40 ms
--- 172.16.88.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/38/40 ms
<R1>ping 172.16.96.1
PING 172.16.96.1: 56 data bytes, press CTRL_C to break
Reply from 172.16.96.1: bytes=56 Sequence=1 ttl=252 time=60 ms
Reply from 172.16.96.1: bytes=56 Sequence=2 ttl=252 time=40 ms
Reply from 172.16.96.1: bytes=56 Sequence=3 ttl=252 time=40 ms
Reply from 172.16.96.1: bytes=56 Sequence=4 ttl=252 time=50 ms
Reply from 172.16.96.1: bytes=56 Sequence=5 ttl=252 time=50 ms
--- 172.16.96.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 40/48/60 ms
<R1>
七、创建虚拟隧道
(1)对R1
[r1]int t0/0/1
[r1-Tunnel0/0/1]ip add 192.168.3.1 24
[r1-Tunnel0/0/1]tunnel-protocol gre
[r1-Tunnel0/0/1]source 10.0.0.1
[r1-Tunnel0/0/1]description 11.0.0.1
[r1]ip route-static 192.168.2.0 24 192.168.3.2
(2)对R8
[r8]int t0/0/1
[r8-Tunnel0/0/1]ip add 192.168.3.2 24
[r8-Tunnel0/0/1]tunnel-protocol gre
[r8-Tunnel0/0/1]source 11.0.0.1
[r8-Tunnel0/0/1]description 10.0.0.1
[r8]ip route-static 192.168.1.0 24 192.168.3.1
(3)此时便可使R1与R8的另外两个环回互相访问
?
|