实验要求:1.R6为ISP只能配置IP地址
2.R1/4/5为全连MGRE结构,R1/2/3为星型结构,R1为中心站点
3.所有私有网段可以互相通讯,私有网段使用OSPF协议
首先我们先进行IP地址的规划 和进行IP地址的配置
对R1:
interface GigabitEthernet0/0/0
ip address 192.168.1.1 255.255.255.0
interface GigabitEthernet0/0/1
ip address 16.1.1.1 255.255.255.0
interface GigabitEthernet0/0/2
ip address 61.1.1.1 255.255.255.0
对R2:
interface GigabitEthernet0/0/0
ip address 192.168.2.1 255.255.255.0
interface GigabitEthernet0/0/1
ip address 26.1.1.1 255.255.255.0
对R3:
interface GigabitEthernet0/0/0
ip address 192.168.3.1 255.255.255.0
interface GigabitEthernet0/0/1
ip address 36.1.1.1 255.255.255.0
对R4:
interface GigabitEthernet0/0/0
ip address 192.168.4.1 255.255.255.0
interface GigabitEthernet0/0/1
ip address 46.1.1.1 255.255.255.0
对R5:
interface GigabitEthernet0/0/0
ip address 192.168.5.1 255.255.255.0
interface GigabitEthernet0/0/1
ip address 56.1.1.1 255.255.255.0
对R6: 因为它是ISP所有我们只对其配置IP地址
interface GigabitEthernet0/0/0
ip address 16.1.1.2 255.255.255.0
interface GigabitEthernet0/0/1
ip address 26.1.1.2 255.255.255.0
interface GigabitEthernet0/0/2
ip address 36.1.1.2 255.255.255.0
interface GigabitEthernet4/0/0
ip address 46.1.1.2 255.255.255.0
interface GigabitEthernet4/0/1
ip address 56.1.1.2 255.255.255.0
interface GigabitEthernet4/0/2
ip address 61.1.1.2 255.255.255.0
interface LoopBack0
ip address 6.6.6.6 255.255.255.0
再给所有的电脑进行DHCP获取IP地址 我们这里因为电脑只有一台所以进行了手工配置
每一台类似
之后我们给每一个路由器写了一个缺省路由指向了ISP
然后进行nat的地址转换
对R1:
acl 2000
rule permit source 192.168.1.0 0.0.0.255
int g0/0/1
nat outbound 2000
对R2:
acl 2000
rule permit source 192.168.2.0 0.0.0.255
int g0/0/1
nat outbound 2000
对R3:
acl 2000
rule permit source 192.168.3.0 0.0.0.255
int g0/0/1
nat outbound 2000
对R4:
acl 2000
rule permit source 192.168.4.0 0.0.0.255
int g0/0/1
nat outbound 2000
对R5:
acl 2000
rule permit source 192.168.5.0 0.0.0.255
int g0/0/1
nat outbound 2000
之后我们检测电脑是否可以访问6.6.6.6
我们用所有的PC来PING一下6.6.6.6
故我们发现所有的电脑可以访问6.6.6.6
之后我们看要求R1/4/5为全连MGRE结构 因为是全连结构所有我们等会使用OSPF时不需要干涉DR/BDR选举
我们进行俩俩注册
对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
对R4:
interface Tunnel0/0/0
ip address 10.1.1.2 255.255.255.0
tunnel-protocol gre p2mp
source GigabitEthernet0/0/1
ospf network-type broadcast
nhrp network-id 100
nhrp entry 10.1.1.1 16.1.1.1 register
nhrp entry 10.1.1.3 56.1.1.1 register
对R5:
interface Tunnel0/0/0
ip address 10.1.1.3 255.255.255.0
tunnel-protocol gre p2mp
source GigabitEthernet0/0/1
ospf network-type broadcast
nhrp network-id 100
nhrp entry 10.1.1.1 16.1.1.1 register
nhrp entry 10.1.1.3 46.1.1.1 register
之后我们开始写 OSPF
R1:
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 10.1.1.0 0.0.0.255
network 21.1.1.0 0.0.0.255
network 192.168.1.0 0.0.0.255
R4:
ospf 1 router-id 4.4.4.4
area 0.0.0.0
network 10.1.1.0 0.0.0.255
network 192.168.4.0 0.0.0.255
R5:
ospf 1 router-id 5.5.5.5
area 0.0.0.0
network 10.1.1.0 0.0.0.255
network 192.168.5.0 0.0.0.255
公网不宣告
我们测试一下用PC1来访问PC4 PC5看是否通
故完成要求
我们进行下一个要求:
R1与R2 R3为星型结构 我们需要干涉选举 选出DR 不选出BDR
R1:
interface Tunnel0/0/1
ip address 21.1.1.1 255.255.255.0
tunnel-protocol gre p2mp
source 61.1.1.1
ospf network-type broadcast
ospf dr-priority 3
nhrp entry multicast dynamic
nhrp network-id 100
R2:
interface Tunnel0/0/1
ip address 21.1.1.2 255.255.255.0
tunnel-protocol gre p2mp
source GigabitEthernet0/0/1
ospf network-type broadcast
ospf dr-priority 0
nhrp network-id 100
nhrp entry 21.1.1.1 61.1.1.1 register
R3:
interface Tunnel0/0/1
ip address 21.1.1.3 255.255.255.0
tunnel-protocol gre p2mp
source GigabitEthernet0/0/1
ospf network-type broadcast
ospf dr-priority 0
nhrp entry 21.1.1.1 61.1.1.1 register
我们开始写OSPF
R1:
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 10.1.1.0 0.0.0.255
network 21.1.1.0 0.0.0.255
network 192.168.1.0 0.0.0.255
R2:
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 21.1.1.0 0.0.0.255
network 192.168.2.0 0.0.0.255
R3:ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 21.1.1.0 0.0.0.255
network 192.168.3.0 0.0.0.255
这时候我们需要干涉选举
DR为中心站点
ospf dr-priority 3
故我们测试 用PC1来ping所有电脑