实验拓扑:
实验步骤:
①写路由器各个接口的IP地址以及PC机的相关配置
② 在每个路由器上向ISP写缺省路由 //以R1为例
[R1]display ip routing-table protocol static
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : Static
Destinations : 1 Routes : 2 Configured Routes : 2Static routing table status : <Active>
Destinations : 1 Routes : 2Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 Static 60 0 RD 10.0.16.6 GigabitEthernet0/0/1
Static 60 0 RD 10.0.61.6 GigabitEthernet0/0/2Static routing table status : <Inactive>
Destinations : 0 Routes : 0
③实现R1-R2-R3的MGRE星型网络
[R1-Tunnel0/0/0]display this
[V200R003C00]
#
interface Tunnel0/0/0
ip address 20.1.1.1 255.255.255.0
tunnel-protocol gre p2mp
source 10.0.16.1
ospf network-type broadcast
nhrp entry multicast dynamic
nhrp network-id 100
#
return
[R2-Tunnel0/0/0]display this
[V200R003C00]
#
interface Tunnel0/0/0
ip address 20.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 20.1.1.1 10.0.16.1 register
#
return
[R3-Tunnel0/0/0]display this
[V200R003C00]
#
interface Tunnel0/0/0
ip address 20.1.1.3 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 20.1.1.1 10.0.16.1 register
#
return
④实现R1-R4-R5的全连网状MGRE网络
[R1-Tunnel0/0/1]display this
[V200R003C00]
#
interface Tunnel0/0/1
ip address 30.1.1.1 255.255.255.0
tunnel-protocol gre p2mp
source 10.0.61.1
ospf network-type broadcast
nhrp entry multicast dynamic
nhrp network-id 200
nhrp entry 30.1.1.4 10.0.46.4 register
#
return
[R4-Tunnel0/0/1]display this
[V200R003C00]
#
interface Tunnel0/0/1
ip address 30.1.1.4 255.255.255.0
tunnel-protocol gre p2mp
source 10.0.46.4
ospf network-type broadcast
nhrp entry multicast dynamic
nhrp network-id 200
nhrp entry 30.1.1.5 10.0.56.5 register
#
return
[R5-Tunnel0/0/1]display this
[V200R003C00]
#
interface Tunnel0/0/1
ip address 30.1.1.5 255.255.255.0
tunnel-protocol gre p2mp
source 10.0.56.5
ospf network-type broadcast
nhrp entry multicast dynamic
nhrp network-id 200
nhrp entry 30.1.1.1 10.0.61.1 register
#
return
⑤启动OSPF实现整个私有网络互通
[R1-ospf-1]display this
[V200R003C00]
#
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 20.1.1.0 0.0.0.255
network 30.1.1.0 0.0.0.255
network 192.168.1.0 0.0.0.255
#
return
[R2-ospf-1]display this
[V200R003C00]
#
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 20.1.1.0 0.0.0.255
network 192.168.2.0 0.0.0.255
#
return
[R3-ospf-1]display this
[V200R003C00]
#
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 20.1.1.0 0.0.0.255
network 192.168.3.0 0.0.0.255
#
return
[R4-ospf-1]display this
[V200R003C00]
#
ospf 1 router-id 4.4.4.4
area 0.0.0.0
network 30.1.1.0 0.0.0.255
network 192.168.4.0 0.0.0.255
#
return
[R5-ospf-1]display this
[V200R003C00]
#
ospf 1 router-id 5.5.5.5
area 0.0.0.0
network 30.1.1.0 0.0.0.255
network 192.168.5.0 0.0.0.255
#
return
⑥实现所有PC可以正常访问R6的环回
[Isp]int l0
[Isp-LoopBack0]ip add 6.6.6.6 32
[R1]acl 2000
[R1-acl-basic-2000]rule 5 permit source 192.168.1.0 0.0.0.255
[R1]int g 0/0/1
[R1-GigabitEthernet0/0/1]nat outbound 2000
[R1]int g 0/0/2
[R1-GigabitEthernet0/0/2]nat outbound 2000
⑦测试:
[R1]ping 10.0.36.3
PING 10.0.36.3: 56 data bytes, press CTRL_C to break
Reply from 10.0.36.3: bytes=56 Sequence=1 ttl=254 time=20 ms
Reply from 10.0.36.3: bytes=56 Sequence=2 ttl=254 time=20 ms
Reply from 10.0.36.3: bytes=56 Sequence=3 ttl=254 time=30 ms
Reply from 10.0.36.3: bytes=56 Sequence=4 ttl=254 time=30 ms
Reply from 10.0.36.3: bytes=56 Sequence=5 ttl=254 time=40 ms
--- 10.0.36.3 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/28/40 ms
[R1]ping 10.0.56.5
PING 10.0.56.5: 56 data bytes, press CTRL_C to break
Reply from 10.0.56.5: bytes=56 Sequence=1 ttl=254 time=20 ms
Reply from 10.0.56.5: bytes=56 Sequence=2 ttl=254 time=10 ms
Reply from 10.0.56.5: bytes=56 Sequence=3 ttl=254 time=20 ms
Reply from 10.0.56.5: bytes=56 Sequence=4 ttl=254 time=20 ms
Reply from 10.0.56.5: bytes=56 Sequence=5 ttl=254 time=30 ms
--- 10.0.56.5 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/20/30 ms
[R2]ping 10.0.46.4
PING 10.0.46.4: 56 data bytes, press CTRL_C to break
Reply from 10.0.46.4: bytes=56 Sequence=1 ttl=254 time=30 ms
Reply from 10.0.46.4: bytes=56 Sequence=2 ttl=254 time=30 ms
Reply from 10.0.46.4: bytes=56 Sequence=3 ttl=254 time=30 ms
Reply from 10.0.46.4: bytes=56 Sequence=4 ttl=254 time=30 ms
Reply from 10.0.46.4: bytes=56 Sequence=5 ttl=254 time=40 ms
--- 10.0.46.4 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/32/40 ms