一.IP配置:
R1:
GE0/0/1:15.0.0.1/8
GE0/0/0:16.0.0.1/8
R2:
GE0/0/0:25.0.0.1/8
R3:
GE0/0/0:35.0.0.1/8
R4:
GE0/0/0:45.0.0.1/8
R5:
GE0/0/0:55.0.0.1/8
R6:
GE3/0/0:15.0.0.2/8
GE0/0/0:16.0.0.2/8
GE0/0/1:25.0.0.2/8
GE0/0/2:35.0.0.2/8
GE1/0/0:45.0.0.2/8
GE2/0/0:55.0.0.2/8
环回:
R1:192.168.1.1/24
R2:192.168.2.1/24
R3:192.168.3.1/24
R4:192.168.4.1/24
R5:192.168.5.1/24
隧道:
R1:192.168.8.1/24
R4:192.168.8.4/24
R5:192.168.8.5/24
R1:192.168.9.1/24
R2:192.168.9.2/24
R3:192.168.9.3/24
缺省:
[r1]ip route-static 0.0.0.0 0 15.0.0.2
[r1]ip route-static 0.0.0.0 0 16.0.0.2
[r2]ip route-static 0.0.0.0 0 25.0.0.2
[r3]ip route-static 0.0.0.0 0 35.0.0.2
[r4]ip route-static 0.0.0.0 0 45.0.0.2
[r5]ip route-static 0.0.0.0 0 55.0.0.2
配置命令:
以R1为例:
[r1]interface GigabitEthernet 0/0/1 进入0/0/1接口
[r1-GigabitEthernet0/0/1]ip address 15.0.0.1 8 配置ip
[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ip address 15.0.0.2 8
[r1]interface Tunnel 0/0/0 进入0/0/0的隧道接口
[r1-Tunnel0/0/0]ip address 192.168.8.1 24
[r1]interface LoopBack 0 进入环回接口
[r1-LoopBack0]ip address 192.168.1.1 24
二.搭建MGRE环境
R1/R4/R5为全mgre,所以没有中心也可以都是中心,星形的mgre就只用向一个节点汇报,语句基本相同
[r1]interface Tunnel 0/0/0 进入0/0/0的隧道接口
[r1-Tunnel0/0/0]ip address 192.168.8.1 24 配置ip
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp 使用mgre协议封装
[r1-Tunnel0/0/0]source 15.0.0.1 源地址
[r1-Tunnel0/0/0]nhrp network-id 100 开启nhrp
[r1-Tunnel0/0/0]nhrp entry 192.168.8.5 55.0.0.1 register
[r1-Tunnel0/0/0]nhrp entry 192.168.8.4 45.0.0.1 register
向R1这个中心区注册IP格式:隧道IP 物理接口IP
验证:
三.用OSPF实现全网通
以R1为例子
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.1]network 192.168.8.0 0.0.0.255 宣告全mgre的隧道网段
[r1-ospf-1-area-0.0.0.1]network 192.168.9.0 0.0.0.255 宣告星mgre的隧道网段
[r1-ospf-1-area-0.0.0.1]network 192.168.1.0 0.0.0.255 宣告环回网段
[r1-Tunnel0/0/1]nhrp entry multicast dynamic 开启伪广播
[r1-Tunnel0/0/1]ospf network-type broadcast 更改接口类型为broadcast