实验内容及要求:
实验过程:
新建拓扑如下:
R4为ISP,所连接物理接口均为公有网段,任意IP地址即可
先把五台PC给上IP地址:
PC1:192.168.1.2/24
PC2:192.168.2.2/24
PC3:192.168.3.2/24
PC4:192.168.4.2/24
PC5:192.168.5.2/24
路由器配置IP地址
R1
R2
R3
ISP
R5
R6
每台路由器配置到ISP的缺省路由,再进行NAT地址转换
R1
[r1]ip route-static 0.0.0.0 0 12.1.1.2
[r1]ip route-static 0.0.0.0 0 16.1.1.2
[r1]acl 2000
[r1-acl-basic-2000]rule permit source any
[r1-acl-basic-2000]q
[r1]int GigabitEthernet 0/0/1
[r1-GigabitEthernet0/0/1]nat outbound 2000
[r1-GigabitEthernet0/0/1]q
[r1]int GigabitEthernet 0/0/2
[r1-GigabitEthernet0/0/2]nat outbound 2000
R2
[r2]ip route-static 0.0.0.0 0 23.1.1.2
[r2]acl 2000
[r2-acl-basic-2000]rule permit source any
[r2-acl-basic-2000]q
[r2]int GigabitEthernet 0/0/1
[r2-GigabitEthernet0/0/1]nat outbound 2000
R3
[r3]ip route-static 0.0.0.0 0 24.1.1.2
[r3]acl 2000
[r3-acl-basic-2000]rule permit source any
[r3-acl-basic-2000]q
[r3]int GigabitEthernet 0/0/1
[r3-GigabitEthernet0/0/1]nat outbound 2000
R5
[r5]ip route-static 0.0.0.0 0 45.1.1.2
[r5]acl 2000
[r5-acl-basic-2000]rule permit source any
[r5-acl-basic-2000]q
[r5]int GigabitEthernet 0/0/1
[r5-GigabitEthernet0/0/1]nat outbound 2000
R6
[r6]ip route-static 0.0.0.0 0 34.1.1.2
[r6]acl 2000
[r6-acl-basic-2000]rule permit source any
[r6-acl-basic-2000]q
[r6]int GigabitEthernet 0/0/1
[r6-GigabitEthernet0/0/1]nat outbound 2000
R1-2-3构建一个星型结构的MGRE,以R1为中心
R1
[r1]interface Tunnel 0/0/0
[r1-Tunnel0/0/0]ip address 10.1.1.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp
[r1-Tunnel0/0/0]source 16.1.1.1
Jul 22 2022 23:08:29-08:00 r1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface Tunnel0/0/0 has entered the UP state.
[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 address 10.1.1.2 24
[r2-Tunnel0/0/0]tunnel-protocol gre p2mp
[r2-Tunnel0/0/0]source 23.1.1.1
Jul 22 2022 23:12:53-08:00 r2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface Tunnel0/0/0 has entered the UP state.
[r2-Tunnel0/0/0]nhrp network-id 100
[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 address 10.1.1.3 24
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp
[r3-Tunnel0/0/0]source 24.1.1.1
Jul 22 2022 23:15:40-08:00 r3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface Tunnel0/0/0 has entered the UP state.
[r3-Tunnel0/0/0]nhrp network-id 100
[r3-Tunnel0/0/0]nhrp entry 10.1.1.1 16.1.1.1 register
R1-5-6构建一个全连网状的MGRE结构,R1和R5均为中心区域
R1
[r1]int Tunnel 0/0/1
[r1-Tunnel0/0/1]ip address 10.1.2.1 24
[r1-Tunnel0/0/1]tunnel-protocol gre p2mp
[r1-Tunnel0/0/1]source 12.1.1.1
Jul 22 2022 23:24:05-08:00 r1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface Tunnel0/0/1 has entered the UP state.
[r1-Tunnel0/0/1]nhrp entry multicast dynamic
[r1-Tunnel0/0/1]nhrp network-id 101
R5
[r5]interface Tunnel 0/0/1
[r5-Tunnel0/0/1]ip address 10.1.2.2 24
[r5-Tunnel0/0/1]tunnel-protocol gre p2mp
[r5-Tunnel0/0/1]source 45.1.1.1
Jul 22 2022 23:28:43-08:00 r5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface Tunnel0/0/1 has entered the UP state.
[r5-Tunnel0/0/1]nhrp entry multicast dynamic
[r5-Tunnel0/0/1]nhrp network-id 101
R6
[r6]int Tunnel 0/0/1
[r6-Tunnel0/0/1]ip address 10.1.2.3 24
[r6-Tunnel0/0/1]tunnel-protocol gre p2mp
[r6-Tunnel0/0/1]source 34.1.1.1
Jul 22 2022 23:31:54-08:00 r6 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface Tunnel0/0/1 has entered the UP state.
[r6-Tunnel0/0/1]nhrp entry 10.1.2.1 12.1.1.1 register
[r6-Tunnel0/0/1]nhrp entry 10.1.2.2 45.1.1.1 register
[r6-Tunnel0/0/1]nhrp network-id 101
互相注册
[r1-Tunnel0/0/1]nhrp entry 10.1.2.2 45.1.1.1 register
[r5-Tunnel0/0/1]nhrp entry 10.1.2.1 12.1.1.1 register
用OSPF使整个私有网络互通,同时所有PC可以访问ISP的环回
R1
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[r1-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255
[r1-ospf-1-area-0.0.0.0]network 10.1.2.0 0.0.0.255
R2
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
[r2-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255
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.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255
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.4.0 0.0.0.255
[r5-ospf-1-area-0.0.0.0]network 10.1.2.0 0.0.0.255
R6
[r6]ospf 1 router-id 6.6.6.6
[r6-ospf-1]area 0
[r6-ospf-1-area-0.0.0.0]network 192.168.5.0 0.0.0.255
[r6-ospf-1-area-0.0.0.0]network 10.1.2.0 0.0.0.255
将R1-2-3接口修改为P2MP型
R1
[r1]int t0/0/0
[r1-Tunnel0/0/0]ospf network-type p2mp
R2
[r2]int t0/0/0
[r2-Tunnel0/0/0]ospf network-type p2mp
R3
[r3]int t0/0/0
[r3-Tunnel0/0/0]ospf network-type p2mp
将R1-5-6接口修改为broadcast型
R1
[r1]int t0/0/1
[r1-Tunnel0/0/1]ospf network-type broadcast
R5
[r5]int g0/0/1
[r5-GigabitEthernet0/0/1]ospf network-type broadcast
R6
[r6]int t0/0/1
[r6-Tunnel0/0/1]ospf network-type broadcast
测试
PC1pingPC5
PC1pingISP环回
实验结束,满足实验所有要求