一.首先给AS2区域进行网段划分
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地址分配
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
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
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
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
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
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
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
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协议
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
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
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
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
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
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
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
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和R2EBGP的建立
[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
[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内R2/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路由进行反射
六、整个网络的环回可以互相访问
<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的另外两个环回互相访问