实验要求:
1,R1-R3-R4构建全连的MGRE环境
2,R1-R5-R6建立hub-spoke的MGRE环境,其中R1为中心
3,R1-R3…R6均存在环回网段模拟用户私网,使用OSPF使全网可达
4,其中R2为ISP路由器,仅配置IP地址
1.配置IP
r1
[r1]int LoopBack 0
[r1-LoopBack0]ip address 192.168.1.1 24
[r1-LoopBack0]int g 0/0/0
[r1-GigabitEthernet0/0/0]ip address 12.0.0.1 24
[r1-GigabitEthernet0/0/0]int g 0/0/1
[r1-GigabitEthernet0/0/1]ip address 21.0.0.1 24
ISP
GigabitEthernet0/0/0 12.0.0.2/24 up up
GigabitEthernet0/0/1 21.0.0.2/24 up up
GigabitEthernet0/0/2 23.0.0.2/24 up up
GigabitEthernet2/0/0 25.0.0.2/24 up up
GigabitEthernet3/0/0 26.0.0.2/24 up up
GigabitEthernet4/0/0 24.0.0.2/24 up up
r3
GigabitEthernet0/0/0 23.0.0.1/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 192.168.3.1/24 up up(s)
r4
GigabitEthernet0/0/0 24.0.0.1/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 192.168.4.1/24 up up(s)
r5
GigabitEthernet0/0/0 25.0.0.1/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 192.168.5.1/24 up up(s)
r6
GigabitEthernet0/0/0 26.0.0.1/24 up up
GigabitEthernet0/0/1 unassigned down down
GigabitEthernet0/0/2 unassigned down down
LoopBack0 192.168.6.1/24 up up(s)
2.构建r1-r3-r4全连MGRE环境(配置缺省路由,保证公网联通,中心开启伪广播)
r1
[r1]ip route-static 0.0.0.0 0 12.0.0.2
[r1]ip route-static 0.0.0.0 0 21.0.0.2
[r1]interface Tunnel 0/0/0
[r1-Tunnel0/0/0]ip address 192.168.2.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp
[r1-Tunnel0/0/0]source 21.0.0.1
[r1-Tunnel0/0/0]nhrp network-id 50
[r1-Tunnel0/0/0]nhrp entry 192.168.2.3 23.0.0.1 register
[r1-Tunnel0/0/0]nhrp entry multicast dynamic
r3
[r3]ip route-static 0.0.0.0 0 23.0.0.2
[r3]interface Tunnel 0/0/0
[r3-Tunnel0/0/0]ip address 192.168.2.3 24
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp
[r3-Tunnel0/0/0]source 23.0.0.1
[r3-Tunnel0/0/0]nhrp network-id 50
[r3-Tunnel0/0/0]nhrp entry 192.168.2.4 24.0.0.1 register
[r3-Tunnel0/0/0]nhrp entry multicast dynamic
r4
[r4]ip route-static 0.0.0.0 0 24.0.0.2
[r4]int Tunnel 0/0/0
[r4-Tunnel0/0/0]ip address 192.168.2.4 24
[r4-Tunnel0/0/0]tunnel-protocol gre p2mp
[r4-Tunnel0/0/0]source 24.0.0.1
[r4-Tunnel0/0/0]nhrp network-id 50
[r4-Tunnel0/0/0]nhrp entry 192.168.2.1 21.0.0.1 register
[r4-Tunnel0/0/0]nhrp entry multicast dynamic
3.建立r1-r5-r6 hub-spoke的MGRE环境,其中R1为中心
r1
[r1]int Tunnel 0/0/1
[r1-Tunnel0/0/1]ip address 192.168.7.1 24
[r1-Tunnel0/0/1]tunnel-protocol gre p2mp
[r1-Tunnel0/0/1]source 12.0.0.1
[r1-Tunnel0/0/1]nhrp network-id 100
[r1-Tunnel0/0/1]nhrp entry multicast dynamic
r5
[r5]int Tunnel 0/0/0
[r5-Tunnel0/0/0]ip address 192.168.7.5 24
[r5-Tunnel0/0/0]tunnel-protocol gre p2mp
[r5-Tunnel0/0/0]source 25.0.0.1
[r5-Tunnel0/0/0]nhrp network-id 100
[r5-Tunnel0/0/0]nhrp entry 192.168.7.1 12.0.0.1 register
[r5-Tunnel0/0/0]nhrp entry multicast dynamic
[r5-Tunnel0/0/0]ip route-static 0.0.0.0 0 25.0.0.2
r6
[r6]int Tunnel 0/0/0
[r6-Tunnel0/0/0]ip address 192.168.7.6 24
[r6-Tunnel0/0/0]tunnel-protocol gre p
[r6-Tunnel0/0/0]tunnel-protocol gre p2mp
[r6-Tunnel0/0/0]source 26.0.0.1
[r6-Tunnel0/0/0]nhrp network-id 100
[r6-Tunnel0/0/0]nhrp entry 192.168.7.1 12.0.0.1 register
[r6-Tunnel0/0/0]ip route-static 0.0.0.0 0 26.0.0.2
4.使用OSPF使全网可达
r1
[r1]ospf 1 router-id 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.2.0 0.0.0.255
[r1-ospf-1-area-0.0.0.0]network 192.168.7.0 0.0.0.255
[r1-Tunnel0/0/0]ospf network-type broadcast
[r1-Tunnel0/0/1]ospf network-type broadcast
r3
[r3]ospf 1 router-id 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.2.0 0.0.0.255
[r3-Tunnel0/0/0]ospf network-type broadcast
r4
[r4]ospf 1 router-id 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.2.0 0.0.0.255
[r4-Tunnel0/0/0]ospf network-type broadcast
r5
[r5]ospf 1 router-id 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.7.0 0.0.0.255
[r5-Tunnel0/0/0]ospf network-type broadcast
r6
[r6]ospf 1 router-id 6.6.6.6
[r6-ospf-1]area 0
[r6-ospf-1-area-0.0.0.0]network 192.168.6.0 0.0.0.255
[r6-ospf-1-area-0.0.0.0]network 192.168.7.0 0.0.0.255
[r6-Tunnel0/0/0]ospf network-type broadcast