第一步:配置IP
第二步:写ospf
在R2,R3,R4,R5,R6,R7上分别配置ospf
如:R2
[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
[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
[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
[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
[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
[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
第三步:进行BGP配置,并进行建邻操作
R1
[R1]bgp 100
[R1-bgp]route-select
[R1-bgp]router-id 1.1.1.1
[R1-bgp]peer 12.0.0.2 as-number 200
R2
[R2]bgp 64512
[R2-bgp]router-id 2.2.2.2
[R2-bgp]confederation id 200
[R2-bgp]peer 12.0.0.1 as-number 100[R2-bgp]peer 12.0.0.1 ebgp-max-hop 2
[R2-bgp]peer 172.16.3.1 as-number 64512
[R2-bgp]peer 172.16.3.1 connect-interface l
[R2-bgp]peer 172.16.3.1 connect-interface LoopBack 0
R3
[R3]bgp 64512
[R3-bgp]router-id 3.3.3.3
[R3-bgp]peer 172.16.2.1 as-number 64512
[R3-bgp]peer 172.16.2.1 connect-interface LoopBack 0
[R3-bgp]peer 172.16.4.1 as-number 64512
[R3-bgp]peer 172.16.4.1 connect-interface LoopBack 0
R4
[R4]bgp 64512
[R4-bgp]confederation id 200
[R4-bgp]router-id 4.4.4.4
[R4-bgp]peer 172.16.3.1 as-number 64512
[R4-bgp]peer 172.16.3.1 connect-interface LoopBack 0
R5
[R5]bgp 64513
[R5-bgp]confederation id 200
[R5-bgp]router-id 5.5.5.5
[R5-bgp]peer 172.16.6.1 as-number 64513
[R5-bgp]peer 172.16.6.1 connect-interface LoopBack 0
R6
[R6]bgp 64513
[R6-bgp]confederation id 200
[R6-bgp]router-id 6.6.6.6
[R6-bgp]peer 172.16.5.1 as-number 64513
[R6-bgp]peer 172.16.5.1 connect-interface LoopBack 0
[R6-bgp]peer 172.16.7.1 as-number 64513
[R6-bgp]peer 172.16.7.1 connect-interface LoopBack 0
R7
[R7]bgp 64513
[R7-bgp]confederation id 200
[R7-bgp]router-id 7.7.7.7
[R7-bgp]peer 78.0.0.2 as-number 300
[R7-bgp]peer 172.16.6.1 as-number 64513
[R7-bgp]peer 172.16.6.1 connect-interface LoopBack 0
R8
[R8]bgp 300
[R8-bgp]router-id 8.8.8.8
[R8-bgp]peer 78.0.0.1 as-number 200
第四步:AS2内部进行AS联邦配置
R2
[R2]bgp 64512
[R2-bgp]confederation peer-as 64513
[R2-bgp]peer 172.16.5.1 as-number 64513
[R2-bgp]peer 172.16.5.1 connect-interface LoopBack 0
[R2-bgp]peer 172.16.5.1 ebgp-max-hop 2
R4
[R4]bgp 64512
[R4-bgp]confederation peer-as 64513
[R4-bgp]peer 172.16.7.1 as-number 64513
[R4-bgp]peer 172.16.7.1 connect-interface LoopBack 0
[R4-bgp]peer 172.16.7.1 ebgp-max-hop 2
R5
[R5]bgp 64513
[R5-bgp]confederation peer-as 64512
[R5-bgp]peer 172.16.2.1 as-number 64512
[R5-bgp]peer 172.16.2.1 connect-interface LoopBack 0
[R5-bgp]peer 172.16.2.1 ebgp-max-hop 2
R7
[R7]bgp 64513
[R7-bgp]confederation peer-as 64512
[R7-bgp]peer 172.16.4.1 as-number 64512
[R7-bgp]peer 172.16.4.1 connect-interface LoopBack 0
[R7-bgp]peer 172.16.4.1 ebgp-max-hop 2
第五步:宣告10.0.0.0/24和11.0.0.0/24网段,以及修改在R2和R7上传输给AS 2内部的对等体的下一跳属性,并指定为自己与对等体的连接地址
[R1]bgp 100
[R1-bgp]network 10.0.0.0 24[R8]bgp 300
[R8-bgp]network 11.0.0.0 24
[R2]bgp 64512
[R2-bgp]peer 172.16.3.1 next-hop-local
[R2-bgp]peer 172.16.5.1 next-hop-local
[R7]bgp 64513
[R7-bgp]peer 172.16.4.1 next-hop-local
[R7-bgp]peer 172.16.6.1 next-hop-local
第六步:指定R3和R6为路由反射器,并将R2和R7分别定为R3和R6的客户
R3
[R3]bgp 64512
[R3-bgp]peer 172.16.2.1 reflect-client
R6
[R6]bgp 64513
[R6-bgp]peer 172.16.7.1 reflect-client
第七步:对AS 2区域内的路由进行聚合,并配置空接口
[R2]ip route-static 172.16.0.0 16 NULL 0
[R2-bgp]network 172.16.0.0 16
[R7]ip route-static 172.16.0.0 16 NULL 0
[R7]bgp 64513
[R7-bgp]network 172.16.0.0 16
第八步:在R2和R7上宣告其他AS区域的网段,使得全网可达
[R2]bgp 64512
[R2-bgp]network 12.0.0.0 24[R7]bgp 64513
[R7-bgp]network 78.0.0.0 24