实验目的:
1.AS1中存在两个环回,一个地址为192.168.1.0/24,该地址不能在任何协议中宣告
AS3中存在两个环回,一个地址为192.168.2.0/24该地址不能在任何协议中宣告最终要求这两个环回可以ping通;
2.整个AS2的IP地址为172.16.0.0/16,合理划分,并内部配置ospf协议
3.AS间的骨干链路IP地址随意定制;
4.使用BGP协议让整个网络所有设备的环回可以互相访问,
5.减少路由条目数量,避免环路出现;
划分网段:
配置ip:
[R1]INT g0/0/0
[R1-GigabitEthernet0/0/0]ip add 12.1.1.1 24
[R1]int l0
[R1-LoopBack0]ip add 172.16.0.1 32
[R1-LoopBack0]int l1
[R1-LoopBack1]ip add 192.168.1.1 24
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 12.1.1.2 24
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 172.16.1.1 30
[R2-GigabitEthernet0/0/1]int g0/0/2
[R2-GigabitEthernet0/0/2]ip add 172.16.1.21 30
[R2-GigabitEthernet0/0/2]int l0
[R2-LoopBack0]ip add 172.16.0.2 32
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 172.16.1.2 30
[R3-GigabitEthernet0/0/0]int g0/0/1
[R3-GigabitEthernet0/0/1]ip add 172.16.1.5 30
[R3-GigabitEthernet0/0/1]int l0
[R3-LoopBack0]ip add 172.16.0.3 32
[R3-LoopBack0]int l1
[R3-LoopBack1]ip add 172.16.3.1 24
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 172.16.1.6 30
[R4-GigabitEthernet0/0/0]int g0/0/1
[R4-GigabitEthernet0/0/1]ip add 172.16.1.9 30
[R4-GigabitEthernet0/0/1]int l0
[R4-LoopBack0]ip add 172.16.0.4 32
[R4-LoopBack0]int l1
[R4-LoopBack1]ip add 172.16.4.1 24
[R5]int g0/0/0
[R5-GigabitEthernet0/0/0]ip add 172.16.1.22 30
May 11 2024 15:20:08-08:00 R5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R5-GigabitEthernet0/0/0]int go/o/1
^
Error: Unrecognized command found at '^' position.
[R5-GigabitEthernet0/0/0]ip add 172.16.1.17 30
[R5-GigabitEthernet0/0/0]int l0
[R5-LoopBack0]ip add 172.16.0.5 32
[R5-LoopBack0]int l1
[R5-LoopBack1]ip add 172.16.5.1 24
[R6]int g0/0/0
[R6-GigabitEthernet0/0/0]ip add 172.16.1.18 30
May 11 2024 15:23:02-08:00 R6 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R6-GigabitEthernet0/0/0]int g0/0/1
[R6-GigabitEthernet0/0/1]ip add 172.16.1.13 30
May 11 2024 15:23:57-08:00 R6 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R6-GigabitEthernet0/0/1]int l0
[R6-LoopBack0]ip add 172.16.0.6 32
[R6-LoopBack0]int l1
[R6-LoopBack1]ip add 172.16.6.1 24
[R7]int g0/0/1
[R7-GigabitEthernet0/0/1]ip add 172.16.1.10 30
[R7-GigabitEthernet0/0/1]
May 11 2024 15:25:17-08:00 R7 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R7-GigabitEthernet0/0/1]int g0/0/0
[R7-GigabitEthernet0/0/0]ip add 172.16.1.14 30
May 11 2024 15:25:33-08:00 R7 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R7-GigabitEthernet0/0/0]int g0/0/2
[R7-GigabitEthernet0/0/2]ip add 34.1.1.1 24
May 11 2024 15:25:51-08:00 R7 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[R7-GigabitEthernet0/0/2]int l0
[R7-LoopBack0]ip add 172.16.0.7 32
[R7-LoopBack0]int l1
[R7-LoopBack1]ip add 172.16.7.1 24
[R8]int g0/0/0
[R8-GigabitEthernet0/0/0]ip add 34.1.1.2 24
May 11 2024 15:27:49-08:00 R8 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R8-GigabitEthernet0/0/0]int l0
[R8-LoopBack0]ip add 172.16.0.8 32
[R8-LoopBack0]int l1
[R8-LoopBack1]ip add 172.168.2.1 24
配置ospf:
[R2]ospf 1 ro
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]a 0
[R2-ospf-1-area-0.0.0.0]
[R2-ospf-1-area-0.0.0.0]ne
[R2-ospf-1-area-0.0.0.0]network 172.16.0.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]ne
[R2-ospf-1-area-0.0.0.0]network 172.16.1.21 0.0.0.0
[R2-ospf-1-area-0.0.0.0]ne 172.16.1.1 0.0.0.0
[R3]ospf 1 ro
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]
[R3-ospf-1-area-0.0.0.0]ne 0.0.0.0 255.255.255.255
[R4]ospf 1 ro
[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]a 0
[R4-ospf-1-area-0.0.0.0]
[R4-ospf-1-area-0.0.0.0]ne
[R4-ospf-1-area-0.0.0.0]network 0.0.0.0 255.255.255.255
[R5]ospf 1 ro
[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.0.5 0.0.0.0
[R5-ospf-1-area-0.0.0.0]network 172.16.1.17 0.0.0.0
[R5-ospf-1-area-0.0.0.0]network 172.16.1.22 0.0.0.0
[R6]ospf 1 ro
[R6]ospf 1 router-id 6.6.6.6
[R6-ospf-1]a 0
[R6-ospf-1-area-0.0.0.0]
[R6-ospf-1-area-0.0.0.0]ne 0.0.0.0 255.255.255.255
[R7]ospf 1 ro
[R7]ospf 1 router-id 7.7.7.7
[R7-ospf-1]a 0
[R7-ospf-1-area-0.0.0.0]
[R7-ospf-1-area-0.0.0.0]ne 172.16.1.14 0.0.0.0
[R7-ospf-1-area-0.0.0.0]ne 172.16.1.10 0.0.0.0
[R7-ospf-1-area-0.0.0.0]ne 172.16.7.0 0.0.0.255
[R7-ospf-1-area-0.0.0.0]ne 172.16.0.7 0.0.0.0
配置BGP:
[R2]bgp 64512
[R2-bgp]co
[R2-bgp]confederation id 2
[R2-bgp]confederation p
[R2-bgp]confederation peer-as 64513
[R2-bgp]peer 12.1.1.1 as-number 1
[R2-bgp]pe
[R2-bgp]peer 172.16.0.3
May 11 2024 16:33:06-08:00 R2 %%01BGP/3/STATE_CHG_UPDOWN(l)[0]:The status of the
peer 12.1.1.1 changed from OPENCONFIRM to ESTABLISHED. (InstanceName=Public, St
ateChangeReason=Up)
[R2-bgp]peer 172.16.0.3 a
[R2-bgp]peer 172.16.0.3 advertise-community
[R2-bgp]peer 172.16.0.3 advertise-ext-community
[R2-bgp]peer 172.16.0.3 allow-as-loop
[R2-bgp]peer 172.16.0.3 as-number 64512
[R2-bgp]peer 172.16.0.3 c
[R2-bgp]peer 172.16.0.3 connect-interface l0
[R2-bgp]peer 172.16.0.3 n
[R2-bgp]peer 172.16.0.3 next-hop-local
[R3]bgp 64512
[R3-bgp]con
[R3-bgp]confederation id 2
[R3-bgp]peer 172.16.0.2 as
[R3-bgp]peer 172.16.0.2 as-number 64512
[R3-bgp]peer 172.16.0.2 con
[R3-bgp]peer 172.16.0.2 connect-interface l0
[R3-bgp]peer 172.16.0.4 as-number 64512
[R3-bgp]peer 172.16.0.2 connect-interface l0
[R4]bgp 64512
[R4-bgp]con
[R4-bgp]confederation id 2
[R4-bgp]pe
[R4-bgp]peer 172.16.0.3 as
[R4-bgp]peer 172.16.0.3 as-number 64512
[R4-bgp]peer 172.16.0.3 con
[R4-bgp]peer 172.16.0.3 connect-interface l0
[R5]bgp 64513
[R5-bgp]con
[R5-bgp]confederation id 2
[R5-bgp]confederation peer-as 64512
[R5-bgp]pe
[R5-bgp]peer 172.16.0.2 as
[R5-bgp]peer 172.16.0.2 as-number 64512
[R5-bgp]peer 172.16.0.2 con
[R5-bgp]peer 172.16.0.2 connect-interface l0
[R5-bgp]peer 172.16.0.2 ne
[R5-bgp]peer 172.16.0.2 next-hop-local
[R5-bgp]peer 172.16.0.6 as
[R5-bgp]peer 172.16.0.6 as-number 64513
[R5-bgp]peer 172.16.0.6 con
[R5-bgp]peer 172.16.0.6 connect-interface l0
[R5-bgp]peer 172.16.0.6 con
[R5-bgp]peer 172.16.0.6 ne
[R5-bgp]peer 172.16.0.6 next-hop-local
[R6]bgp 64513
[R6-bgp]con
[R6-bgp]confederation id 2
[R6-bgp]pe
[R6-bgp]peer 172.16.0.2 as
[R6-bgp]peer 172.16.0.5 as-number 64513
[R6-bgp]peer 172.16.0.5 con
[R6-bgp]peer 172.16.0.5 connect-interface l0
[R6-bgp]peer 172.16.0.7 as
[R6-bgp]peer 172.16.0.7 as-number 64513
[R6-bgp]peer 172.16.0.7 con
[R6-bgp]peer 172.16.0.7 connect-interface
[R6-bgp]peer 172.16.0.7 connect-interface l0
[R7]bgp 64513
[R7-bgp]con
[R7-bgp]confederation id 2
[R7-bgp]con
[R7-bgp]confederation p
[R7-bgp]confederation peer-as 64512
[R7-bgp]p
[R7-bgp]peer 172.16.0.6 as
[R7-bgp]peer 172.16.0.6 as-path-filter
[R7-bgp]peer 172.16.0.6 as-number 64513
[R7-bgp]peer 172.16.0.6 con
[R7-bgp]peer 172.16.0.6 connect-interface l0
[R7-bgp]peer 172.16.0.6 ne
[R7-bgp]peer 172.16.0.6 next-hop-invariable
[R7-bgp]peer 172.16.0.6 next-hop-local
[R7-bgp]pe
[R7-bgp]peer 34.1.1.2 24
May 11 2024 16:55:10-08:00 R7 %%01BGP/3/STATE_CHG_UPDOWN(l)[0]:The status of the
peer 172.16.0.6 changed from OPENCONFIRM to ESTABLISHED. (InstanceName=Public,
StateChangeReason=Up)
[R7-bgp]peer 34.1.1.2 24 as
[R7-bgp]peer 34.1.1.2 as
[R7-bgp]peer 34.1.1.2 as-number 3
bgp邻居表
宣告R1,R8环回:
在R3和R6上设置反射器
查看bgp表
测试:
宣告业务网段:
[R4]bgp 64512
[R4-bgp]ne
[R4-bgp]network 172.16.4.0 24
[R3-bgp]ne 172.16.3.0 24
[R5]bgp 64513
[R5-bgp]ne 172.16.5.0 24
[R6-bgp]network 172.16.6.0 24
[R7]bgp 64513
[R7-bgp]ne 172.16.7.0 24
链路聚合:
[R3-bgp]aggregate 172.16.0.0 16 detail-suppressed
[R4-bgp]aggregate 172.16.0.0 16 detail-suppressed
[R5-bgp]aggregate 172.16.0.0 16 detail-suppressed
[R6-bgp]aggregate 172.16.0.0 16 detail-suppressed
[R7-bgp]aggregate 172.16.0.0 16 detail-suppressed
防环:
[R3]ip route-static 172.16.0.0 16 NULL 0
[R4]ip route-static 172.16.0.0 16 NULL 0
[R5]ip route-static 172.16.0.0 16 NULL 0
[R6]ip route-static 172.16.0.0 16 NULL 0
[R7]ip route-static 172.16.0.0 16 NULL 0
使用隧道:
[R1]int t 0/0/0
[R1-Tunnel0/0/0]ip add 10.1.1.1 24
[R1-Tunnel0/0/0]tunnel-protocol gre
[R1-Tunnel0/0/0]so
[R1-Tunnel0/0/0]source 172.16.0.1
[R1-Tunnel0/0/0]d
[R1-Tunnel0/0/0]ddns
[R1-Tunnel0/0/0]description 172.16.0.8
[R1-Tunnel0/0/0]
[R8]int t 0/0/0
[R8-Tunnel0/0/0]ip add 10.1.1.2 24
[R8-Tunnel0/0/0]tunnel-protocol gre
[R8-Tunnel0/0/0]so
[R8-Tunnel0/0/0]source 172.16.0.8 24
[R8-Tunnel0/0/0]source 172.16.0.8
[R8-Tunnel0/0/0]description 172.16.0.1
[R8]ip route-static 192.168.1.0 24 10.1.1.1
[R1]ip route-static 192.168.2.0 24 10.1.1.2