实验要求:
1.R2-R7每台路由器均存在一个环回接口用于建立邻居,同时还存在一个环回来代表连接用户的接口,最终这些连接用户的接口网络需要可以和R1和R8的环回通讯
2.AS2网段地址172.16.0.0/16 减少路由条目数量
实验步骤:
1.拓扑搭建
2.IP地址规划
172.16.0.0/16
172.16.0.0/24
172.16.0.0/27 172.16.0.32/27 172.16.0.64/27 172.16.0.96/27
172.16.0.128/27 172.16.0.160/27 骨干网段
172.16.1.0/24 6个建邻环回
172.16.1.0/30 172.16.1.4/30 172.16.1.8/30
172.16.1.12/30 172.16.1.16/30 172.16.1.20/30
172.16.2.0/24 172.16.3.0/24 172.16.4.0/24 6个用户环回
172.16.5.0/24 172.16.6.0/24 172.16.7.0/24
3.在AS2区域启动OSPF
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.255.255
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.255.255
[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.0.0 0.0.255.255
[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]area 0
[r5-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.255.255
[r6]ospf 1 router-id 6.6.6.6
[r6-ospf-1]area 0
[r6-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.255.255
[r7]ospf 1 router-id 7.7.7.7
[r7-ospf-1]area 0
[r7-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.255.255
4.修改用户网段的工作方式
[r1]int lo0
[r1-LoopBack0]ospf network-type broadcast
[r2]int lo0
[r2-LoopBack0]ospf network-type broadcast
[r2-LoopBack0]int lo1
[r2-LoopBack1]ospf network-type broadcast
同理R3/4/5/6/7/8
5.配置BGP协议
[r1]bgp 1
[r1-bgp]router-id 1.1.1.1
[r1-bgp]peer 12.1.1.2 as-number 2
[r2]bgp 64512
[r2-bgp]router-id 2.2.2.2
[r2-bgp]confederation id 2
[r2-bgp]confederation peer-as 64513
[r2-bgp]peer 12.1.1.1 as-number 1
[r2-bgp]peer 172.16.1.5 as-number 64512
[r2-bgp]peer 172.16.1.5 connect-interface LoopBack 1
[r2-bgp]peer 172.16.1.13 as-number 64513
[r2-bgp]peer 172.16.1.13 connect-interface LoopBack 1
[r2-bgp]peer 172.16.1.13 ebgp-max-hop 2
//邻居间存在多条物理链路时,一旦使用环回建立ebgp邻居关系,必须修改TTL值,否则无法建立
[r3]bgp 64512
[r3-bgp]router-id 3.3.3.3
[r3-bgp]confederation id 2
[r3-bgp]peer 172.16.1.1 as-number 64512
[r3-bgp]peer 172.16.1.1 connect-interface LoopBack 1
[r3-bgp]peer 172.16.1.9 as-number 64512
[r3-bgp]peer 172.16.1.9 connect-interface LoopBack 1
[r3]bgp 64512
[r3-bgp]router-id 3.3.3.3
[r3-bgp]confederation id 2
[r3-bgp]confederation peer-as 64513
[r3-bgp]peer 172.16.1.1 as-number 64512
[r3-bgp]peer 172.16.1.1 connect-interface LoopBack 1
[r3-bgp]peer 172.16.1.9 as-number 64512
[r3-bgp]peer 172.16.1.9 connect-interface LoopBack 1
[r4]bgp 64512
[r4-bgp]router-id 4.4.4.4
[r4-bgp]confederation id 2
[r4-bgp]confederation peer-as 64513
[r4-bgp]peer 172.16.1.5 as-number 64512
[r4-bgp]peer 172.16.1.5 connect-interface LoopBack 1
[r4-bgp]peer 172.16.1.21 as-number 64513
[r4-bgp]peer 172.16.1.21 connect-interface LoopBack 1
[r4-bgp]peer 172.16.1.21 ebgp-max-hop 2
[r5]bgp 64513
[r5-bgp]router-id 5.5.5.5
[r5-bgp]confederation id 2
[r5-bgp]confederation peer-as 64512
[r5-bgp]peer 172.16.1.17 as-number 64513
[r5-bgp]peer 172.16.1.17 connect-interface LoopBack 1
[r5-bgp]peer 172.16.1.1 as-number 64512
[r5-bgp]peer 172.16.1.1 connect-interface LoopBack 1
[r5-bgp]peer 172.16.1.1 ebgp-max-hop 2
[r6]bgp 64513
[r6-bgp]router-id 6.6.6.6
[r6-bgp]confederation id 2
[r6-bgp]peer 172.16.1.21 as-number 64513
[r6-bgp]peer 172.16.1.21 connect-interface LoopBack 1
[r6-bgp]peer 172.16.1.13 as-number 64513
[r6-bgp]peer 172.16.1.13 connect-interface LoopBack 1
[r7]bgp 64513
[r7-bgp]router-id 7.7.7.7
[r7-bgp]confederation id 2
[r7-bgp]confederation peer-as 64512
[r7-bgp]peer 172.16.1.17 as-number 64513
[r7-bgp]peer 172.16.1.17 connect-interface LoopBack 1
[r7-bgp]peer 172.16.1.9 as-number 64512
[r7-bgp]peer 172.16.1.9 connect-interface LoopBack 1
[r7-bgp]peer 172.16.1.9 ebgp-max-hop 2
[r7-bgp]peer 78.1.1.2 as-number 3
[r8]bgp 3
[r8-bgp]router-id 8.8.8.8
[r8-bgp]peer 78.1.1.1 as-number 2
[r1]bgp 1
[r1-bgp]net
[r1-bgp]network 1.1.1.0 24
[r8]bgp 3
[r8-bgp]net
[r8-bgp]network 8.8.8.0 24
6.有条件的打破IBGP水平分割
[r3]bgp 64512
[r3-bgp]peer 172.16.1.1 reflect-client
[r6]bgp 64513
[r6-bgp]peer 172.16.1.21 reflect-client
[r2-bgp]peer 172.16.1.13 next-hop-local
[r2-bgp]peer 172.16.1.5 next-hop-local
[r7-bgp]peer 172.16.1.9 next-hop-local
[r7-bgp]peer 172.16.1.17next-hop-local
7.宣告AS2内部的路由条目
[r2]ip route-static 172.16.0.0 21 NULL 0
[r2-bgp]network 172.16.0.0 21
[r7]ip route-static 172.16.0.0 21 NULL 0
[r7-bgp]network 172.16.0.0 21
8.实验验证