ip规划
ip
在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
修改用户网段的工作方式
[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同
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
宣告BGP
[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
条件的打破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
宣告AS2内部的路由条目,我们可以在R2和R5上做一条空接口防环路由,然后再宣告这条路由
[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