题目
要求
- R4为ISP,其上只能配置IP地址。R4与其他所有直连设备间均使用公有IP;
- R3-R5/R6/R7为MGRE环境,R3为中心点;
- 整个OSPF环境IP基于172.16.0.0/16划分;
- 所有设备均可访问R4的环回;
- 减少LSA的更新量,加快收敛,保障更新安全;
- 全网可达。
分析
图中23个广播域
地址 | IP数量 | 网段 | 子网掩码 |
---|---|---|---|
13个环回地址(OSPF) | 1 | 172.16.1-13.0 | 24 |
9个链路地址 | 2 | 172.16.0.0 | 30 |
交换机链路地址 | 3 | 172.16.14.0 | 24 |
配置
R1
interface GigabitEthernet0/0/0
ip address 172.16.16.1 255.255.255.0
#
interface LoopBack0
ip address 172.16.1.1 255.255.255.0
#
ospf 1 router-id 1.1.1.1
area 0.0.0.1
network 172.16.1.1 0.0.0.0
network 172.16.16.1 0.0.0.0
nssa
R2
interface GigabitEthernet0/0/0
ip address 172.16.16.2 255.255.255.0
#
interface LoopBack0
ip address 172.16.2.1 255.255.255.0
#
ospf 1 router-id 2.2.2.2
area 0.0.0.1
network 172.16.2.1 0.0.0.0
network 172.16.16.2 0.0.0.0
nssa
R3
acl number 2000
rule 5 permit source 172.16.0.0 0.0.255.255
#
interface Serial1/0/0
link-protocol ppp
ip address 172.16.34.1 255.255.255.0
nat outbound 2000
#
interface GigabitEthernet0/0/0
ip address 172.16.16.3 255.255.255.0
#
interface LoopBack0
ip address 172.16.3.1 255.255.255.0
#
interface Tunnel0/0/0
ip address 172.16.99.3 255.255.255.0
tunnel-protocol gre p2mp
source Serial1/0/0
ospf network-type broadcast
nhrp entry multicast dynamic
#
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 172.16.34.1 0.0.0.0
area 0.0.0.1
network 172.16.3.1 0.0.0.0
network 172.16.16.3 0.0.0.0
nssa no-summary
#
ip route-static 0.0.0.0 0.0.0.0 172.16.34.2
R4
interface Serial1/0/0
link-protocol ppp
ip address 172.16.34.2 255.255.255.0
#
interface Serial1/0/1
link-protocol ppp
ip address 172.16.45.1 255.255.255.0
#
interface Serial2/0/0
link-protocol ppp
ip address 172.16.46.1 255.255.255.0
#
interface GigabitEthernet0/0/0
ip address 172.16.47.1 255.255.255.0
#
interface LoopBack0
ip address 172.16.4.1 255.255.255.0
R5
acl number 2000
rule 5 permit source 172.16.0.0 0.0.255.255
#
interface Serial1/0/0
link-protocol ppp
ip address 172.16.45.2 255.255.255.0
nat outbound 2000
#
interface LoopBack0
ip address 172.16.5.1 255.255.255.0
#
interface Tunnel0/0/0
ip address 172.16.99.5 255.255.255.0
tunnel-protocol gre p2mp
source Serial1/0/0
ospf dr-priority 0
nhrp entry 172.16.99.3 172.16.34.1 register
#
ospf 1 router-id 5.5.5.5
area 0.0.0.0
network 172.16.5.1 0.0.0.0
network 172.16.45.2 0.0.0.0
#
ip route-static 0.0.0.0 0.0.0.0 172.16.45.1
R6
acl number 2000
rule 5 permit source 172.16.0.0 0.0.255.255
#
interface Serial1/0/0
link-protocol ppp
ip address 172.16.46.2 255.255.255.0
nat outbound 2000
#
interface GigabitEthernet0/0/0
ip address 172.16.0.29 255.255.255.252
#
interface LoopBack0
ip address 172.16.6.1 255.255.255.0
#
interface Tunnel0/0/0
ip address 172.16.99.6 255.255.255.0
tunnel-protocol gre p2mp
source Serial1/0/0
ospf dr-priority 0
nhrp entry 172.16.99.3 172.16.34.1 register
#
ospf 1 router-id 6.6.6.6
area 0.0.0.0
network 172.16.6.1 0.0.0.0
network 172.16.46.2 0.0.0.0
area 0.0.0.2
network 172.16.0.29 0.0.0.0
nssa no-summary
#
ip route-static 0.0.0.0 0.0.0.0 172.16.46.1
R7
acl number 2000
rule 5 permit source 172.16.0.0 0.0.255.255
#
interface GigabitEthernet0/0/0
ip address 172.16.47.2 255.255.255.0
nat outbound 2000
#
interface GigabitEthernet0/0/1
ip address 172.16.0.17 255.255.255.252
#
interface LoopBack0
ip address 172.16.7.1 255.255.255.0
#
interface Tunnel0/0/0
ip address 172.16.99.7 255.255.255.0
tunnel-protocol gre p2mp
source GigabitEthernet0/0/0
ospf dr-priority 0
nhrp entry 172.16.99.3 172.16.34.1 register
#
ospf 1 router-id 7.7.7.7
area 0.0.0.0
network 172.16.7.1 0.0.0.0
network 172.16.47.2 0.0.0.0
area 0.0.0.3
network 172.16.0.17 0.0.0.0
vlink-peer 9.9.9.9
#
ip route-static 0.0.0.0 0.0.0.0 172.16.47.1
R8
interface GigabitEthernet0/0/0
ip address 172.16.0.18 255.255.255.252
#
interface GigabitEthernet0/0/1
ip address 172.16.0.21 255.255.255.252
#
interface LoopBack0
ip address 172.16.8.1 255.255.255.0
#
ospf 1 router-id 8.8.8.8
area 0.0.0.3
network 172.16.0.18 0.0.0.0
network 172.16.0.21 0.0.0.0
network 172.16.8.1 0.0.0.0
R9
interface GigabitEthernet0/0/0
ip address 172.16.0.22 255.255.255.252
#
interface GigabitEthernet0/0/1
ip address 172.16.0.25 255.255.255.252
#
interface LoopBack0
ip address 172.16.9.1 255.255.255.0
#
ospf 1 router-id 9.9.9.9
area 0.0.0.3
network 172.16.0.22 0.0.0.0
vlink-peer 7.7.7.7
area 0.0.0.4
network 172.16.0.25 0.0.0.0
network 172.16.9.1 0.0.0.0
nssa no-summary
R10
interface GigabitEthernet0/0/0
ip address 172.16.0.26 255.255.255.252
#
interface LoopBack0
ip address 172.16.10.1 255.255.255.0
#
ospf 1 router-id 10.10.10.10
area 0.0.0.4
network 172.16.0.26 0.0.0.0
network 172.16.10.1 0.0.0.0
R11
interface GigabitEthernet0/0/0
ip address 172.16.0.30 255.255.255.252
#
interface GigabitEthernet0/0/1
ip address 172.16.0.33 255.255.255.252
#
interface LoopBack0
ip address 172.16.11.1 255.255.255.0
#
ospf 1 router-id 11.11.11.11
area 0.0.0.2
network 172.16.0.30 0.0.0.0
network 172.16.0.33 0.0.0.0
network 172.16.11.1 0.0.0.0
nssa
R12
interface GigabitEthernet0/0/0
ip address 172.16.0.34 255.255.255.252
#
interface LoopBack0
ip address 172.16.12.1 255.255.255.0
#
interface LoopBack1
ip address 172.16.13.1 255.255.255.0
#
ospf 1 router-id 12.12.12.12
import-route rip 1
area 0.0.0.2
network 172.16.0.34 0.0.0.0
nssa
#
rip 1
version 2
network 172.16.0.0
测试
<r1>ping 172.16.4.1
PING 172.16.4.1: 56 data bytes, press CTRL_C to break
Reply from 172.16.4.1: bytes=56 Sequence=1 ttl=254 time=80 ms
Reply from 172.16.4.1: bytes=56 Sequence=2 ttl=254 time=50 ms
Reply from 172.16.4.1: bytes=56 Sequence=3 ttl=254 time=40 ms
Reply from 172.16.4.1: bytes=56 Sequence=4 ttl=254 time=50 ms
Reply from 172.16.4.1: bytes=56 Sequence=5 ttl=254 time=50 ms
--- 172.16.4.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 40/54/80 ms
<r12>ping 172.16.4.1
PING 172.16.4.1: 56 data bytes, press CTRL_C to break
Reply from 172.16.4.1: bytes=56 Sequence=1 ttl=253 time=60 ms
Reply from 172.16.4.1: bytes=56 Sequence=2 ttl=253 time=30 ms
Reply from 172.16.4.1: bytes=56 Sequence=3 ttl=253 time=30 ms
Reply from 172.16.4.14: bytes=56 Sequence=4 ttl=253 time=20 ms
Reply from 172.16.4.1: bytes=56 Sequence=5 ttl=253 time=40 ms
--- 172.16.4.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/36/60 ms
<r11>ping 172.16.4.1
PING 172.16.4.1: 56 data bytes, press CTRL_C to break
Reply from 172.16.4.1: bytes=56 Sequence=1 ttl=254 time=40 ms
Reply from 172.16.4.1: bytes=56 Sequence=2 ttl=254 time=30 ms
Reply from 172.16.4.1: bytes=56 Sequence=3 ttl=254 time=30 ms
Reply from 172.16.4.1: bytes=56 Sequence=4 ttl=254 time=20 ms
Reply from 172.16.4.1: bytes=56 Sequence=5 ttl=254 time=20 ms
--- 172.16.4.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/28/40 ms