题目
实验步骤
一.配置IP地址
[AR1]int g0/0/0
[AR1-GigabitEthernet0/0/0]ip add 12.1.1.1 24
[AR1-GigabitEthernet0/0/0]int l0
[AR1-LoopBack0]ip add 1.1.1.1 32
[AR1-LoopBack0]int l1
[AR1-LoopBack1]ip add 192.168.1.1 24
[AR2]int g0/0/0
[AR2-GigabitEthernet0/0/0]ip add 12.1.1.2 24
[AR2-GigabitEthernet0/0/0]int l0
[AR2-LoopBack0]ip add 2.2.2.2 32
[AR2-LoopBack0]int g0/0/1
[AR2-GigabitEthernet0/0/1]ip add 172.16.1.1 30
[AR2-GigabitEthernet0/0/1]int g0/0/2
[AR2-GigabitEthernet0/0/2]ip add 172.16.1.21 30
[AR3]int g0/0/0
[AR3-GigabitEthernet0/0/0]ip add 172.16.1.2 30
[AR3-GigabitEthernet0/0/0]int g0/0/1
[AR3-GigabitEthernet0/0/1]ip add 172.16.1.5 30
[AR3-GigabitEthernet0/0/1]int l0
[AR3-LoopBack0]ip add 3.3.3.3 32
[AR3-LoopBack0]int l1
[AR3-LoopBack1]ip add 172.16.3.3 24
[AR4]int g0/0/0
[AR4-GigabitEthernet0/0/0]ip add 172.16.1.6 30
[AR4-GigabitEthernet0/0/0]int g0/0/1
[AR4-GigabitEthernet0/0/1]ip add 172.16.1.9 30
[AR4-GigabitEthernet0/0/1]int l0
[AR4-LoopBack0]ip add 4.4.4.4 32
[AR4-LoopBack0]int l1
[AR4-LoopBack1]ip add 172.16.4.4 24
[AR5]int g0/0/0
[AR5-GigabitEthernet0/0/0]ip add 172.16.1.22 30
[AR5-GigabitEthernet0/0/0]int g0/0/1
[AR5-GigabitEthernet0/0/1]ip add 172.16.1.17 30
[AR5-GigabitEthernet0/0/1]int l0
[AR5-LoopBack0]ip add 5.5.5.5 32
[AR5-LoopBack0]int l1
[AR5-LoopBack1]ip add 172.16.5.5 24
[AR6]int g0/0/0
[AR6-GigabitEthernet0/0/0]ip add 172.16.1.18 30
[AR6-GigabitEthernet0/0/0]int g0/0/1
[AR6-GigabitEthernet0/0/1]ip add 172.16.1.13 30
[AR6-GigabitEthernet0/0/1]int l0
[AR6-LoopBack0]ip add 6.6.6.6 32
[AR6-LoopBack0]int l1
[AR6-LoopBack1]ip add 172.16.6.6 24
[AR7]int g0/0/0
[AR7-GigabitEthernet0/0/0]ip add 172.16.1.14 30
[AR7-GigabitEthernet0/0/0]int g0/0/1
[AR7-GigabitEthernet0/0/1]ip add 172.16.1.10 30
[AR7-GigabitEthernet0/0/1]int g0/0/2
[AR7-GigabitEthernet0/0/2]ip add 34.1.1.7 24
[AR7-GigabitEthernet0/0/2]int l0
[AR7-LoopBack0]ip add 7.7.7.7 32
[AR7-LoopBack0]int l1
[AR7-LoopBack1]ip add 172.16.7.7 24
[AR8]int g0/0/0
[AR8-GigabitEthernet0/0/0]ip add 34.1.1.8 24
[AR8-GigabitEthernet0/0/0]int l0
[AR8-LoopBack0]ip add 8.8.8.8 32
[AR8-LoopBack0]int l1
[AR8-LoopBack1]ip add 192.168.2.8 24
二.AS2中OSPF配置
[AR2]ospf 1 router-id 2.2.2.2
[AR2-ospf-1]a 0
[AR2-ospf-1-area-0.0.0.0]net 2.2.2.2 0.0.0.0
[AR2-ospf-1-area-0.0.0.0]net 172.16.0.0 0.0.255.255
[AR3]ospf 1 router-id 3.3.3.3
[AR3-ospf-1]a 0
[AR3-ospf-1-area-0.0.0.0]network 0.0.0.0 255.255.255.255
[AR4]ospf 1 router-id 4.4.4.4
[AR4-ospf-1]a 0
[AR4-ospf-1-area-0.0.0.0]net 0.0.0.0 255.255.255.255
[AR5]ospf 1 router-id 5.5.5.5
[AR5-ospf-1]a 0
[AR5-ospf-1-area-0.0.0.0]network 0.0.0.0 255.255.255.255
[AR6]ospf 1 router-id 6.6.6.6
[AR6-ospf-1]a 0
[AR6-ospf-1-area-0.0.0.0]net 0.0.0.0 255.255.255.255
[AR7]ospf 1 router-id 7.7.7.7
[AR7-ospf-1]a 0
[AR7-ospf-1-area-0.0.0.0]net 7.7.7.7 0.0.0.0
[AR7-ospf-1-area-0.0.0.0]net 172.16.0.0 0.0.255.255
实验现象
三.BGP建邻
[AR1]bgp 1
[AR1-bgp]router-id 1.1.1.1 # EBGP物理口建立邻居
[AR1-bgp]peer 12.1.1.2 as-number 2
[AR2]bgp 64512
[AR2-bgp]confederation id 2 # 联盟号
[AR2-bgp]confederation peer-as 64513 # 联盟同伴
[AR2-bgp]peer 12.1.1.1 as-number 1 # EBGP物理口建立邻居
[AR2-bgp]peer 3.3.3.3 as-number 64512 # IBGP 环回口建邻
[AR2-bgp]peer 3.3.3.3 connect-interface l0 # 修改更新源
[AR2-bgp]peer 3.3.3.3 next-hop-local # 更改本地下一跳
[AR3]bgp 64512
[AR3-bgp]confederation id 2
[AR3-bgp]peer 2.2.2.2 as-number 64512
[AR3-bgp]peer 4.4.4.4 as-number 64512
[AR3-bgp]peer 2.2.2.2 connect-interface l0
[AR3-bgp]peer 4.4.4.4 connect-interface l0
[AR4]bgp 64512
[AR4-bgp]confederation id 2
[AR4-bgp]peer 3.3.3.3 as-number 64512
[AR4-bgp]peer 3.3.3.3 connect-interface l0
[AR4-bgp]peer 3.3.3.3 next-hop-local
[AR4-bgp]peer 7.7.7.7 as-number 64513 # EBGP环回口建邻
[AR4-bgp]peer 7.7.7.7 connect-interface l0
[AR4-bgp]peer 7.7.7.7 next-hop-local
[AR4-bgp]peer 7.7.7.7 ebgp-max-hop 255 # 更改TTL值
[AR5]bgp 64513
[AR5-bgp]confederation id 2
[AR5-bgp]router-id 5.5.5.5
[AR5-bgp]peer 6.6.6.6 as-number 64513
[AR5-bgp]peer 6.6.6.6 connect-interface l0
[AR5-bgp]peer 6.6.6.6 next-hop-local
[AR6]bgp 64513
[AR6-bgp]confederation id 2
[AR6-bgp]peer 5.5.5.5 as-number 64513
[AR6-bgp]peer 7.7.7.7 as-number 64513
[AR6-bgp]peer 7.7.7.7 connect-interface l0
[AR6-bgp]peer 5.5.5.5 connect-interface l0
[AR7]bgp 64513
[AR7-bgp]confederation id 2
[AR7-bgp]peer 6.6.6.6 as-number 64513
[AR7-bgp]peer 6.6.6.6 connect-interface l0
[AR7-bgp]peer 6.6.6.6 next-hop-local
[AR7-bgp]peer 34.1.1.8 as-number 3
[AR7-bgp]peer 4.4.4.4 as-number 64512
[AR7-bgp]peer 4.4.4.4 connect-interface l0
[AR7-bgp]peer 4.4.4.4 next-hop-local
[AR7-bgp]peer 4.4.4.4 ebgp-max-hop 255
[AR8]bgp 3
[AR8-bgp]peer 34.1.1.7 as
[AR8-bgp]peer 34.1.1.7 as-number 2
四.反射路由
宣告路由进入BGP协议中
[AR1]bgp 1
[AR1-bgp]network 1.1.1.1 32
[AR8]bgp 3
[AR8-bgp]net 8.8.8.8 32
此时R3,R6为路由反射器;R4和R5作为反射客户端
[AR3]bgp 64512
[AR3-bgp]peer 4.4.4.4 reflect-client
[AR6]bgp 64513
[AR6-bgp]peer 5.5.5.5 reflect-client
检查是否互通
五.宣告BGP
使用BGP协议让整个网络所有设备的环回可以互相访问
[AR3-bgp]net 172.16.3.3 24
[AR4-bgp]net 172.16.4.4 24
[AR5-bgp]net 172.16.5.5 24
[AR6-bgp]net 172.16.6.6 24
[AR7-bgp]net 172.16.7.7 24
六.手工汇总
[AR3-bgp]aggregate 172.16.0.0 16 detail-suppressed
[AR4-bgp]aggregate 172.16.0.0 16 detail-suppressed
[AR5-bgp]aggregate 172.16.0.0 16 detail-suppressed
[AR6-bgp]aggregate 172.16.0.0 16 detail-suppressed
[AR7-bgp]aggregate 172.16.0.0 16 detail-suppressed
七.防环配置
[AR3]ip route-static 172.16.0.0 16 null 0
[AR4]ip route-static 172.16.0.0 16 null 0
[AR5]ip route-static 172.16.0.0 16 null 0
[AR6]ip route-static 172.16.0.0 16 null 0
[AR7]ip route-static 172.16.0.0 16 null 0
八.环回互通配置
使用VPN隧道实现R1、R8两个不能宣告的环回正常通讯
[AR1]int t0/0/0
[AR1-Tunnel0/0/0]ip add 10.1.1.1 24 # 隧道IP
[AR1-Tunnel0/0/0]tunnel-protocol gre
[AR1-Tunnel0/0/0]source 1.1.1.1 # 环回IP
[AR1-Tunnel0/0/0]destination 8.8.8.8
[AR1]ip route-static 192.168.2.0 24 10.1.1.2 # 静态路由
[AR8]int t0/0/0
[AR8-Tunnel0/0/0]ip add 100.1.1.2 24
[AR8-Tunnel0/0/0]tunnel-protocol gre
[AR8-Tunnel0/0/0]source 8.8.8.8
[AR8-Tunnel0/0/0]destination 1.1.1.1
[AR8]ip route-static 192.168.1.0 24 10.1.1.1
九.测试
[AR1]ping -a 172.16.0.1 172.16.0.8
PING 172.16.0.8: 56 data bytes, press CTRL_C to break
Reply from 172.16.0.8: bytes=56 Sequence=1 ttl=251 time=60 ms
Reply from 172.16.0.8: bytes=56 Sequence=2 ttl=251 time=40 ms
Reply from 172.16.0.8: bytes=56 Sequence=3 ttl=251 time=50 ms