要求
1.搭建toop
2.地址规划
路由器 | AS | 接口地址 |
R1 | 1 | loop0:1.1.1.1 24 loop1 : 192.168.1.1 24 g0/0/0 12.0.0.1 24 |
R2 | 2 64512 | g0/0/0: 12.0.0.2 24 g/0/01: 172.16.0.2 19 g0/0/2: 172.16.96.2 19 |
R3 | 2 64512 | g0/0/0: 172.16.0.3 19 g0/0/1:172.16.32.3 19 |
R4 | 2 64512 | g0/0/0: 172.16.32.4 19 g0/0/1:172.16.64.4 19 |
R5 | 2 64513 | g0/0/0 :172.16.96.5 19 g0/0/1:172.16.128.5 19 |
R6 | 2 64513 | g0/0/0:172.16.128.6 19 g0/0/1 :172.16.160.6 19 |
R7 | 2 64513 | g0/0/0:172.16.160.7 19 g0/0/1 172.16.64.7 19 g0/0/2:78.0.0.7 24 |
R8 | 3 | g0/0/0 78.0.0.8 24 loop0:192.168.2.1 24 loop0:8.8.8.8 24 |
3.IP地址配置
ip配置都很熟悉了这里就不一一展示了
4.IGP配置
AS2使用ospf做IGP
R2
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 12.0.0.0 0.0.0.255
[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]network 172.16.94.2 0.0.0.0
R3
[R3]ospf 1 router-id 2.2.2.2
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 172.16.0.3 0.0.0.0
[R3-ospf-1-area-0.0.0.0]network 172.16.32.3 0.0.0.0
R4
[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]network 172.16.32.4 0.0.0.0
[R4-ospf-1-area-0.0.0.0]network 172.16.64.4 0.0.0.0
后面的配置一样
5.BGP配置
这里用直连接口建邻
AR 2 区域用联邦防止IGP的水平分割
R1
[R1]BGP 1
[R1-bgp]router-id 1.1.1.1
[R1-bgp]peer 12.0.0.2 as-number 2
R2
[R2]bgp 64512
[R2-bgp]router-id 2.2.2.2
[R2-bgp]confederation id 2
[R2-bgp]peer 12.0.0.1 as-number 1
[R2-bgp]peer 172.16.0.3 as-number 64512
[R2-bgp]peer 172.16.0.3 next-hop-local
[R2-bgp]confederation peer-as 64513
[R2-bgp]peer 172.16.96.5 as-number 64513
R3
[R3]bgp 64512
[R3-bgp]router-id 3.3.3.3
[R3-bgp]confederation id 2
[R3-bgp]peer 172.16.0.2 as-number 64512
[R3-bgp]peer 172.16.0.2 next-hop-local //修改下一跳
[R3-bgp]peer 172.16.0.2 reflect-client //用反射器解决IGP水平分割
[R3-bgp]peer 172.16.32.4 as-number 64512
[R3-bgp]peer 172.16.32.4 next-hop-local
[R3-bgp]peer 172.16.32.4 reflect-client
R4
[R4]bgp 64512
[R4-bgp]router-id 4.4.4.4
[R4-bgp]confederation id 2
[R4-bgp]peer 172.16.32.3 as-number 64512
[R4-bgp]peer 172.16.32.3 next-hop-local
[R4-bgp]confederation peer-as 64513
[R4-bgp]peer 172.16.64.7 as-number 64513
R5
[R5]bgp 64513
[R5-bgp]router-id 5.5.5.5
[R5-bgp]confederation id 2
[R5-bgp]peer 172.16.128.6 as-number 64513
[R5-bgp]peer 172.16.128.6 next-hop-local
[R5-bgp]confederation peer-as 64512
[R5-bgp]peer 172.16.96.2 as-number 64512
R6
[R6]bgp 64513
[R6-bgp]router-id 6.6.6.6
[R6-bgp]confederation id 2
[R6-bgp]peer 172.16.128.5 as-number 64513
[R6-bgp]peer 172.16.128.5 next-hop-local
[R6-bgp]peer 172.16.128.5 reflect-client
[R6-bgp]peer 172.16.160.7 as-number 64513
[R6-bgp]peer 172.16.160.7 next-hop-local
[R6-bgp]peer 172.16.160.7 reflect-client
R7
[R7]bgp 64513
[R7-bgp]router-id 7.7.7.7
[R7-bgp]confederation id 2
[R7-bgp]peer 78.0.0.8 as-number 3
[R7-bgp]peer 172.16.160.6 as-number 64513
[R7-bgp]peer 172.16.160.6 next-hop-local
[R7-bgp]confederation peer-as 64512
[R7-bgp]peer 172.16.64.4 as-number 64512
R8
[R8]bgp 3
[R8-bgp]router-id 8.8.8.8
[R8-bgp]peer 78.0.0.7 as-number 2
5.bgp 通讯
通过重发布
[R2]ip route-static 172.16.0.0 16 NULL 0 // 防环
[R7-bgp]import-route ospf 1
[R7-bgp]aggregate 172.16.0.0 16 detail-suppressed as-set
[R7]ip route-static 172.16.0.0 16 NULL 0
6.GRE实现环回通信
[R1]interface Tunnel 0/0/0
[R1-Tunnel0/0/0]tunnel-protocol gre
[R1-Tunnel0/0/0]ip add 10.0.0.1 24
[R1-Tunnel0/0/0]source 12.0.0.1
[R1-Tunnel0/0/0]destination 78.0.0.8
[R1]ip route-static 192.168.2.0 24 Tunnel 0/0/0
[R1]ip route-static 8.8.8.0 24 Tunnel 0/0/0
[R8]int Tunnel 0/0/0
[R8-Tunnel0/0/0]tunnel-protocol gre
[R8-Tunnel0/0/0]ip add 10.0.0.8 24
[R8-Tunnel0/0/0]source 78.0.0.8
[R8-Tunnel0/0/0]destination 12.0.0.1
[R8]ip route-static 1.1.1.0 24 Tunnel 0/0/0
[R8]ip route-static 192.168.1.0 24 Tunnel 0/0/0
7.测试