CCNP-7 OSPF试验3
试验拓扑:
试验要求:
R1 R2 R3
通过
FR
相连,形成
hub and spoke
网络,
R1
为
hub
路由器,在
R1 R2 R3
上起
OSPF
。
试验目的:掌握
OSPF
在
NBMA
环境下的配置和观察
OSPF
在
NBMA
下特征。
试验配置:
R1
:
interface Loopback0
ip address 100.100.100.100 255.255.255.0
ip ospf network point-to-point
!
interface Loopback1
ip address 192.168.1.1 255.255.255.0
ip ospf network point-to-point
!
interface Serial1/0
ip address 199.99.1.1 255.255.255.0
encapsulation frame-relay
serial restart-delay 0
frame-relay map ip 199.99.1.1 301 broadcast
frame-relay map ip 199.99.1.2 301 broadcast
frame-relay map ip 199.99.1.3 302 broadcast
no frame-relay inverse-arp
!
router ospf 100
router-id 100.100.100.100
log-adjacency-changes
network 100.100.100.0
0.0.0
.255 area 0
network 192.168.1.0
0.0.0
.255 area 0
network 199.99.1.0
0.0.0
.255 area 0
neighbor 199.99.1.2
neighbor 199.99.1.3
R2
:
interface Loopback0
ip address
2.2.2
.2 255.255.255.0
ip ospf network point-to-point
!
interface Loopback1
ip address 192.168.2.1 255.255.255.0
ip ospf network point-to-point
!
interface Serial1/0
ip address 199.99.1.2 255.255.255.0
encapsulation frame-relay
serial restart-delay 0
frame-relay map ip 199.99.1.1 103 broadcast
frame-relay map ip 199.99.1.3 103 broadcast
no frame-relay inverse-arp
!
router ospf 100
router-id
2.2.2
.2
log-adjacency-changes
network
2.2.2
.0 0.0.0.255 area 0
network 192.168.2.0
0.0.0
.255 area 0
network 199.99.1.0
0.0.0
.255 area 0
neighbor 199.99.1.1
R3
:
interface Loopback0
ip address
3.3.3
.3 255.255.255.0
ip ospf network point-to-point
!
interface Loopback1
ip address 192.168.3.1 255.255.255.0
ip ospf network point-to-point
!
interface Serial1/0
ip address 199.99.1.3 255.255.255.0
encapsulation frame-relay
serial restart-delay 0
frame-relay map ip 199.99.1.1 203 broadcast
frame-relay map ip 199.99.1.2 203 broadcast
no frame-relay inverse-arp
!
router ospf 100
router-id
3.3.3
.3
log-adjacency-changes
network
3.3.3
.0 0.0.0.255 area 0
network 192.168.3.0
0.0.0
.255 area 0
network 199.99.1.0
0.0.0
.255 area 0
neighbor 199.99.1.1
以上为基本配置,要注意用红颜色标记的部分,
因为在
NBMA
环境下,邻居关系是不会自动建立的,所以要手动添加邻居,这样他们在建立邻居关系的时候发送的不是组播,而是单播。
然后我们用
show ip ospf interface
命令查看接口:
R1#show ip ospf interface
Loopback0 is up, line protocol is up
Internet Address 100.100.100.100/24, Area 0
Process ID 100, Router ID 100.100.100.100, Network Type POINT_TO_POINT, Cost: 1
Transmit Delay is 1 sec, State POINT_TO_POINT,
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Supports Link-local Signaling (LLS)
Index 3/3, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 0, maximum is 0
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 0, Adjacent neighbor count is 0
Suppress hello for 0 neighbor(s)
Loopback1 is up, line protocol is up
Internet Address 192.168.1.1/24, Area 0
Process ID 100, Router ID 100.100.100.100, Network Type POINT_TO_POINT, Cost: 1
Transmit Delay is 1 sec, State POINT_TO_POINT,
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Supports Link-local Signaling (LLS)
Index 2/2, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 0, maximum is 0
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 0, Adjacent neighbor count is 0
Suppress hello for 0 neighbor(s)
Serial1/0 is up, line protocol is up
Internet Address 199.99.1.1/24, Area 0
Process ID 100, Router ID 100.100.100.100, Network Type NON_BROADCAST, Cost: 64
Transmit Delay is 1 sec,
State DR
, Priority 1
Designated Router (ID) 100.100.100.100, Interface address 199.99.1.1
Backup Designated router (ID)
3.3.3
.3, Interface address 199.99.1.3
Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5
oob-resync timeout 120
Hello due in 00:00:28
Supports Link-local Signaling (LLS)
Index 1/1, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 0 msec, maximum is 4 msec
Neighbor Count is 2, Adjacent neighbor count is 2
Adjacent with neighbor
2.2.2
.2
Adjacent with neighbor
3.3.3
.3 (Backup Designated Router)
Suppress hello for 0 neighbor(s)
R2#show ip ospf interface
Loopback0 is up, line protocol is up
Internet Address
2.2.2
.2/24, Area 0
Process ID 100, Router ID
2.2.2
.2, Network Type POINT_TO_POINT, Cost: 1
Transmit Delay is 1 sec, State POINT_TO_POINT,
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Supports Link-local Signaling (LLS)
Index 3/3, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 0, maximum is 0
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 0, Adjacent neighbor count is 0
Suppress hello for 0 neighbor(s)
Loopback1 is up, line protocol is up
Internet Address 192.168.2.1/24, Area 0
Process ID 100, Router ID
2.2.2
.2, Network Type POINT_TO_POINT, Cost: 1
Transmit Delay is 1 sec, State POINT_TO_POINT,
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Supports Link-local Signaling (LLS)
Index 2/2, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 0, maximum is 0
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 0, Adjacent neighbor count is 0
Suppress hello for 0 neighbor(s)
Serial1/0 is up, line protocol is up
Internet Address 199.99.1.2/24, Area 0
Process ID 100, Router ID
2.2.2
.2, Network Type NON_BROADCAST, Cost: 64
Transmit Delay is 1 sec, State BDR, Priority 1
Designated Router (ID) 100.100.100.100, Interface address 199.99.1.1
Backup Designated router (ID)
2.2.2
.2, Interface address 199.99.1.2
Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5
oob-resync timeout 120
Hello due in 00:00:03
Supports Link-local Signaling (LLS)
Index 1/1, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 100.100.100.100 (Designated Router)
Suppress hello for 0 neighbor(s)
R3#show ip ospf interface
Loopback0 is up, line protocol is up
Internet Address
3.3.3
.3/24, Area 0
Process ID 100, Router ID
3.3.3
.3, Network Type POINT_TO_POINT, Cost: 1
Transmit Delay is 1 sec, State POINT_TO_POINT,
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Supports Link-local Signaling (LLS)
Index 3/3, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 0, maximum is 0
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 0, Adjacent neighbor count is 0
Suppress hello for 0 neighbor(s)
Loopback1 is up, line protocol is up
Internet Address 192.168.3.1/24, Area 0
Process ID 100, Router ID
3.3.3
.3, Network Type POINT_TO_POINT, Cost: 1
Transmit Delay is 1 sec, State POINT_TO_POINT,
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Supports Link-local Signaling (LLS)
Index 2/2, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 0, maximum is 0
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 0, Adjacent neighbor count is 0
Suppress hello for 0 neighbor(s)
Serial1/0 is up, line protocol is up
Internet Address 199.99.1.3/24, Area 0
Process ID 100, Router ID
3.3.3
.3, Network Type NON_BROADCAST, Cost: 64
Transmit Delay is 1 sec, State BDR, Priority 1
Designated Router (ID) 100.100.100.100, Interface address 199.99.1.1
Backup Designated router (ID)
3.3.3
.3, Interface address 199.99.1.3
Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5
oob-resync timeout 120
Hello due in 00:00:25
Supports Link-local Signaling (LLS)
Index 1/1, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 100.100.100.100 (Designated Router)
Suppress hello for 0 neighbor(s)
要注意在这里用红色标记的部分,接口类型为
NON_BROADCAST
,默认的
HELLO
时间间隔为
30
秒,等待时间和死亡时间为
HELLO
时间间隔的四倍,也就是
120
秒。然后再用
show ip ospf neighbor
查看各自的邻居关系:
R1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
R2#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
100.100.100.100 1 FULL/DR 00:01:38 199.99.1.1 Serial1/0
R3#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
100.100.100.100 1 FULL/DR 00:01:33 199.99.1.1 Serial1/0
可以发现有
DR/BDR
的选择,一般情况下
DR
由
hub
路由器担当。
所以这里我们把
hub
路由器的
router-id
设置为最高,或者修改优先级也可以做到使
hub
路由器成为
DR
的目的,如在
R2 R3
的接口下打上这样的一条命令:
ip ospf priority 0
,
配置完后就可以使
R2 R3
丧失
DR/BDR
的选举。
最后查看以下各自的路由表:
R1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O -
OSPF
,
IA
- OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
O
2.2.2
.0 [110/65] via 199.99.1.2, 00:01:40, Serial1/0
100.0.0.0/24 is subnetted, 1 subnets
C 100.100.100.0 is directly connected, Loopback0
O
3.3.3
.0 [110/65] via 199.99.1.3, 00:01:40, Serial1/0
C 199.99.1.0/24 is directly connected, Serial1/0
C 192.168.1.0/24 is directly connected, Loopback1
O 192.168.2.0/24 [110/65] via 199.99.1.2, 00:01:40, Serial1/0
O 192.168.3.0/24 [110/65] via 199.99.1.3, 00:01:40, Serial1/0
R2#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O -
OSPF
,
IA
- OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
C
2.2.2
.0 is directly connected, Loopback0
100.0.0.0/24 is subnetted, 1 subnets
O 100.100.100.0 [110/65] via 199.99.1.1, 00:01:45, Serial1/0
O
3.3.3
.0 [110/65] via 199.99.1.3, 00:01:45, Serial1/0
C 199.99.1.0/24 is directly connected, Serial1/0
O 192.168.1.0/24 [110/65] via 199.99.1.1, 00:01:45, Serial1/0
C 192.168.2.0/24 is directly connected, Loopback1
O 192.168.3.0/24 [110/65] via 199.99.1.3, 00:01:45, Serial1/0
R3#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O -
OSPF
,
IA
- OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
O
2.2.2
.0 [110/65] via 199.99.1.2, 00:01:41, Serial1/0
100.0.0.0/24 is subnetted, 1 subnets
O 100.100.100.0 [110/65] via 199.99.1.1, 00:01:41, Serial1/0
C
3.3.3
.0 is directly connected, Loopback0
C 199.99.1.0/24 is directly connected, Serial1/0
O 192.168.1.0/24 [110/65] via 199.99.1.1, 00:01:41, Serial1/0
O 192.168.2.0/24 [110/65] via 199.99.1.2, 00:01:41, Serial1/0
C 192.168.3.0/24 is directly connected, Loopback1
实验中遇到的问题:最初的时候我只在
R2 R3
上作了一个静态的映射,就是到
R1
的映射,自己以为可以通过
OSPF
学习到到达对端
sopke
路由器的路由,可是都配置完成后发现无法
ping
通,查看路由表的时候发现了问题的所在:
C 199.99.1.0/24 is directly connected, Serial1/0
看到了吧,因为三台路由器的
IP
地址在同一网段,所以直连的路由的管理距离为
0
,而
OSPF
的管理距离为
110
,所以路由表里只会出现直接的路由,但是如果要达到对端
spoke
路由器,没有做静态映射是无法到达的,所以才出现了
R2
无法
ping
通
R3
的情况:
R2#ping 199.99.1.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 199.99.1.3, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
R2#ping
3.3.3
.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to
3.3.3
.3, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
分别在
R2 R3
上加上到达对端
spoke
路由器的静态映射后,就可以
ping
通了。
R2#ping 192.168.3.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.3.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 264/340/428 ms
R2#ping
Protocol [ip]:
Target IP address: 192.168.3.1
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface: 192.168.2.1
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.3.1, timeout is 2 seconds:
Packet sent with a source address of 192.168.2.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 332/354/384 ms
实验总结:掌握在
NBMA
环境下面,接口默认的网络类型为
NBMA
,邻居关系不会自动建立,需要手动添加邻居,并且有
DR/BDR
的选举,默认的
HELLO
时间间隔为
30
秒,等待时间和死亡时间为
HELLO
时间间隔的
4
倍,
120
秒。
本文转自loveme2351CTO博客,原文链接
http://blog.51cto.com/loveme23/46097
: ,如需转载请自行联系原作者