OSPF实验二
一.实验要求
1.R7为ISP,只能配置IP;
2.红色为私有IP范围;
3.使用OSPF将所有私有网段,实现全通;
4.OSPF的区域划分为紫色;
5.R4-6可以正常访问R7环回;
6.R1 telnet R3公有IP,实际登录到R6;
二.实验拓扑
三.实验步骤
1.IP配置
r1:
192.168.1.1/24 #环回地址
17.1.1.1/24 #g0/0/0端口
r2:
192.168.2.1/24 #环回地址
27.1.1.1/24 #g0/0/0端口
r3:
192.168.3.1/24 #环回地址
37.1.1.1/24 #g0/0/0端口
192.168.34.1/24 #g0/0/1端口
r4:
192.168.4.1/24 #环回地址
192.168.34.2/24 #g0/0/0端口
192.168.45.1/24 #g0/0/1端口
r5:
192.168.5.1/24 #环回地址
192.168.45.2/24 #g0/0/0端口
192.168.56.1/24 #g0/0/1端口
r6:
192.168.6.1/24 #环回地址
192.168.56.2/24 #g0/0/0端口
r7:
7.7.7.7/24 #环回地址
17.1.1.2/24 #g0/0/0端口
27.1.1.2/24 #g0/0/1端口
37.1.1.2/24 #g0/0/2端口
2.配置R1-3为全连MGRE
r1:
[r1]int t0/0/0
[r1-Tunnel0/0/0] ip add 10.1.2.1 24
[r1-Tunnel0/0/0]tun
[r1-Tunnel0/0/0]tunnel-protocol gre
[r1-Tunnel0/0/0]tunnel-protocol gre p
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp
[r1-Tunnel0/0/0]nhrp n
[r1-Tunnel0/0/0]nhrp network-id 100
[r1-Tunnel0/0/0]nhrp en
[r1-Tunnel0/0/0]nhrp entry mu
[r1-Tunnel0/0/0]nhrp entry multicast d
[r1-Tunnel0/0/0]nhrp entry multicast dynamic
[r1-Tunnel0/0/0]so
[r1-Tunnel0/0/0]source 17.1.1.1
Jul 10 2021 23:35:00-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 en
[r1-Tunnel0/0/0]nhrp entry 10.1.2.2 27.1.1.1 re
[r1-Tunnel0/0/0]nhrp entry 10.1.2.2 27.1.1.1 register
r2:
[r2]int t0/0/0
[r2-Tunnel0/0/0]ip add 10.1.2.2 24
[r2-Tunnel0/0/0]tun
[r2-Tunnel0/0/0]tunnel-protocol gre p
[r2-Tunnel0/0/0]tunnel-protocol gre p2mp
[r2-Tunnel0/0/0]nhrp ne
[r2-Tunnel0/0/0]nhrp network-id 100
[r2-Tunnel0/0/0]sou
[r2-Tunnel0/0/0]source 27.1.1.1
Jul 10 2021 23:38:22-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]
[r2-Tunnel0/0/0]nhrp en
[r2-Tunnel0/0/0]nhrp entry 10.1.2.1 17.1.1.1 re
[r2-Tunnel0/0/0]nhrp entry 10.1.2.1 17.1.1.1 register
[r2-Tunnel0/0/0]nhrp en
[r2-Tunnel0/0/0]nhrp entry 10.1.2.3 37.1.1.1 re
[r2-Tunnel0/0/0]nhrp entry 10.1.2.3 37.1.1.1 register
[r2-Tunnel0/0/0]q
r3:
[r3]int t0/0/0
[r3-Tunnel0/0/0]ip add 10.1.2.3 24
[r3-Tunnel0/0/0]tun
[r3-Tunnel0/0/0]tunnel-protocol gre p
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp
[r3-Tunnel0/0/0]nhrp n
[r3-Tunnel0/0/0]nhrp network-id 100
[r3-Tunnel0/0/0]nhrp en
[r3-Tunnel0/0/0]nhrp entry 10.1.2.1 17.1.1.1 re
[r3-Tunnel0/0/0]nhrp entry 10.1.2.1 17.1.1.1 register
[r3-Tunnel0/0/0]nhrp en
[r3-Tunnel0/0/0]nhrp entry 10.1.2.2 27.1.1.1 re
[r3-Tunnel0/0/0]nhrp entry 10.1.2.2 27.1.1.1 register
[r3-Tunnel0/0/0]nhrp
[r3-Tunnel0/0/0]nhrp en
[r3-Tunnel`在这里插入代码片`0/0/0]nhrp entry mu
[r3-Tunnel0/0/0]nhrp entry multicast d
[r3-Tunnel0/0/0]nhrp entry multicast dynamic
[r3-Tunnel0/0/0]sou
[r3-Tunnel0/0/0]source 37.1.1.1
Jul 10 2021 23:41:39-08:00 r3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
3.使用OSPF使私网全通
r1:
[r1]ospf 1 rou
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]ar
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]ne
[r1-ospf-1-area-0.0.0.0]network 192.168.1.1 0.0.0.0
[r1-ospf-1-area-0.0.0.0]ne
[r1-ospf-1-area-0.0.0.0]network 10.1.2.1 0.0.0.0
r2:
[r2]ospf 1 rou
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]ar
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]ne
[r2-ospf-1-area-0.0.0.0]network 192.168.2.1 0.0.0.0
[r2-ospf-1-area-0.0.0.0]ne
[r2-ospf-1-area-0.0.0.0]network 10.1.2.2 0.0.0.0
r3:
[r3]ospf 1 rou
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]ar
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]ne
[r3-ospf-1-area-0.0.0.0]network 10.1.2.3 0.0.0.0
[r3-ospf-1-area-0.0.0.0]area 1
[r3-ospf-1-area-0.0.0.1]ne
[r3-ospf-1-area-0.0.0.1]network 192.168.3.1 0.0.0.0
[r3-ospf-1-area-0.0.0.1]ne
[r3-ospf-1-area-0.0.0.1]network 192.168.34.1 0.0.0.0
r4:
r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1]area 1
[r4-ospf-1-area-0.0.0.1]network 192.168.4.1 0.0.0.0
[r4-ospf-1-area-0.0.0.1]network 192.168.34.2 0.0.0.0
r5:
[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]area 1
[r5-ospf-1-area-0.0.0.1]network 192.168.5.1 0.0.0.0
[r5-ospf-1-area-0.0.0.1]network 192.168.45.2 0.0.0.0
[r5-ospf-1-area-0.0.0.1]ospf 2
[r5-ospf-2]area 2
[r5-ospf-2-area-0.0.0.2]network 192.168.56.1 0.0.0.0
r6:
[r6]ospf 2 router-id 6.6.6.6
[r6-ospf-2]area 2
[r6-ospf-2-area-0.0.0.2]network 192.168.56.2 0.0.0.0
[r6-ospf-2-area-0.0.0.2]
Jul 10 2021 23:51:32-08:00 r6 %%01OSPF/4/NBR_CHANGE_E(l)[0]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=512, NeighborAddress=1.56.168.192, Neigh
borEvent=HelloReceived, NeighborPreviousState=Down, NeighborCurrentState=Init)
[r6-ospf-2-area-0.0.0.2]
Jul 10 2021 23:51:32-08:00 r6 %%01OSPF/4/NBR_CHANGE_E(l)[1]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=512, NeighborAddress=1.56.168.192, Neigh
borEvent=2WayReceived, NeighborPreviousState=Init, NeighborCurrentState=2Way)
[r6-ospf-2-area-0.0.0.2]
Jul 10 2021 23:51:32-08:00 r6 %%01OSPF/4/NBR_CHANGE_E(l)[2]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=512, NeighborAddress=1.56.168.192, Neigh
borEvent=AdjOk?, NeighborPreviousState=2Way, NeighborCurrentState=ExStart)
[r6-ospf-2-area-0.0.0.2]
Jul 10 2021 23:51:32-08:00 r6 %%01OSPF/4/NBR_CHANGE_E(l)[3]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=512, NeighborAddress=1.56.168.192, Neigh
borEvent=NegotiationDone, NeighborPreviousState=ExStart, NeighborCurrentState=Ex
change)
[r6-ospf-2-area-0.0.0.2]
Jul 10 2021 23:51:32-08:00 r6 %%01OSPF/4/NBR_CHANGE_E(l)[4]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=512, NeighborAddress=1.56.168.192, Neigh
borEvent=ExchangeDone, NeighborPreviousState=Exchange, NeighborCurrentState=Load
ing)
[r6-ospf-2-area-0.0.0.2]
Jul 10 2021 23:51:32-08:00 r6 %%01OSPF/4/NBR_CHANGE_E(l)[5]:Neighbor changes eve
nt: neighbor status changed. (ProcessId=512, NeighborAddress=1.56.168.192, Neigh
borEvent=LoadingDone, NeighborPreviousState=Loading, NeighborCurrentState=Full)
4.重发布
r2:
[r2]ospf 1
[r2-ospf-1]import-route ospf 2
[r2-ospf-1]q
[r2]ospf 2
[r2-ospf-2]import-route ospf 1
5.R1 telent R3 公有ip 实际到 R6;
r6:
[r6]aaa
[r6-aaa]lo
[r6-aaa]local-user ren pas
[r6-aaa]local-user ren password cip
[r6-aaa]local-user ren password cipher 123456
Info: Add a new user.
[r6-aaa]lo
[r6-aaa]local-user ren se
[r6-aaa]local-user ren service-type te
[r6-aaa]local-user ren service-type telnet
[r6-aaa]q
[r6]user
[r6]user-in
[r6]user-interface vty 0 4
[r6-ui-vty0-4]aut
[r6-ui-vty0-4]authentication-mode aaa
r3:
[r3]int g0/0/0
[r3-GigabitEthernet0/0/0]nat s
[r3-GigabitEthernet0/0/0]nat server pr
[r3-GigabitEthernet0/0/0]nat server protocol tcp g
[r3-GigabitEthernet0/0/0]nat server protocol tcp global cu
[r3-GigabitEthernet0/0/0]nat server protocol tcp global current-interface 23 ins
[r3-GigabitEthernet0/0/0]nat server protocol tcp global current-interface 23 ins
ide 192.168.56.2
Warning:The port 23 is well-known port. If you continue it may cause function fa
ilure.
Are you sure to continue?[Y/N]:y