一、配置IP地址及缺省路由
AR1:
interface GigabitEthernet0/0/0
ip address 10.1.61.1 255.255.255.0
interface GigabitEthernet0/0/1
ip address 10.1.16.1 255.255.255.0
interface LoopBack0
ip address 1.1.1.1 255.255.255.0
ip route-static 0.0.0.0 0.0.0.0 10.1.16.6
ip route-static 0.0.0.0 0.0.0.0 10.1.61.6
interface GigabitEthernet0/0/2
ip address 192.168.1.1 255.255.255.0
AR2
sysname r2
interface GigabitEthernet0/0/0
ip address 10.1.26.2 255.255.255.0
interface LoopBack0
ip address 2.2.2.2 255.255.255.0
ip route-static 0.0.0.0 0.0.0.0 10.1.26.6
AR3:
sysname r3
interface GigabitEthernet0/0/0
ip address 10.1.36.3 255.255.255.0
interface LoopBack0
ip address 3.3.3.3 255.255.255.0
AR4:
sysname r4
interface GigabitEthernet0/0/0
ip address 10.1.46.4 255.255.255.0
interface LoopBack0
ip address 4.4.4.4 255.255.255.0
ip route-static 0.0.0.0 0.0.0.0 10.1.46.6
AR5:
sysname r5
interface GigabitEthernet0/0/2
ip address 10.1.56.5 255.255.255.0
interface LoopBack0
ip address 5.5.5.5 255.255.255.0
ip route-static 0.0.0.0 0.0.0.0 10.1.56.6
AR6:
sysname r6
interface GigabitEthernet0/0/0
ip address 10.1.61.6 255.255.255.0
interface GigabitEthernet0/0/1
ip address 10.1.16.6 255.255.255.0
interface GigabitEthernet0/0/2
ip address 10.1.56.6 255.255.255.0
interface GigabitEthernet2/0/0
ip address 10.1.36.6 255.255.255.0
interface GigabitEthernet3/0/0
ip address 10.1.46.6 255.255.255.0
interface GigabitEthernet4/0/0
ip address 10.1.26.6 255.255.255.0
interface LoopBack0
ip address 6.6.6.6 255.255.255.0
二、配置MGRE
其中R1,R2,R3为星型拓扑,R1,R4,R5为全MGRE拓扑
AR1:
interface Tunnel0/0/0
ip address 10.1.1.1 255.255.255.0
tunnel-protocol gre p2mp
source 10.1.16.1
ospf network-type broadcast
nhrp entry multicast dynamic
nhrp network-id 100
interface Tunnel0/0/1
ip address 20.1.1.1 255.255.255.0
tunnel-protocol gre p2mp
source 10.1.61.1
ospf network-type broadcast
nhrp entry multicast dynamic
nhrp network-id 200
AR2:
interface Tunnel0/0/0
ip address 10.1.1.2 255.255.255.0
tunnel-protocol gre p2mp
source 10.1.26.2
ospf network-type broadcast
ospf dr-priority 0
nhrp network-id 100
nhrp entry 10.1.1.1 10.1.16.1 register
AR3:
interface Tunnel0/0/0
ip address 10.1.1.3 255.255.255.0
tunnel-protocol gre p2mp
source 10.1.36.3
ospf network-type broadcast
ospf dr-priority 0
nhrp network-id 100
nhrp entry 10.1.1.1 10.1.16.1 register
AR4:
interface Tunnel0/0/0
ip address 20.1.1.2 255.255.255.0
tunnel-protocol gre p2mp
source 10.1.46.4
ospf network-type broadcast
nhrp network-id 200
nhrp entry 20.1.1.1 10.1.61.1 register
nhrp entry 20.1.1.3 10.1.56.5 register
AR5:
interface Tunnel0/0/0
ip address 20.1.1.3 255.255.255.0
tunnel-protocol gre p2mp
source 10.1.56.5
ospf network-type broadcast
nhrp entry multicast dynamic
nhrp network-id 200
nhrp entry 20.1.1.1 10.1.61.1 register
三、配置OSPF
AR1:
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 1.1.1.1 0.0.0.0
network 10.1.1.1 0.0.0.0
network 20.1.1.1 0.0.0.0
network 192.168.1.0 0.0.0.255
AR2:
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 10.1.1.2 0.0.0.0
network 192.168.2.0 0.0.0.255
AR3:
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 3.3.3.3 0.0.0.0
network 10.1.1.3 0.0.0.0
network 192.168.3.0 0.0.0.255
AR4:
ospf 1 router-id 4.4.4.4
area 0.0.0.0
network 4.4.4.4 0.0.0.0
network 20.1.1.2 0.0.0.0
network 192.168.4.0 0.0.0.255
AR5:
ospf 1 router-id 5.5.5.5
area 0.0.0.0
network 5.5.5.5 0.0.0.0
network 20.1.1.3 0.0.0.0
network 192.168.5.0 0.0.0.255
四、修改tunnel隧道类型和优先级
由于OSPF在MGRE中默认连接方式为P2P,故在左边连接时,只能和其中一个邻居相连,所以只能和一个邻居处于FULL状态,此时,应该修改OSPF的连接方式,再修改完成后,由于DR和BDR之间的选取会混乱,之后再修改优先级。
[r1-Tunnel0/0/0]ospf network-type broadcast
[r2-Tunnel0/0/0]ospf network-type broadcast
[r3-Tunnel0/0/0]ospf network-type broadcast
五、设置ACL 和 NAT
[r2]acl 2000
[r2-acl-basic-2000]rule permit source any
[r2-acl-basic-2000]q
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]nat outbound 2000
六、测试
PC1:
PC2: