根据题目,我们先给每个路由器配上ip。如图:
配好了之后进行如下操作
[r2-GigabitEthernet0/0/1]ospf network-type broadcast
[r3-GigabitEthernet0/0/1]ospf network-type broadcast
[r4-GigabitEthernet0/0/1]ospf network-type broadcast
[r5-GigabitEthernet0/0/1]ospf network-type broadcast
[r6-GigabitEthernet0/0/1]ospf network-type broadcast
[r7-GigabitEthernet0/0/1]ospf network-type broadcast
然后 再在R2到R7上进行ospf宣告,因为都是从一个网段划分出来的,所以进行汇总即可,
network 172.16.0.0 0.0.255.255
接下来进行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.3 as-number 64512
[r2-bgp]peer 172.16.1.3 connect-interface LoopBack 0
[r2-bgp]peer 172.16.1.5 as-number 64513
[r2-bgp]peer 172.16.1.5 ebgp-max-hop 2
[r2-bgp]peer 172.16.1.5 connect-interface LoopBack 0
[r3]bgp 64512
[r3-bgp]router-id 3.3.3.3
[r3-bgp]confederation id 2
[r3-bgp]peer 172.16.1.2 as-number 64512
[r3-bgp]peer 172.16.1.2 connect-interface LoopBack 0
[r3-bgp]peer 172.16.1.4 as-number 64512
[r3-bgp]peer 172.16.1.4 connect-interface LoopBack 0
[r3-bgp]peer 172.16.1.4 reflect-client
[r4]bgp 64512
[r4-bgp]rout
[r4-bgp]route-select
[r4-bgp]router-id 4.4.4.4
[r4-bgp]con
[r4-bgp]confederation ip
[r4-bgp]confederation ip 2
[r4-bgp]confederation id 2
[r4-bgp]confederation peer-as 64513
[r4-bgp]peer 172.16.1.3 as-number 64512
[r4-bgp]peer 172.16.1.3 connect-interface LoopBack 0
[r4-bgp]peer 172.16.1.7 as-number 64513
[r4-bgp]peer 172.16.1.7 ebgp-max-hop 2
[r4-bgp]peer 172.16.1.7 connect-interface LoopBack 0
[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.2 as-number 64512
[r5-bgp]peer 172.16.1.2 ebgp-max-hop 2
[r5-bgp]peer 172.16.1.2 connect-interface LoopBack 0
[r5-bgp]peer 172.16.1.6 as-number 64513
[r5-bgp]peer 172.16.1.6 connect-interface LoopBack 0
[r6]bgp 64513
[r6-bgp]router-id 6.6.6.6
[r6-bgp]confederation id 2
[r6-bgp]peer 172.16.1.5 as-number 64513
[r6-bgp]peer 172.16.1.5 connect-interface LoopBack 0
[r6-bgp]peer 172.16.1.7 as-number 64513
[r6-bgp]peer 172.16.1.7 connect-interface LoopBack 0
[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 78.1.1.2 as-number 3
[r7-bgp]peer 172.16.1.4 as-number 64512
[r7-bgp]peer 172.16.1.4 ebgp-max-hop 2
[r7-bgp]peer 172.16.1.6 as-number 64513
[r7-bgp]peer 172.16.1.6 connect-interface LoopBack 0
[r8]bgp 3
[r8-bgp]router-id 8.8.8.8
[r8-bgp]peer 78.1.1.1 as-number 2
8个路由器全部建邻完成,接下来开始进行R1和R8的环回接口宣告
[r1-bgp]network 1.1.1.0 24
[r8-bgp]network 8.8.8.0 24
之后,为了让每个路由器上都能优,所以要在r2和r7上做配置
[r2-bgp]peer 172.16.1.3 next-hop-local
[r2-bgp]peer 172.16.1.5 next-hop-local
[r7-bgp]peer 172.16.1.4 next-hop-local
[r7-bgp]peer 172.16.1.6 next-hop-local
此时,全网都能学习到R1和R8的环回
最后用R1的环回pingR8的环回,实验就完成了。