要求:
1、首先为每个路由器配置接口ip和环回ip实现第一个目标
r1:
[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ip add 16.1.1.1 24
[r1-GigabitEthernet0/0/0]int gi0/0/1
[r1-GigabitEthernet0/0/1]ip add 61.1.1.1 24
[r1-GigabitEthernet0/0/1]int l0
[r1-LoopBack0]ip add 192.168.1.1 24
r2:
[r2]interface GigabitEthernet 0/0/0
[r2-GigabitEthernet0/0/0]ip add 26.1.1.1 24
[r2-GigabitEthernet0/0/0]int lo0
[r2-LoopBack0]ip add 192.168.2.1 24
r3:
[r3-GigabitEthernet0/0/0]ip add 36.1.1.1 24
[r3-GigabitEthernet0/0/0]int lo 0
[r3-LoopBack0]ip add 192.168.3.1 24
r4:
[r4]int GigabitEthernet 0/0/0
[r4-GigabitEthernet0/0/0]ip add 46.1.1.1 24
[r4-GigabitEthernet0/0/0]int lo0
[r4-LoopBack0]ip add 192.168.4.1 24
r5:
[r5]int GigabitEthernet 0/0/0
[r5-GigabitEthernet0/0/0]ip add 56.1.1.1 24
[r5-GigabitEthernet0/0/0]int lo 0
[r5-LoopBack0]ip add 192.168.5.1 24
r6:
[r6]int GigabitEthernet 0/0/0
[r6-GigabitEthernet0/0/0]ip add 16.1.1.2 24
[r6-GigabitEthernet0/0/0]int gi 0/0/1
[r6-GigabitEthernet0/0/1]ip add 61.1.1.2 24
[r6-GigabitEthernet0/0/1]int gi 0/0/2
[r6-GigabitEthernet0/0/2]ip add 26.1.1.2 24
[r6-GigabitEthernet0/0/2]in gi3/0/0
[r6-GigabitEthernet3/0/0]ip add 36.1.1.2 24
[r6-GigabitEthernet3/0/0]int gi 4/0/0
[r6-GigabitEthernet4/0/0]ip add 46.1.1.2 24
[r6-GigabitEthernet4/0/0]int gi 2/0/0
[r6-GigabitEthernet2/0/0]ip add 56.1.1.2 24
[r6-GigabitEthernet2/0/0]int lo0
[r6-LoopBack0]ip add 6.6.6.6 24
2、然后要让公网可以互相通需要在每个路由器上写一条指向r6的缺省
[r1]ip route-static 0.0.0.0 0 61.1.1.2
[r1]ip route-static 0.0.0.0 0 16.1.1.2
[r2]ip route-static 0.0.0.0 0 26.1.1.2
[r3]ip route-static 0.0.0.0 0 36.1.1.2
[r4]ip route-static 0.0.0.0 0 46.1.1.2
[r5]ip route-static 0.0.0.0 0 56.1.1.2
3、完成第二个目标
首先实现1/2/3 星型MGRE
r1:
[r1-Tunnel0/0/0]ip add 10.1.1.1 24
[r1]interface Tunnel 0/0/0
[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]nhrp network-id 100
r2:
[r2]int Tunnel 0/0/0
[r2-Tunnel0/0/0]ip add 10.1.1.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.1.1 16.1.1.1 register (这里有了注册和发伪广播功能)
r3:
[r3]interface Tunnel 0/0/0
[r3-Tunnel0/0/0]ip add 10.1.1.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.1.1 16.1.1.1 register (这里有了注册和发伪广播功能)
检测:
然后在1/4/5之间完成全连MGRE的配置
r1:
[r1]interface Tunnel 0/0/1
[r1-Tunnel0/0/1]ip add 10.1.2.1 24
[r1-Tunnel0/0/1]tunnel-protocol gre p2mp
[r1-Tunnel0/0/1]source 61.1.1.1
[r1-Tunnel0/0/1]nhrp entry multicast dynamic
[r1-Tunnel0/0/1]nhrp network-id 100
r4:
[r4]int Tunnel 0/0/0
[r4-Tunnel0/0/0]ip add 10.1.2.1 24
[r4-Tunnel0/0/0]tunnel-protocol gre p2mp
[r4-Tunnel0/0/0]source 46.1.1.1
[r4-Tunnel0/0/0]nhrp entry 10.1.2.1 61.1.1.1 register (这里有了注册和发伪广播功能)
[r4-Tunnel0/0/0]nhrp entry 10.1.2.3 56.1.1.1 register (这里有了注册和发伪广播功能)
[r4-Tunnel0/0/0]nhrp network-id 100
注意:这里为全连,所以r4到r1注册还要到r5注册
r5:
[r5]interface Tunnel 0/0/0
[r5-Tunnel0/0/0]ip address 10.1.2.3 24
[r5-Tunnel0/0/0]tunnel-protocol gre p2mp
[r5-Tunnel0/0/0]source 56.1.1.1
[r5-Tunnel0/0/0]nhrp entry 10.1.2.1 61.1.1.1 register (这里有了注册和发伪广播功能)
注意:r5没有到r4的伪广播
所以需要在5上开启动态伪广播
[r5-Tunnel0/0/0]nhrp entry multicast dynamic
测试:
4、下面实现用OSPF在1/2/3/ 1/4/5中进行动态选路
- 星型 -- 所有接口工作方式为broadcast,仅中心站点为DR,无BDR
- 全连 -- 所有接口工作方式为broadcast;DR/BDR将默认自动选举成功啊
r1:
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 10.1.1.1 0.0.0.0
[r1-ospf-1-area-0.0.0.0]network 10.1.2.1 0.0.0.0
[r1-ospf-1-area-0.0.0.0]network 192.168.1.1 0.0.0.0
r2:
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 10.1.1.2 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 192.168.2.1 0.0.0.0
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.1.3 0.0.0.0
r4:
[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]area 0
[r4-ospf-1-area-0.0.0.0]network 10.1.2.2 0.0.0.0
[r4-ospf-1-area-0.0.0.0]network 192.168.4.1 0.0.0.0
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.2.3 0.0.0.0
下面修改OSPF的工作方式
1/2/3
修改前:
[r1]interface Tunnel 0/0/0
[r1-Tunnel0/0/0]ospf network-type broadcast
[r2]interface Tunnel 0/0/0
[r2-Tunnel0/0/0]ospf network-type broadcast
[r3]interface Tunnel 0/0/0
[r3-Tunnel0/0/0]ospf network-type broadcast
然后因为三者的DR/BDR的选举有问题所以直接将2-3的优先级修改为0放弃参选无BSR只有1为DR
[r2-Tunnel0/0/0]ospf dr-priority 0
[r3-Tunnel0/0/0]ospf dr-priority 0
1/4/5
这里属于直连所以直接选举DR/BDR即可
下面修改OSPF的工作方式:
[r1]int Tunnel 0/0/1
[r1-Tunnel0/0/1]ospf network-type broadcast
[r4]interface Tunnel 0/0/0
[r4-Tunnel0/0/0]ospf network-type broadcast
[r5]interface Tunnel 0/0/0
[r5-Tunnel0/0/0]ospf network-type broadcast
检测:
用r2的环回pingr5的环回