一、实验要求及拓扑图:
二、实验过程
2.1、配ip和缺省路由
R1
[r1-GigabitEthernet0/0/0]ip address 1.0.0.1 24
[r1-GigabitEthernet0/0/1]ip address 6.0.0.1 24
[r1-LoopBack0]ip address 192.168.1.1 24
[r1]ip route-static 0.0.0.0 0 1.0.0.2
[r1]ip route-static 0.0.0.0 0 6.0.0.2
R2
[r2-GigabitEthernet0/0/0]ip address 2.0.0.1
[r2-LoopBack0]ip address 192.168.2.1 24
[r2]ip route-static 0.0.0.0 0 2.0.0.2
R3
[r3-GigabitEthernet0/0/0]ip address 3.0.0.1 24
[r3-LoopBack0]ip address 192.168.3.1 24
[r3]ip route-static 0.0.0.0 0 3.0.0.2
R4
[r4-GigabitEthernet0/0/0]ip address 4.0.0.1 24
[r4-LoopBack0]ip address 192.168.4.1 24
[r4]ip route-static 0.0.0.0 0 4.0.0.2
R5
[r5-GigabitEthernet0/0/0]ip address 5.0.0.1 24
[r5-LoopBack0]ip address 192.168.5.1 24
[r5]ip route-static 0.0.0.0 0 5.0.0.2
R6
[r6-GigabitEthernet0/0/0]ip address 1.0.0.2 24
[r6-GigabitEthernet0/0/1]ip address 6.0.0.2 24
[r6-GigabitEthernet2/0/0]ip address 2.0.0.2 24
[r6-GigabitEthernet3/0/0]ip address 3.0.0.2 24
[r6-GigabitEthernet4/0/0]ip address 4.0.0.2 24
[r6-GigabitEthernet0/0/2]ip address 5.0.0.2 24
[r6-LoopBack0]ip address 6.6.6.6 24
测试公网可达:
[r1]ping 2.0.0.1
PING 2.0.0.1: 56 data bytes, press CTRL_C to break
Request time out
Reply from 2.0.0.1: bytes=56 Sequence=2 ttl=254 time=90 ms
Reply from 2.0.0.1: bytes=56 Sequence=3 ttl=254 time=30 ms
Reply from 2.0.0.1: bytes=56 Sequence=4 ttl=254 time=30 ms
Reply from 2.0.0.1: bytes=56 Sequence=5 ttl=254 time=40 ms
--- 2.0.0.1 ping statistics ---
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 30/47/90 ms
[r1]ping 3.0.0.1
PING 3.0.0.1: 56 data bytes, press CTRL_C to break
Request time out
Reply from 3.0.0.1: bytes=56 Sequence=2 ttl=254 time=60 ms
Reply from 3.0.0.1: bytes=56 Sequence=3 ttl=254 time=40 ms
Reply from 3.0.0.1: bytes=56 Sequence=4 ttl=254 time=40 ms
Reply from 3.0.0.1: bytes=56 Sequence=5 ttl=254 time=20 ms
--- 3.0.0.1 ping statistics ---
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 20/40/60 ms
[r1]ping 4.0.0.1
PING 4.0.0.1: 56 data bytes, press CTRL_C to break
Request time out
Reply from 4.0.0.1: bytes=56 Sequence=2 ttl=254 time=50 ms
Reply from 4.0.0.1: bytes=56 Sequence=3 ttl=254 time=40 ms
Reply from 4.0.0.1: bytes=56 Sequence=4 ttl=254 time=40 ms
Reply from 4.0.0.1: bytes=56 Sequence=5 ttl=254 time=30 ms
--- 4.0.0.1 ping statistics ---
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 30/40/50 ms
[r1]ping 5.0.0.1
PING 5.0.0.1: 56 data bytes, press CTRL_C to break
Request time out
Reply from 5.0.0.1: bytes=56 Sequence=2 ttl=254 time=40 ms
Reply from 5.0.0.1: bytes=56 Sequence=3 ttl=254 time=30 ms
Reply from 5.0.0.1: bytes=56 Sequence=4 ttl=254 time=40 ms
Reply from 5.0.0.1: bytes=56 Sequence=5 ttl=254 time=30 ms
--- 5.0.0.1 ping statistics ---
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 30/35/40 ms
2.2、使R1R4R5为全连的MGRE结构,R1R4R5都为中心站点
R1
[r1-Tunnel0/0/0]ip address 10.1.1.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp
[r1-Tunnel0/0/0]source 1.0.0.1
[r1-Tunnel0/0/0]nhrp entry multicast dynamic
[r1-Tunnel0/0/0]nhrp entry 10.1.1.2 4.0.0.1 register
[r1-Tunnel0/0/0]nhrp entry 10.1.1.3 5.0.0.1 register
R4
[r4-Tunnel0/0/0]ip address 10.1.1.2
[r4-Tunnel0/0/0]tunnel-protocol gre p2mp
[r4-Tunnel0/0/0]source 4.0.0.1
[r4-Tunnel0/0/0]nhrp entry multicast dynamic
[r4-Tunnel0/0/0]nhrp entry 10.1.1.1 1.0.0.1 register
[r4-Tunnel0/0/0]nhrp entry 10.1.1.3 5.0.0.1 register
R5
[r5-Tunnel0/0/0]ip address 10.1.1.3 24
[r5-Tunnel0/0/0]tunnel-protocol gre p2mp
[r5-Tunnel0/0/0]source 5.0.0.1
[r5-Tunnel0/0/0]nhrp entry multicast dynamic
[r5-Tunnel0/0/0]nhrp entry 10.1.1.1 1.0.0.1 register
[r5-Tunnel0/0/0]nhrp entry 10.1.1.2 4.0.0.1 register
2.3、R1R4R5设置OSPF宣告,设置网络接口类型为Broadcast
R1
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1-area-0.0.0.0]network 10.1.1.1 0.0.0.0
[r1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[r1-Tunnel0/0/0]ospf network-type broadcast
R4
[r4]ospf 1 router-id 4.4.4.4
[r4-ospf-1-area-0.0.0.0]network 10.1.1.2 0.0.0.0
[r4-ospf-1-area-0.0.0.0]network 192.168.4.0 0.0.0.255
[r4-Tunnel0/0/0]ospf network-type broadcast
R5
[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1-area-0.0.0.0]network 10.1.1.3 0.0.0.0
[r5-ospf-1-area-0.0.0.0]network 192.168.5.0 0.0.0.255
[r5-Tunnel0/0/0]ospf network-type broadcast
测试R1R4R5之间全网通:
[r1]ping -a 192.168.1.1 192.168.5.1
PING 192.168.5.1: 56 data bytes, press CTRL_C to break
Reply from 192.168.5.1: bytes=56 Sequence=1 ttl=255 time=40 ms
Reply from 192.168.5.1: bytes=56 Sequence=2 ttl=255 time=40 ms
Reply from 192.168.5.1: bytes=56 Sequence=3 ttl=255 time=40 ms
Reply from 192.168.5.1: bytes=56 Sequence=4 ttl=255 time=30 ms
Reply from 192.168.5.1: bytes=56 Sequence=5 ttl=255 time=30 ms
--- 192.168.5.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/36/40 ms
[r4]ping -a 192.168.4.1 192.168.1.1
PING 192.168.1.1: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.1: bytes=56 Sequence=1 ttl=255 time=30 ms
Reply from 192.168.1.1: bytes=56 Sequence=2 ttl=255 time=30 ms
Reply from 192.168.1.1: bytes=56 Sequence=3 ttl=255 time=40 ms
Reply from 192.168.1.1: bytes=56 Sequence=4 ttl=255 time=30 ms
Reply from 192.168.1.1: bytes=56 Sequence=5 ttl=255 time=30 ms
--- 192.168.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/32/40 ms
[r4]ping -a 192.168.4.1 192.168.5.1
PING 192.168.5.1: 56 data bytes, press CTRL_C to break
Reply from 192.168.5.1: bytes=56 Sequence=1 ttl=255 time=30 ms
Reply from 192.168.5.1: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 192.168.5.1: bytes=56 Sequence=3 ttl=255 time=30 ms
Reply from 192.168.5.1: bytes=56 Sequence=4 ttl=255 time=30 ms
Reply from 192.168.5.1: bytes=56 Sequence=5 ttl=255 time=30 ms
--- 192.168.5.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/28/30 ms
2.4、R1R2R3为星形拓扑结构,R1为中心站点
R1
[r1-Tunnel0/0/1]ip address 10.1.2.1 24
[r1-Tunnel0/0/1]tunnel-protocol gre p2mp
[r1-Tunnel0/0/1]source 6.0.0.1
[r1-Tunnel0/0/1]nhrp entry multicast dynamic
R2
[r2-Tunnel0/0/1]ip address 10.1.2.2 24
[r2-Tunnel0/0/1]tunnel-protocol gre p2mp
[r2-Tunnel0/0/1]source g0/0/0
[r2-Tunnel0/0/1]nhrp entry 10.1.2.1 6.0.0.1 register
R3
[r3-Tunnel0/0/1]ip address 10.1.2.3 24
[r3-Tunnel0/0/1]tunnel-protocol gre p2mp
[r3-Tunnel0/0/1]source g0/0/0
[r3-Tunnel0/0/1]nhrp entry 10.1.2.1 6.0.0.1 register
2.5、R1R2R3设置OSPF宣告等配置
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1-area-0.0.0.0]network 10.1.2.1 0.0.0.0
[r1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[r1-Tunnel0/0/1]ospf network-type broadcast
R2
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1-area-0.0.0.0]network 10.1.2.2 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
[r2-Tunnel0/0/1]ospf network-type broadcast
[r2-Tunnel0/0/1]ospf dr-priority 0
R3
[r3]ospf 1 router-id 3.3.3.3
[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]network 192.168.3.0 0.0.0.255
[r3-Tunnel0/0/1]ospf network-type broadcast
[r3-Tunnel0/0/1]ospf dr-priority 0
三、测试私网公网能否ping通:
<r1>ping -a 192.168.1.1 192.168.3.1
PING 192.168.3.1: 56 data bytes, press CTRL_C to break
Reply from 192.168.3.1: bytes=56 Sequence=1 ttl=255 time=40 ms
Reply from 192.168.3.1: bytes=56 Sequence=2 ttl=255 time=30 ms
Reply from 192.168.3.1: bytes=56 Sequence=3 ttl=255 time=50 ms
Reply from 192.168.3.1: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 192.168.3.1: bytes=56 Sequence=5 ttl=255 time=30 ms
--- 192.168.3.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/34/50 ms
<r1>ping -a 10.1.2.1 10.1.2.2
PING 10.1.2.2: 56 data bytes, press CTRL_C to break
Reply from 10.1.2.2: bytes=56 Sequence=1 ttl=255 time=50 ms
Reply from 10.1.2.2: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 10.1.2.2: bytes=56 Sequence=3 ttl=255 time=40 ms
Reply from 10.1.2.2: bytes=56 Sequence=4 ttl=255 time=30 ms
Reply from 10.1.2.2: bytes=56 Sequence=5 ttl=255 time=40 ms
--- 10.1.2.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/36/50 ms
<r1>ping -a 10.1.2.1 10.1.2.3
PING 10.1.2.3: 56 data bytes, press CTRL_C to break
Reply from 10.1.2.3: bytes=56 Sequence=1 ttl=255 time=30 ms
Reply from 10.1.2.3: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 10.1.2.3: bytes=56 Sequence=3 ttl=255 time=20 ms
Reply from 10.1.2.3: bytes=56 Sequence=4 ttl=255 time=40 ms
Reply from 10.1.2.3: bytes=56 Sequence=5 ttl=255 time=30 ms
--- 10.1.2.3 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/28/40 ms
<r2>ping -a 10.1.2.2 10.1.1.2
PING 10.1.1.2: 56 data bytes, press CTRL_C to break
Reply from 10.1.1.2: bytes=56 Sequence=1 ttl=254 time=50 ms
Reply from 10.1.1.2: bytes=56 Sequence=2 ttl=254 time=40 ms
Reply from 10.1.1.2: bytes=56 Sequence=3 ttl=254 time=50 ms
Reply from 10.1.1.2: bytes=56 Sequence=4 ttl=254 time=40 ms
Reply from 10.1.1.2: bytes=56 Sequence=5 ttl=254 time=50 ms
--- 10.1.1.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 40/46/50 ms
<r2>ping -a 10.1.2.2 10.1.1.3
PING 10.1.1.3: 56 data bytes, press CTRL_C to break
Reply from 10.1.1.3: bytes=56 Sequence=1 ttl=254 time=50 ms
Reply from 10.1.1.3: bytes=56 Sequence=2 ttl=254 time=50 ms
Reply from 10.1.1.3: bytes=56 Sequence=3 ttl=254 time=40 ms
Reply from 10.1.1.3: bytes=56 Sequence=4 ttl=254 time=40 ms
Reply from 10.1.1.3: bytes=56 Sequence=5 ttl=254 time=30 ms
--- 10.1.1.3 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/42/50 ms
<r2>ping -a 10.1.2.2 192.168.5.1
PING 192.168.5.1: 56 data bytes, press CTRL_C to break
Reply from 192.168.5.1: bytes=56 Sequence=1 ttl=254 time=30 ms
Reply from 192.168.5.1: bytes=56 Sequence=2 ttl=254 time=40 ms
Reply from 192.168.5.1: bytes=56 Sequence=3 ttl=254 time=40 ms
Reply from 192.168.5.1: bytes=56 Sequence=4 ttl=254 time=30 ms
Reply from 192.168.5.1: bytes=56 Sequence=5 ttl=254 time=40 ms
--- 192.168.5.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/36/40 ms