二、实验要求
1、R6为ISP只能配置IP地址,R1-R5的环回为私有网段
2、R1/4/5为全连的MGRE结构,R1/2/3为星型的拓扑结构,R1为中心站点
3、所有私有网段可以互相通讯,私有网段使用OSPF完成
三、IP规划
1、公网网段
16.1.1.0/24 R1-R6
16.1.2.0/24 R1-R6
26.1.1.0/24 R2-R6
36.1.1.0/24 R3-R6
46.1.1.0/24 R4-R6
56.1.1.0/24 R5-R6
2、私网网段
192.168.1.0/24 R1环回(因为要构建两个MGRE环境)
192.168.1.0/25 R1环回(全连接)
192.168.1.128/25 R1环回(中心站点)
192.168.2.0/24 R2环回
192.168.3.0/24 R3环回
192.168.4.0/24 R4环回
192.168.5.0/24 R5环
3、隧道网段
10.1.1.0/24 全连接
10.1.2.0/24 中心站点
四、实验步骤
1、配置IP与环回
(1)R1配置
[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ip address 16.1.1.1 24
[r1]interface LoopBack 0
[r1-LoopBack0]ip address 192.168.1.1 25
[r1]interface LoopBack 1
[r1-LoopBack1]ip address 192.168.1.129 25
2)R2配置
[r2]interface GigabitEthernet 0/0/0
[r2-GigabitEthernet0/0/0]ip address 26.1.1.2 24
[r2]interface LoopBack 0
[r2-LoopBack0]ip address 192.168.2.1 24
(3)R3配置
[r3]interface GigabitEthernet 0/0/0
[r3-GigabitEthernet0/0/0]ip address 36.1.1.3 24
[r3]interface LoopBack 0
[r3-LoopBack0]ip address 192.168.3.1 24
(4)R4配置
[r4]interface GigabitEthernet 0/0/0
[r4-GigabitEthernet0/0/0]ip address 46.1.1.4 24
[r4]interface LoopBack 0
[r4-LoopBack0]ip address 192.168.4.1 24
(5)R5配置
[r5]interface GigabitEthernet 0/0/0
[r5-GigabitEthernet0/0/0]ip address 56.1.1.5 24
[r5]interface LoopBack 0
[r5-LoopBack0]ip address 192.168.5.1 24
(6)R6配置
[r6]interface GigabitEthernet 0/0/0
[r6-GigabitEthernet0/0/0]ip address 16.1.1.6 24
[r6]interface GigabitEthernet 0/0/1
[r6-GigabitEthernet0/0/0]ip address 16.1.2.6 24
[r6]interface GigabitEthernet 0/0/2
[r6-GigabitEthernet0/0/2]ip address 56.1.1.6 24
[r6]interface GigabitEthernet 2/0/0
[r6-GigabitEthernet2/0/0]ip address 26.1.1.6 24
[r6]interface GigabitEthernet 2/0/1
[r6-GigabitEthernet2/0/1]ip address 36.1.1.6 24
[r6]interface GigabitEthernet 4/0/0
[r6-GigabitEthernet4/0/0]ip address 46.1.1.6 24
————————————————
2、配置缺省指向R6,实现公网互通
(1)R1配置(因为有两条线路,所以需要等价路由,应写两条路由):
[r1]ip route-static 0.0.0.0 0 16.1.1.6
[r1]ip route-static 0.0.0.0 0 16.1.2.6
(2)R2配置
[r2]ip route-static 0.0.0.0 0 26.1.1.6
(3)R3配置
[r3]ip route-static 0.0.0.0 0 36.1.1.6
(4)R4配置
[r4]ip route-static 0.0.0.0 0 46.1.1.6
(5)R5配置
[r5]ip route-static 0.0.0.0 0 56.1.1.6
测试:
[r1]ping 56.1.1.5
[r1]ping 46.1.1.4
[r1]ping 36.1.1.3
[r1]ping 36.1.1.2
3、R1/2/3为星型的拓扑结构,R1为中心站点
(1)R1配置
[r1]interface Tunnel 0/0/0
[r1-Tunnel0/0/0]ip address 10.1.2.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp
[r1-Tunnel0/0/0]source 16.1.1.1
[r1-Tunnel0/0/0]nhrp entry multicast dynamic(开启伪广播)
[r1-Tunnel0/0/0]ospf network-type broadcast (将网络类型改为broadcas)
(2)R2配置
[r2]interface Tunnel 0/0/0
[r2-Tunnel0/0/0]ip address 10.1.2.2 24
[r2-Tunnel0/0/0]tunnel-protocol gre p2mp
[r2-Tunnel0/0/0]source GigabitEthernet 0/0/0
[r2-Tunnel0/0/0]nhrp entry 10.1.2.1 16.1.1.1 register
[r2-Tunnel0/0/0]ospf dr-priority 0(因为要将DR的位置放在中心节点,所以放弃选举)
[r2-Tunnel0/0/0]ospf network-type broadcast (将网络类型改为broadcast)
(3)R3配置
[r3]interface Tunnel 0/0/0
[r3-Tunnel0/0/0]ip address 10.1.2.3 24
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp
[r3-Tunnel0/0/0]source GigabitEthernet 0/0/0
[r3-Tunnel0/0/0]nhrp entry 10.1.2.1 16.1.1.1 register
[r3-Tunnel0/0/0]ospf dr-priority 0(放弃选举)
[r3-Tunnel0/0/0]ospf network-type broadcast (将网络类型改为broadcast
测试:
[r1]display n p a
[r1]ping 10.1.2.2
[r1]ping 10.1.2.3
4、R1/4/5为全连的MGRE结构
full-mesh架构三者都是中心也是分支,都要互相注册
构建静态隧道,永远存在,没有动态的老化时间
(1)R1配置
[r1]interface Tunnel 0/0/1
[r1-Tunnel0/0/1]shutdown (不关闭会导致注册配置无法生效,无法互相注册)
[r1-Tunnel0/0/1]ip address 10.1.1.1 24
[r1-Tunnel0/0/1]tunnel-protocol gre p2mp
[r1-Tunnel0/0/1]source GigabitEthernet 0/0/1
(因为是中心也是分支)
[r1-Tunnel0/0/1]nhrp entry 10.1.1.4 46.1.1.4 register
[r1-Tunnel0/0/1]nhrp entry 10.1.1.5 56.1.1.5 register
[r1-Tunnel0/0/1]undo shutdown
[r1-Tunnel0/0/1]ospf network-type broadcast(将网络类型改为broadcast )
(2)R4配置
[r4]interface Tunnel 0/0/0
[r4-Tunnel0/0/0]shutdown
[r4-Tunnel0/0/0]ip address 10.1.1.4 24
[r4-Tunnel0/0/0]tunnel-protocol gre p2mp
[r4-Tunnel0/0/0]source GigabitEthernet 0/0/0
(相互注册)
[r4-Tunnel0/0/0]nhrp entry 10.1.1.1 16.1.2.1 register
[r4-Tunnel0/0/0]nhrp entry 10.1.1.5 56.1.1.5 register
[r4-Tunnel0/0/0]undo shutdown
[r4-Tunnel0/0/0]ospf network-type broadcast (将网络类型改为broadcast )
3)R5配置
[r5]interface Tunnel 0/0/0
[r5-Tunnel0/0/0]shutdown
[r5-Tunnel0/0/0]ip address 10.1.1.5 24
[r5-Tunnel0/0/0]tunnel-protocol gre p2mp
[r5-Tunnel0/0/0]source GigabitEthernet 0/0/0
(相互注册)
[r5-Tunnel0/0/0]nhrp entry 10.1.1.1 16.1.2.1 register
[r5-Tunnel0/0/0]nhrp entry 10.1.1.4 46.1.1.4 register
[r5-Tunnel0/0/0]undo shutdown
[r5-Tunnel0/0/0]ospf network-type broadcast (将网络类型改为broadcast
5、开启OSPF
(1)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 10.1.0.0 0.0.255.255
(2)R2配置
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 192.168.2.1 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 10.1.2.2 0.0.0.0
(3)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.1 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 10.1.2.3 0.0.0.0
(4)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.1 0.0.0.0
[r4-ospf-1-area-0.0.0.0]network 10.1.1.4 0.0.0.0
(5)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.1 0.0.0.0
[r5-ospf-1-area-0.0.0.0]network 10.1.1.5 0.0.0.0
6、结果测试
[r1]dis n p a
[r4]display n p a
[r5]display n p a
r1]display ospf p b
[r1]display ip routing-table protocol ospf
[r1]ping -a 192.168.1.1 192.168.2.1
[r1]ping -a 192.168.1.1 192.168.3.1
[r1]ping -a 192.168.1.1 192.168.4.1
[r1]ping -a 192.168.1.1 192.168.5.1