实验思路
基本配置划分地址以及NAT地址转化
为R1至R6配置地址在R1-R5上填写缺省路由
R1
interface GigabitEthernet0/0/0
ip address 16.1.1.1 255.255.255.0
nat outbound 2000
#
interface GigabitEthernet0/0/1
ip address 61.1.1.1 255.255.255.0
nat outbound 2000
#
interface GigabitEthernet0/0/2
ip address 192.168.1.1 255.255.255.0
#
ip route-static 0.0.0.0 0.0.0.0 16.1.1.6
R2
interface GigabitEthernet0/0/0
ip address 26.1.1.2 255.255.255.0
nat outbound 2000
#
interface GigabitEthernet0/0/1
ip address 192.168.2.1 255.255.255.0
#ip route-static 0.0.0.0 0.0.0.0 26.1.1.6
R3
interface GigabitEthernet0/0/0
ip address 36.1.1.3 255.255.255.0
nat outbound 2000
#
interface GigabitEthernet0/0/1
ip address 192.168.3.1 255.255.255.0
#ip route-static 0.0.0.0 0.0.0.0 36.1.1.6
R4
interface GigabitEthernet0/0/0
ip address 46.1.1.4 255.255.255.0
nat outbound 2000
#
interface GigabitEthernet0/0/1
ip address 192.168.4.1 255.255.255.0
#ip route-static 0.0.0.0 0.0.0.0 46.1.1.6
R5
interface GigabitEthernet0/0/0
ip address 56.1.1.5 255.255.255.0
nat outbound 2000
#
interface GigabitEthernet0/0/1
ip address 192.168.5.1 255.255.255.0
#ip route-static 0.0.0.0 0.0.0.0 56.1.1.6
R6
interface GigabitEthernet0/0/0
ip address 16.1.1.6 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 61.1.1.6 255.255.255.0
#
interface GigabitEthernet0/0/2
ip address 26.1.1.6 255.255.255.0
#
interface GigabitEthernet1/0/0
ip address 36.1.1.6 255.255.255.0
#
interface GigabitEthernet2/0/0
ip address 46.1.1.6 255.255.255.0
#
interface GigabitEthernet3/0/0
ip address 56.1.1.6 255.255.255.0
#interface LoopBack0
ip address 192.168.6.1 255.255.255.0
星型mgre的配置
R1
interface Tunnel0/0/1
ip address 20.1.1.1 255.255.255.0
tunnel-protocol gre p2mp
source 61.1.1.1
ospf network-type broadcast
nhrp entry multicast dynamic
nhrp network-id 101
R5
interface Tunnel0/0/0
ip address 20.1.1.5 255.255.255.0
tunnel-protocol gre p2mp
source 56.1.1.5
ospf network-type broadcast
ospf dr-priority 0
nhrp network-id 101
nhrp entry 20.1.1.1 61.1.1.1 register
R4
interface Tunnel0/0/0
ip address 20.1.1.4 255.255.255.0
tunnel-protocol gre p2mp
source 46.1.1.4
ospf network-type broadcast
ospf dr-priority 0
nhrp network-id 101
nhrp entry 20.1.1.1 61.1.1.1 register
注:星型mgre需要修改DR和BDR选举的优先级,防止选举混乱
全连网状mgre的配置
R1
interface Tunnel0/0/0
ip address 10.1.1.1 255.255.255.0
tunnel-protocol gre p2mp
source 16.1.1.1
ospf network-type broadcast
nhrp entry multicast dynamic
nhrp network-id 100
R2
interface Tunnel0/0/0
ip address 10.1.1.2 255.255.255.0
tunnel-protocol gre p2mp
source 26.1.1.2
ospf network-type broadcast
nhrp entry multicast dynamic
nhrp network-id 100
nhrp entry 10.1.1.1 16.1.1.1 register
R3
interface Tunnel0/0/0
ip address 10.1.1.3 255.255.255.0
tunnel-protocol gre p2mp
source 36.1.1.3
ospf network-type broadcast
nhrp network-id 100
nhrp entry 10.1.1.1 16.1.1.1 register
nhrp entry 10.1.1.2 26.1.1.2 register
注:在OSPF下使用MGRE时需要将接口类型改为broadcast类型,因为mgre默认时P2P类型,在OSPF中有多台设备时需要选举BDR和DR所以接口类型需要改为broadcast。
OSPF配置
R1
ospf 1
area 0.0.0.0
network 10.1.1.0 0.0.0.255
network 192.168.3.0 0.0.0.255
R2
ospf 1
area 0.0.0.0
network 10.1.1.0 0.0.0.255
network 192.168.2.0 0.0.0.255
R3
ospf 1
area 0.0.0.0
network 10.1.1.0 0.0.0.255
network 192.168.3.0 0.0.0.255
R4
ospf 1
area 0.0.0.0
network 20.1.1.0 0.0.0.255
network 192.168.4.0 0.0.0.255
R5
ospf 1
area 0.0.0.0
network 20.1.1.0 0.0.0.255
network 192.168.5.0 0.0.0.255
测试
PC1访问R6的换回
PC1访问PC2
PC1访问PC4