1、配置ip地址及环回地址
R1:
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]ip add 65.0.0.1 24
[r1-GigabitEthernet0/0/0]int g 0/0/1
[r1-GigabitEthernet0/0/1]ip add 15.0.0.1 24
[r1-GigabitEthernet0/0/1]int l0
[r1-LoopBack0]ip add 192.168.1.1 24R2:
[ISP]int g 0/0/1
[ISP-GigabitEthernet0/0/1]ip add 15.0.0.2 24
[ISP-GigabitEthernet0/0/1]int g 0/0/0
[ISP-GigabitEthernet0/0/0]ip add 65.0.0.2 24
[ISP-GigabitEthernet0/0/0]int g 4/0/2
[ISP-GigabitEthernet4/0/2]ip add 25.0.0.2 24
[ISP-GigabitEthernet4/0/2]int g 4/0/1
[ISP-GigabitEthernet4/0/1]ip add 35.0.0.2 24
[ISP-GigabitEthernet4/0/1]int g 4/0/0
[ISP-GigabitEthernet4/0/0]ip add 45.0.0.2 24
[ISP-GigabitEthernet4/0/0]int g 0/0/2
[ISP-GigabitEthernet0/0/2]ip add 55.0.0.2 24R3:
[r3]int g 0/0/0
[r3-GigabitEthernet0/0/0]ip add 55.0.0.3 24
[r3-GigabitEthernet0/0/0]int l0
[r3-LoopBack0]ip add 192.168.5.3 24
R4:[r4]int g 0/0/0
[r4-GigabitEthernet0/0/0]ip add 45.0.0.4 24
[r4-GigabitEthernet0/0/0]int l0
[r4-LoopBack0]ip add 192.168.4.4 24
R5:[r5]int g 0/0/0
[r5-GigabitEthernet0/0/0]ip add 35.0.0.5 24
[r5-GigabitEthernet0/0/0]int l0
[r5-LoopBack0]ip add 192.168.3.5 24
R6:[r6]int g 0/0/0
[r6-GigabitEthernet0/0/0]ip add 25.0.0.6 24
[r6-GigabitEthernet0/0/0]int l0
[r6-LoopBack0]ip add 192.168.2.6 24
2、R1--R5配置指向ISP的缺省路由
[r1]ip rou 0.0.0.0 0 15.0.0.2
[r1]ip rou 0.0.0.0 0 65.0.0.2[r3]ip rou 0.0.0.0 0 55.0.0.2
[r4]ip rou 0.0.0.0 0 45.0.0.2[r5]ip rou 0.0.0.0 0 35.0.0.2
[r6]ip rou 0.0.0.0 0 25.0.0.2
3、R1/3/4为全连的MGRE结构,R1/5/6建立hub-spoke的MGRE环境,R1为中心
R1
[r1]int t 0/0/0
[r1-Tunnel0/0/0]ip ad 192.168.6.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp
[r1-Tunnel0/0/0]source 15.0.0.1
[r1-Tunnel0/0/0]nhrp entry multicast dynamic
[r1]int t 0/0/1
[r1-Tunnel0/0/1]ip ad 192.168.7.1 24
[r1-Tunnel0/0/1]tunnel-protocol gre p2mp
[r1-Tunnel0/0/1]source 65.0.0.1
[r1-Tunnel0/0/1]nhrp entry multicast dynamic
[r1-Tunnel0/0/1]nhrp entry 192.168.7.2 45.0.0.1 register
[r1-Tunnel0/0/1]nhrp entry 192.168.7.3 55.0.0.1 registerR2
[r2]int t 0/0/0
[r2-Tunnel0/0/0]ip add 192.168.6.2 24
[r2-Tunnel0/0/0]tunnel-protocol gre p2mp
[r2-Tunnel0/0/0]source g 0/0/0
[r2-Tunnel0/0/0]nhrp entry 192.168.6.1 15.0.0.1 register
R3[r3]int t 0/0/0
[r3-Tunnel0/0/0]ip add 192.168.6.3 24
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp
[r3-Tunnel0/0/0]source g 0/0/0
[r3-Tunnel0/0/0]nhrp entry 192.168.6.1 15.0.0.1 register
R4[r4]int t 0/0/0
[r4-Tunnel0/0/0]ip add 192.168.7.2 24
[r4-Tunnel0/0/0]tunnel-protocol gre p2mp
[r4-Tunnel0/0/0]source 45.0.0.1
[r4-Tunnel0/0/0]nhrp entry multicast dynamic
[r4-Tunnel0/0/0]nhrp entry 192.168.7.3 55.0.0.1 register
[r4-Tunnel0/0/0]nhrp entry 192.168.7.1 65.0.0.1 register
[r5]int t 0/0/0
[r5-Tunnel0/0/0]ip add 192.168.7.3 24
[r5-Tunnel0/0/0]tunnel-protocol gre p2mp
[r5-Tunnel0/0/0]source 55.0.0.1
4、所有私有网段可以互相通讯,私有网段使用OSPF完成
R1
[r1]ospf 1 rou 1.1.1.1
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[r1-ospf-1-area-0.0.0.0]network 192.168.6.0 0.0.0.255
[r1-ospf-1-area-0.0.0.0]network 192.168.7.0 0.0.0.255R3
[r3]ospf 1 rou 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]network 192.168.7.0 0.0.0.255
R4[r4]ospf 1 rou 4.4.4.4
[r4-ospf-1]area 0
[r4-ospf-1-area-0.0.0.0]network 192.168.4.0 0.0.0.255
[r4-ospf-1-area-0.0.0.0]network 192.168.6.0 0.0.0.255
R5[r5]ospf 1 rou 5.5.5.5
[r5-ospf-1]area 0
[r5-ospf-1-area-0.0.0.0]network 192.168.5.0 0.0.0.255
[r5-ospf-1-area-0.0.0.0]network 192.168.6.0 0.0.0.255R6
[r6]ospf 1 rou 5.5.5.5
[r6-ospf-1]area 0
[r6-ospf-1-area-0.0.0.0]network 192.168.5.0 0.0.0.255
5、将R1、R4、R5的接口类型改为Broadcast类型 ,R1、R2、R3的接口类型p2mp
R1
[r1]int t 0/0/0
[r1-Tunnel0/0/0]ospf network-type broadcast
R4[r4-ospf-1-area-0.0.0.0]q
[r4-ospf-1]int t 0/0/0
[r4-Tunnel0/0/0]ospf network-type broadcast
R5[r5-ospf-1-area-0.0.0.0]q
[r5-ospf-1]int t 0/0/0
[r5-Tunnel0/0/0]ospf network-type broadcastR1
[r1]int t 0/0/0
[r1-Tunnel0/0/0]ospf network-type p2mpR2
[r2-Tunnel0/0/0]ospf network-type p2mp
R3
[r3-Tunnel0/0/0]ospf network-type p2mp