CCNP-10 OSPF试验6
实验拓扑:
实验要求:
R1 R2 R3
通过
FR
相连,形成
hub and spoke
网络拓扑,
R1
为
hub
路由器,
R2
为
spoke
路由器,在
R1
上采用点到多点子接口,
R2 R3
全部采用物理接口,全部起
OSPF
,并且
R1
接口的网络类型配置为点到多点
NBMA
。
试验目的:掌握
OSPF
的点到多点
NBMA
接口类型的配置方法。
实验配置:
R1
:
R1(config)#int s1/0
R1(config-if)#enca frame-relay
R1(config-if)#no shu
R1(config-if)#exit
R1(config)#int s1/0.1 multipoint
R1(config-subif)#ip add 199.99.1.1 255.255.255.0
R1(config-subif)#frame-relay map ip 199.99.1.2 301 broadcast
R1(config-subif)#frame-relay map ip 199.99.1.3 302 broadcast
R1(config-subif)#no shu
R1(config-subif)#exit
R2
:
R2(config)#int s1/0
R2(config-if)#enca frame-relay
R2(config-if)#ip add 199.99.1.2 255.255.255.0
R2(config-if)#no frame-relay inverse-arp
R2(config-if)#frame-relay map ip 199.99.1.1 103 broadcast
R2(config-if)#frame-relay map ip 199.99.1.2 103 broadcast
R2(config-if)#frame-relay map ip 199.99.1.3 103 broadcast
R2(config-if)#no shu
R2(config-if)#exit
R3
:
R3(config)#int s1/0
R3(config-if)#ip add 199.99.1.3 255.255.255.0
R3(config-if)#enca frame-relay
R3(config-if)#no frame-relay inverse-arp
R3(config-if)#frame-relay map ip 199.99.1.1 203 broadcast
R3(config-if)#frame-relay map ip 199.99.1.2 203 broadcast
R3(config-if)#frame-relay map ip 199.99.1.3 203 broadcast
R3(config-if)#no shu
R3(config-if)#exit
基本的链路层配置完成,下面
ping
测试一下连通性:
R1#ping 199.99.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 199.99.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 168/220/308 ms
R1#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 100 percent (5/5), round-trip min/avg/max = 164/186/216 ms
OK
,都通了,下面开始
OSPF
的配置:
R1(config)#int loop0
R1(config-if)#ip add 100.100.100.100 255.255.255.0
R1(config-if)#ip ospf network point-to-point
R1(config-if)#exit
R1(config)#int s1/0.1 multipoint
R1(config-subif)#ip ospf network point-to-multipoint non-broadcast
R1(config-subif)#exit
R1(config)#router ospf 100
R1(config-router)#router
R1(config-router)#router-id 100.100.100.100
R1(config-router)#network 0.0.0 .0 255.255.255.255 area 0
R1(config-router)#exit
R2(config)#int loop0
R2(config-if)#ip add 2.2.2 .2 255.255.255.0
R2(config-if)#ip ospf network point-to-point
R2(config-if)#exit
R2(config)#int s1/0
R2(config-if)#ip ospf network point-to-multipoint non-broadcast
R2(config-if)#exit
R2(config-if)#router ospf 100
R2(config-router)#router-id 2.2.2 .2
R2(config-router)#network 0.0.0 .0 255.255.255.255 area 0
R2(config-router)#exit
R3(config)#int loop0
R3(config-if)#ip add 3.3.3 .3 255.255.255.0
R3(config-if)#ip ospf network point-to-point
R3(config-if)#exit
R3(config)#int s1/0
R3(config-if)#ip ospf network point-to-multipoint non-broadcast
R3(config-if)#exit
R3(config)#router ospf 100
R3(config-router)#router-id 3.3.3 .3
R3(config-router)#network 0.0.0 .0 255.255.255.255 area 0
R3(config-router)#exit
好了,下面我们
show ip ospf neighbor
看一下能否成功建立邻居关系,结果发现无法成功建立邻居关系,因为我们在上面的接口上配置了
ip ospf network point-to-multipoint non-broadcast
这条命令,如果是点对多点的话,前面我们也做过试验,邻居关系是自动建立的,没有
DR/BDR
的选举,但是这里我们在后面加了一个
non-broadcast
选项,这就需要我们像在配置
NBMA
模式的时候手动添加邻居,如下:
R1(config)#router ospf 100
R1(config-router)#neighbor 199.99.1.2
R1(config-router)#neighbor 199.99.1.3
R2(config)#router ospf 100
R2(config-router)#neighbor 199.99.1.1
R3(config)#router ospf 100
R3(config-router)#neighbor 199.99.1.1
这样配置完成后我们在
R1
上
debug ip ospf adj
看一下效果:
R1#debug ip ospf adj
OSPF adjacency events debugging is on
R1#clear ip ospf p
Reset ALL OSPF processes? [no]: y
*Mar 1 00:05:59.743: OSPF: Interface Serial1/0.1 going Down
*Mar 1 00:05:59.743: OSPF: 100.100.100.100 address 199.99.1.1 on Serial1/0.1 is dead, state DOWN
*Mar 1 00:05:59.743: OSPF: 0.0.0 .0 address 199.99.1.3 on Serial1/0.1 is dead, state DOWN
*Mar 1 00:05:59.747: %OSPF-5-ADJCHG: Process 100, Nbr 0.0.0 .0 on Serial1/0.1 from DOWN to DOWN, Neighbor Down: Interface down or detached
*Mar 1 00:05:59.747: OSPF: 0.0.0 .0 address 199.99.1.2 on Serial1/0.1 is dead, state DOWN
*Mar 1 00:05:59.747: %OSPF-5-ADJCHG: Process 100, Nbr 0.0.0 .0 on Serial1/0.1 from DOWN to DOWN, Neighbor Down: Interface down or detached
*Mar 1 00:05:59.751: OSPF: Interface Loopback0 going Down
*Mar 1 00:05:59.751: OSPF: 100.100.100.100 address 100.100.100.100 on Loopback0 is dead, state DOWN
*Mar 1 00:05:59.763: OSPF: Interface Serial1/0.1 going Up
*Mar 1 00:05:59.763: OSPF: Send hello to 199.99.1.3 area 0 on Serial1/0.1 from 199.99.1.1 //
发送单播
HELLO
包给
199.99.1.3
。
*Mar 1 00:05:59.763: OSPF: Send hello to 199.99.1.2 area 0 on Serial1/0.1 from 199.99.1.1//
发送单播
HELLO
包给
199.99.1.2
。
*Mar 1 00:05:59.767: OSPF: Interface Loopback0 going Up
*Mar 1 00:05:59.959: OSPF: Rcv hello from 3.3.3 .3 area 0 from Serial1/0.1 199.99.1.3 //
收到
R3
发来的
HELLO
包。
*Mar 1 00:05:59.963: OSPF: 2 Way Communication to 3.3.3 .3 on Serial1/0.1, state 2WAY //
与
R3
的邻居关系成为
2 Way
。
*Mar 1 00:05:59.963: OSPF: Send DBD to 3.3.3 .3 on Serial1/0.1 seq 0xEE0 opt 0x52 flag 0x7 len 32 //
发送数据库描述报文给
R3
。
*Mar 1 00:05:59.963: OSPF: End of hello processing
*Mar 1 00:05:59.967: OSPF: Rcv hello from 2.2.2 .2 area 0 from Serial1/0.1 199.99.1.2 //
收到
R2
发来的
HELLO
包。
*Mar 1 00:05:59.967: OSPF: 2 Way Communication to 2.2.2 .2 on Serial1/0.1, state 2WAY //
与
R2
的邻居关系成为
2 Way
。
*Mar 1 00:05:59.967: OSPF: Send DBD to 2.2.2 .2 on Serial1/0.1 seq 0x 13A 4 opt 0x52 flag 0x7 len 32 //
发送数据库描述报文给
R2
。
*Mar 1 00:05:59.971: OSPF: End of hello processing
*Mar 1 00:06:00.079: OSPF: Rcv DBD from 2.2.2 .2 on Serial1/0.1 seq 0x16B2 opt 0x52 flag 0x7 len 32 mtu 1500 state EXSTART //
收到
R2
发来的数据库描述报文,邻居关系变成
EXSTART
。
*Mar 1 00:06:00.083: OSPF: First DBD and we are not SLAVE //MASTER/SLAVE
判断。
*Mar 1 00:06:00.179: OSPF: Rcv DBD from 2.2.2 .2 on Serial1/0.1 seq 0x 13A 4 opt 0x52 flag 0x2 len 52 mtu 1500 state EXSTART
*Mar 1 00:06:00.179: OSPF: NBR Negotiation Done. We are the MASTER //
成为
MASTER
。
*Mar 1 00:06:00.179: OSPF: Send DBD to 2.2.2 .2 on Serial1/0.1 seq 0x 13A 5 opt 0x52 flag 0x1 len 32
*Mar 1 00:06:00.183: OSPF: Rcv DBD from 3.3.3 .3 on Serial1/0.1 seq 0xF43 opt 0x52 flag 0x7 len 32 mtu 1500 state EXSTART //
收到
R3
发来的数据库描述报文,邻居关系变成
EXSTART
。
*Mar 1 00:06:00.183: OSPF: First DBD and we are not SLAVE//MASTER/SLAVE
判断。
*Mar 1 00:06:00.183: OSPF: Rcv DBD from 3.3.3 .3 on Serial1/0.1 seq 0xEE0 opt 0x52 flag 0x2 len 52 mtu 1500 state EXSTART
*Mar 1 00:06:00.183: OSPF: NBR Negotiation Done. We are the MASTER//
成为
MASTER
。
*Mar 1 00:06:00.187: OSPF: Send DBD to 3.3.3 .3 on Serial1/0.1 seq 0xEE1 opt 0x52 flag 0x1 len 32
*Mar 1 00:06:00.247: OSPF: Build router LSA for area 0, router ID 100.100.100.100, seq 0x80000001 //
建立
LSA TYPE-1
。
*Mar 1 00:06:00.467: OSPF: Rcv DBD from 2.2.2 .2 on Serial1/0.1 seq 0x 13A 5 opt 0x52 flag 0x0 len 32 mtu 1500 state EXCHANGE //
与
R2
的邻居关系变为
EXCHANGE
。
*Mar 1 00:06:00.467: OSPF: Exchange Done with 2.2.2 .2 on Serial1/0.1
*Mar 1 00:06:00.467: OSPF: Send LS REQ to 2.2.2 .2 length 12 LSA count 1 //
发送
LSR
给
R2
。
*Mar 1 00:06:00.471: OSPF: Rcv DBD from 3.3.3 .3 on Serial1/0.1 seq 0xEE1 opt 0x52 flag 0x0 len 32 mtu 1500 state EXCHANGE//
与
R3
的邻居关系变为
EXCHANGE
。
*Mar 1 00:06:00.471: OSPF: Exchange Done with 3.3.3 .3 on Serial1/0.1
*Mar 1 00:06:00.471: OSPF: Send LS REQ to 3.3.3 .3 length 12 LSA count 1//
发送
LSR
给
R3
。
*Mar 1 00:06:00.727: OSPF: Rcv LS UPD from 2.2.2 .2 on Serial1/0.1 length 76 LSA count 1//
收到
R2
发送来的
LSU
更新报文。
*Mar 1 00:06:00.731: OSPF: Synchronized with 2.2.2 .2 on Serial1/0.1, state FULL
*Mar 1 00:06:00.731: %OSPF-5-ADJCHG: Process 100, Nbr 2.2.2 .2 on Serial1/0.1 from LOADING to FULL, Loading Done//LSDB
与
R2
达成一致,邻居关系转为
FULL
状态。
*Mar 1 00:06:00.735: OSPF: Rcv LS UPD from 3.3.3 .3 on Serial1/0.1 length 76 LSA count 1//
收到
R3
发送来的
LSU
更新报文。
*Mar 1 00:06:00.735: OSPF: Synchronized with 3.3.3 .3 on Serial1/0.1, state FULL
*Mar 1 00:06:00.735: %OSPF-5-ADJCHG: Process 100, Nbr 3.3.3 .3 on Serial1/0.1 from LOADING to FULL, Loading Done//LSDB
与
R3
达成一致,邻居关系转为
FULL
状态。
*Mar 1 00:06:00.895: OSPF: Rcv LS UPD from 2.2.2 .2 on Serial1/0.1 length 88 LSA count 1
*Mar 1 00:06:00.903: OSPF: Rcv LS UPD from 3.3.3 .3 on Serial1/0.1 length 88 LSA count 1
*Mar 1 00:06:06.235: OSPF: Build router LSA for area 0, router ID 100.100.100.100, seq 0x80000002
*Mar 1 00:06:06.235: OSPF: Rcv hello from 2.2.2 .2 area 0 from Serial1/0.1 199.99.1.2
*Mar 1 00:06:06.239: OSPF: End of hello processing
通过
debug
信息我们可以清楚地看到整个邻居建立过程和路由更新过程,然后我们
show ip ospf neighbor
查看一下邻居关系表:
R1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
3.3.3
.3 0 FULL/ - 00:01:58 199.99.1.3 Serial1/0.1
2.2.2
.2 0 FULL/ - 00:01:59 199.99.1.2 Serial1/0.1
R2#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
100.100.100.100 0 FULL/ - 00:01:37 199.99.1.1 Serial1/0
R3#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
100.100.100.100 0 FULL/ - 00:01:37 199.99.1.1 Serial1/0
成功地建立了邻居关系,我们还可以发现没有
DR/BDR
的选举,我们用
show ip ospf interface
看一下接口的
OSPF
配置:
R1#show ip ospf interface
Serial1/0.1 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 POINT_TO_MULTIPOINT, Cost: 64
Transmit Delay is 1 sec, State POINT_TO_MULTIPOINT,
Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5
oob-resync timeout 120
Hello due in 00:00:04
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 4 msec, maximum is 4 msec
Neighbor Count is 2, Adjacent neighbor count is 2
Adjacent with neighbor 3.3.3 .3
Adjacent with neighbor 2.2.2 .2
Suppress hello for 0 neighbor(s)
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 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)
R2#show ip ospf interface
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 POINT_TO_MULTIPOINT, Cost: 64
Transmit Delay is 1 sec, State POINT_TO_MULTIPOINT,
Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5
oob-resync timeout 120
Hello due in 00:00:08
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
Suppress hello for 0 neighbor(s)
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 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)
R3#show ip ospf interface
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 POINT_TO_MULTIPOINT, Cost: 64
Transmit Delay is 1 sec, State POINT_TO_MULTIPOINT,
Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5
oob-resync timeout 120
Hello due in 00:00:09
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
Suppress hello for 0 neighbor(s)
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 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)
注意这里用红色表里的部分,接口的网络类型为
POINT_TO_MULTIPOINT
,(纯
POINT_TO_MULTIPOINT
情况下,邻居关系自动建立,但是我们在配置的时候加了一个
non-broadcast
选项,这样的话需要像在配置
NBMA
时手动添加邻居,但是与
NBMA
不同的是,
NBMA
下有
DR/BDR
的选举,而这里没有
),默认的
HELLO
时间间隔为
30
秒,等待时间和死亡时间为
HELLO
时间间隔的
4
倍,
120
秒。
最后我们查看一下路由表:
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
2.0.0 .0/24 is subnetted, 1 subnets
O 2.2.2 .0 [110/65] via 199.99.1.2, 00:00:04, Serial1/0.1
100.0.0.0/24 is subnetted, 1 subnets
C 100.100.100.0 is directly connected, Loopback0
3.0.0 .0/24 is subnetted, 1 subnets
O 3.3.3 .0 [110/65] via 199.99.1.3, 00:00:04, Serial1/0.1
199.99.1.0/24 is variably subnetted, 3 subnets, 2 masks
C 199.99.1.0/24 is directly connected, Serial1/0.1
O 199.99.1.3/32 [110/64] via 199.99.1.3, 00:00:04, Serial1/0.1
O 199.99.1.2/32 [110/64] via 199.99.1.2, 00:00:04, Serial1/0.1
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
2.0.0 .0/24 is subnetted, 1 subnets
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:00:01, Serial1/0
3.0.0 .0/24 is subnetted, 1 subnets
O 3.3.3 .0 [110/129] via 199.99.1.1, 00:00:01, Serial1/0
199.99.1.0/24 is variably subnetted, 3 subnets, 2 masks
O 199.99.1.1/32 [110/64] via 199.99.1.1, 00:00:01, Serial1/0
C 199.99.1.0/24 is directly connected, Serial1/0
O 199.99.1.3/32 [110/128] via 199.99.1.1, 00:00:01, 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
2.0.0 .0/24 is subnetted, 1 subnets
O 2.2.2 .0 [110/129] via 199.99.1.1, 00:00:13, Serial1/0
100.0.0.0/24 is subnetted, 1 subnets
O 100.100.100.0 [110/65] via 199.99.1.1, 00:00:13, Serial1/0
3.0.0 .0/24 is subnetted, 1 subnets
C 3.3.3 .0 is directly connected, Loopback0
199.99.1.0/24 is variably subnetted, 3 subnets, 2 masks
O 199.99.1.1/32 [110/64] via 199.99.1.1, 00:00:13, Serial1/0
C 199.99.1.0/24 is directly connected, Serial1/0
O 199.99.1.2/32 [110/128] via 199.99.1.1, 00:00:13, Serial1/0
看到了吗?在这里又出现了
32
位的主机路由,那么我们可以推断出
OSPF
在接口类型为
POINT_TO_MULTIPOINT
和
point-to-multipoint non-broadcast
的时候,那么接口地址就会以
32
为主机路由得方式更新(这个只是我个人的推论,如有错误,欢迎指正!)。
实验总结:掌握在
NBMA
部分网格环境下,
OSPF
接口网络类型为
point-to-multipoint non-broadcast
时,
OSPF
的配置方法,知道在这种条件下邻居关系是不会自动建立的,需要手动添加邻居关系,并且没有
DR/BDR
的选举,默认的
HELLO
时间间隔为
30
秒,等待时间和死亡时间为
HELLO
时间间隔的
4
倍,
120
秒。