1,配置IP地址
配置IP地址基于172.16.0.0/16划分网段:
建邻:
R1:172.16.0.1/32
R2:172.16.0.2/32
R3:172.16.0.3/32
R4:172.16.0.4/32
R5:172.16.0.5/32
R6:172.16.0.6/32
R7:172.16.0.7/32
R8:172.16.0.8/32
骨干链路:
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
业务网段:
R1:192.168.1.0/24
R3:172.16.3.0/24
R4:172.16.4.0/24
R5:172.16.5.0/24
R6:172.16.6.0/24
R7:172.16.7.0/24
R8:192.168.2.0/24
R1:
[r1]dis ip interface brief
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 12.1.1.1/24 up up
LoopBack0 172.16.0.1/32 up up(s)
LoopBack1 192.168.1.1/24 up up(s)
R2:
[r2]dis ip interface brief
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 12.1.1.2/24 up up
GigabitEthernet0/0/1 172.16.1.1/30 up up
GigabitEthernet0/0/2 172.16.1.21/30 up up
LoopBack0 172.16.0.2/32 up up(s)
R3:
[r3]dis ip interface brief
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 172.16.1.2/30 up up
GigabitEthernet0/0/1 172.16.1.5/30 up up
LoopBack0 172.16.0.3/32 up up(s)
LoopBack1 172.16.3.3/24 up up(s)
R4:
[r4]dis ip interface b
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 172.16.1.6/30 up up
GigabitEthernet0/0/1 172.16.1.9/30 up up
LoopBack0 172.16.0.4/32 up up(s)
LoopBack1 172.16.4.4/24 up up(s)
R5:
[r5]dis ip interface brief
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 172.16.1.22/30 up up
GigabitEthernet0/0/1 172.16.1.17/30 up up
LoopBack0 172.16.0.5/32 up up(s)
LoopBack1 172.16.5.5/24 up up(s)
R6:
[r6]dis ip interface brief
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 172.16.1.18/30 up up
GigabitEthernet0/0/1 172.16.1.13/30 up up
LoopBack0 172.16.0.6/32 up up(s)
LoopBack1 172.16.6.6/24 up up(s)
[r7]dis ip interface brief
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 172.16.1.14/30 up up
GigabitEthernet0/0/1 172.16.1.10/30 up up
GigabitEthernet0/0/2 34.1.1.7/24 up up
LoopBack0 172.16.0.7/32 up up(s)
LoopBack1 172.16.7.7/24 up up(s)
[r8]dis ip interface brief
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 34.1.1.8/24 up up
LoopBack0 172.16.0.8/32 up up(s)
LoopBack1 192.168.2.8/24 up up(s)
2,OSPF实现AS内部信息互通
R2:
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]a 0
[r2-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]a 0
[r7-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.255.255
3,使用bgp协议使得整个网络所有设备互通
a,配置bgp协议
R1:
[r1]bgp 1
[r1-bgp]peer 12.1.1.2 as-number 2
R2:
[r2]bgp 64512
[r2-bgp]confederation id 2
[r2-bgp]confederation peer-as 64513
[r2-bgp]peer 12.1.1.1 as 1
[r2-bgp]peer 172.16.0.3 as 64512
[r2-bgp]peer 172.16.0.3 connect-interface l0
[r2-bgp]peer 172.16.0.3 next-hop-local
[r2-bgp]peer 172.16.1.22 as 64513
R3:
[r3]bgp 64512
[r3-bgp]confederation id 2
[r3-bgp]peer 172.16.0.2 as 64512
[r3-bgp]peer 172.16.0.2 connect-interface l0
[r3-bgp]peer 172.16.0.4 as 64512
[r3-bgp]peer 172.16.0.4 connect-interface l0
R4:
[r4]bgp 64512
[r4-bgp]confederation id 2
[r4-bgp]peer 172.16.0.3 as 64512
[r4-bgp]peer 172.16.0.3 connect-interface l0
[r4-bgp]confederation peer-as 64513
[r4-bgp]peer 172.16.1.10 as 64513
[r4-bgp]peer 172.16.1.10 next-hop-local
R5:
[r5]bgp 64513
[r5-bgp]confederation id 2
[r5-bgp]confederation peer-as 64512
[r5-bgp]peer 172.16.1.21 as 64512
[r5-bgp]peer 172.16.0.6 as 64513
[r5-bgp]peer 172.16.0.6 connect-interface l0
[r5-bgp]peer 172.16.0.6 next-hop-local
R6:
[r6]bgp 64513
[r6-bgp]confederation id 2
[r6-bgp]peer 172.16.0.7 as 64513
[r6-bgp]peer 172.16.0.7 connect-interface l0
[r6-bgp]peer 172.16.0.7 next-hop-local
[r6-bgp]peer 172.16.0.5 as 64513
[r6-bgp]peer 172.16.0.5 connect-interface l0
R7:
[r7]bgp 64513
[r7-bgp]confederation id 2
[r7-bgp]confederation peer-as 64512
[r7-bgp]peer 172.16.1.9 as 64512
[r7-bgp]peer 172.16.0.6 as 64513
[r7-bgp]peer 172.16.0.6 connect-interface l0
[r7-bgp]peer 172.16.0.6 next-hop-local
[r7-bgp]peer 34.1.1.8 as-number 3
R8:
[r8]bgp 3
[r8-bgp]peer 34.1.1.7 as-number 2
b,用反射器解决水平分割问题
R3,R6作为反射器
R3:
[r3]bgp 64512
[r3-bgp]peer 172.16.0.2 reflect-client
[r3-bgp]peer 172.16.0.4 reflect-client
[r3-bgp]reflector cluster-id 2001
R6:
[r6]bgp 64513
[r6-bgp]peer 172.16.0.5 reflect-client
[r6-bgp]peer 172.16.0.7 reflect-client
[r6-bgp]reflector cluster-id 2002
c,宣告环回网段到bgp
R1:
[r1]bgp 1
[r1-bgp]network 172.16.0.1 16
R2:
[r2]ip route-static 172.16.0.0 16 NULL 0
[r2]bgp 64512
[r2-bgp]network 172.16.0.0 16
R7:
[r7]ip route-static 172.16.0.0 16 NULL 0
[r7]bgp 64513
[r7-bgp]network 172.16.0.0 16
R8:
[r8]bgp 3
[r8-bgp]network 172.16.0.8 16
d,构建隧道使得R1和R8的业务网段能被访问
[r1]int t 0/0/0
[r1-Tunnel0/0/0]ip address 10.1.1.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre
[r1-Tunnel0/0/0]source 172.16.0.1
[r1-Tunnel0/0/0]destination 172.16.0.8
[r1]ip route-static 192.168.2.0 24 10.1.1.2
[r8]int t 0/0/0
[r8-Tunnel0/0/0]ip address 10.1.1.2 24
[r8-Tunnel0/0/0]tunnel-protocol gre
[r8-Tunnel0/0/0]source 172.16.0.8
[r8-Tunnel0/0/0]destination 172.16.0.1
[r8]ip route-static 192.168.1.0 24 10.1.1.1